Source code
Revision control
Copy as Markdown
Other Tools
error[E0106]: missing lifetime specifier
--> tests/ui/impl-trait.rs:9:44
|
9 | pub fn ref_cast(s: impl AsRef<str>) -> &Self;
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
9 | pub fn ref_cast(s: impl AsRef<str>) -> &'static Self;
| +++++++
help: consider introducing a named lifetime parameter
|
9 | pub fn ref_cast<'a>(s: impl AsRef<str>) -> &'a Self;
| ++++ ++
error[E0562]: `impl Trait` is not allowed in paths
--> tests/ui/impl-trait.rs:9:24
|
9 | pub fn ref_cast(s: impl AsRef<str>) -> &Self;
| ^^^^^^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
error[E0562]: `impl Trait` is not allowed in paths
--> tests/ui/impl-trait.rs:12:26
|
12 | pub fn ref_cast2(s: &impl AsRef<str>) -> &Self;
| ^^^^^^^^^^^^^^^
|
= note: `impl Trait` is only allowed in arguments and return types of functions and methods