Region inference error messages no longer start with 'free region'
This commit is contained in:
parent
f44807ae1e
commit
2e4224a998
8 changed files with 15 additions and 14 deletions
|
@ -39,12 +39,13 @@ enum ConstraintCategory {
|
|||
|
||||
impl fmt::Display for ConstraintCategory {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// Must end with a space. Allows for empty names to be provided.
|
||||
match self {
|
||||
ConstraintCategory::Assignment => write!(f, "assignment"),
|
||||
ConstraintCategory::Return => write!(f, "return"),
|
||||
ConstraintCategory::Cast => write!(f, "cast"),
|
||||
ConstraintCategory::CallArgument => write!(f, "argument"),
|
||||
_ => write!(f, "free region"),
|
||||
ConstraintCategory::Assignment => write!(f, "assignment "),
|
||||
ConstraintCategory::Return => write!(f, "return "),
|
||||
ConstraintCategory::Cast => write!(f, "cast "),
|
||||
ConstraintCategory::CallArgument => write!(f, "argument "),
|
||||
_ => write!(f, ""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +422,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
},
|
||||
_ => {
|
||||
diag.span_label(span, format!(
|
||||
"{} requires that `{}` must outlive `{}`",
|
||||
"{}requires that `{}` must outlive `{}`",
|
||||
category, fr_name, outlived_fr_name,
|
||||
));
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@ error: unsatisfied lifetime constraints
|
|||
LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
|
||||
| ----------^^^^^-----------------
|
||||
| | | |
|
||||
| | | free region requires that `'1` must outlive `'2`
|
||||
| | | requires that `'1` must outlive `'2`
|
||||
| | has type `&'1 i32`
|
||||
| lifetime `'2` appears in return type
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ error: unsatisfied lifetime constraints
|
|||
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
|
||||
| - let's call the lifetime of this reference `'1`
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^ free region requires that `'1` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^ requires that `'1` must outlive `'static`
|
||||
|
||||
error: unsatisfied lifetime constraints
|
||||
--> $DIR/static-return-lifetime-infered.rs:21:9
|
||||
|
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^ free region requires that `'a` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/issue-10291.rs:12:5
|
||||
|
|
||||
LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ free region requires that `'x` must outlive `'static`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'x` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ LL | || || {
|
|||
| ||_________^
|
||||
LL | ||| x.push(())
|
||||
LL | ||| }
|
||||
| |||_________^ free region requires that `'1` must outlive `'2`
|
||||
| |||_________^ requires that `'1` must outlive `'2`
|
||||
LL | || };
|
||||
| || -
|
||||
| ||_____|
|
||||
|
|
|
@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/issue-52213.rs:13:11
|
||||
|
|
||||
LL | ((u,),) => u,
|
||||
| ^ free region requires that `'a` must outlive `'b`
|
||||
| ^ requires that `'a` must outlive `'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/escape-argument-callee.rs:36:45
|
||||
|
|
||||
LL | let mut closure = expect_sig(|p, y| *p = y);
|
||||
| - - ^^^^^^ free region requires that `'1` must outlive `'2`
|
||||
| - - ^^^^^^ requires that `'1` must outlive `'2`
|
||||
| | |
|
||||
| | has type `&'1 i32`
|
||||
| has type `&mut &'2 i32`
|
||||
|
|
|
@ -8,7 +8,7 @@ error: unsatisfied lifetime constraints
|
|||
--> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5
|
||||
|
|
||||
LL | &*x
|
||||
| ^^^ free region requires that `'a` must outlive `'static`
|
||||
| ^^^ requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue