You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[context("failed to parse config at `{}`", path.as_ref().display())]pubfnparse_config(path:implAsRef<Path>) -> anyhow::Result<impl std::fmt::Display>{let text = read_to_string(path.as_ref())?;Ok(text.parse()?)}
0.2.1 expands it to:
pubfnparse_config(path:implAsRef<Path>) -> anyhow::Result<impl std::fmt::Display>{let force_fn_once = ::core::iter::empty::<()>();(|| -> anyhow::Result<impl std::fmt::Display>{::core::mem::drop(force_fn_once);{let text = read_to_string(path.as_ref())?;Ok(text.parse()?)}})().map_err(|err| {
err
.context({let res = ::alloc::fmt::format(format_args!("failed to parse config at `{0}`", path.as_ref().display()),);
res
}).into()})}
which fails to compile:
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types
--> examples\context.rs:7:63
|
7 | pub fn parse_config(path: impl AsRef<Path>) -> anyhow::Result<impl std::fmt::Display> {
| ^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0562`.
The text was updated successfully, but these errors were encountered:
Example:
0.2.1 expands it to:
which fails to compile:
The text was updated successfully, but these errors were encountered: