find and highlight the & or '_ in region_name

This commit is contained in:
Niko Matsakis 2018-07-07 19:53:52 -04:00
parent 9fd3d7899a
commit a6adb1ebff
7 changed files with 300 additions and 22 deletions

View file

@ -11,7 +11,7 @@ LL | let mut lines_to_use: Vec<&CrateId> = Vec::new();
| ---------------- lifetime `'2` appears in the type of `lines_to_use`
LL | //~^ NOTE cannot infer an appropriate lifetime
LL | let push_id = |installed_id: &CrateId| {
| ------------ lifetime `'1` appears in this argument
| - let's call the lifetime of this reference `'1`
...
LL | lines_to_use.push(installed_id);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`

View file

@ -38,7 +38,7 @@ error: unsatisfied lifetime constraints
LL | let mut f: Option<&u32> = None;
| ----- lifetime `'2` appears in the type of `f`
LL | closure_expecting_bound(|x: &u32| {
| - lifetime `'1` appears in this argument
| - let's call the lifetime of this reference `'1`
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^^^^^^^^^^^ free region requires that `'1` must outlive `'2`
@ -49,7 +49,7 @@ LL | let mut f: Option<&u32> = None;
| ----- lifetime `'2` appears in the type of `f`
...
LL | closure_expecting_bound(|x: &'x u32| {
| - lifetime `'1` appears in this argument
| - let's call the lifetime of this reference `'1`
...
LL | f = Some(x);
| ^^^^^^^^^^^ free region requires that `'1` must outlive `'2`

View file

@ -14,7 +14,7 @@ error: unsatisfied lifetime constraints
--> $DIR/static-return-lifetime-infered.rs:17:9
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----- lifetime `'1` appears in this argument
| - let's call the lifetime of this reference `'1`
LL | self.x.iter().map(|a| a.0)
| ^^^^^^ cast requires that `'1` must outlive `'static`

View file

@ -26,7 +26,7 @@ error: unsatisfied lifetime constraints
--> $DIR/dyn-trait-underscore.rs:18:5
|
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
| ----- lifetime `'1` appears in this argument
| - let's call the lifetime of this reference `'1`
LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
| ^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`