-
-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Description
https://learning-rust.github.io/docs/lifetimes/#03-with-impls-and-traits
struct Struct<'a> {
x: &'a str
}
impl<'a> Struct<'a> {
fn function<'a>(&self) -> &'a str {
self.x
}
}
error[E0496]: lifetime name 'a
shadows a lifetime name that is already in scope
--> src/lib.rs:5:21
|
4 | impl<'a> Struct<'a> {
| -- first declared here
5 | fn function<'a>(&self) -> &'a str {
| ^^ lifetime 'a
already in scope
For more information about this error, try rustc --explain E0496
.
error: could not compile playground
(lib) due to 1 previous error
Metadata
Metadata
Assignees
Labels
No labels