use report_generic_bound_failure
when we can in the compiler
This commit is contained in:
parent
3788f4207d
commit
508a831dca
25 changed files with 194 additions and 90 deletions
|
@ -430,7 +430,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
None
|
||||
};
|
||||
|
||||
self.check_type_tests(infcx, mir, outlives_requirements.as_mut());
|
||||
self.check_type_tests(infcx, mir, mir_def_id, outlives_requirements.as_mut());
|
||||
|
||||
self.check_universal_regions(infcx, mir, mir_def_id, outlives_requirements.as_mut());
|
||||
|
||||
|
@ -504,6 +504,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
&self,
|
||||
infcx: &InferCtxt<'_, 'gcx, 'tcx>,
|
||||
mir: &Mir<'tcx>,
|
||||
mir_def_id: DefId,
|
||||
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'gcx>>>,
|
||||
) {
|
||||
let tcx = infcx.tcx;
|
||||
|
@ -522,14 +523,56 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
}
|
||||
|
||||
// Oh the humanity. Obviously we will do better than this error eventually.
|
||||
tcx.sess.span_err(
|
||||
type_test.span,
|
||||
&format!(
|
||||
"`{}` does not outlive `{:?}`",
|
||||
let lower_bound_region = self.to_error_region(type_test.lower_bound);
|
||||
if let Some(lower_bound_region) = lower_bound_region {
|
||||
let region_scope_tree = &tcx.region_scope_tree(mir_def_id);
|
||||
infcx.report_generic_bound_failure(
|
||||
region_scope_tree,
|
||||
type_test.span,
|
||||
None,
|
||||
type_test.generic_kind,
|
||||
type_test.lower_bound,
|
||||
),
|
||||
);
|
||||
lower_bound_region,
|
||||
);
|
||||
} else {
|
||||
// FIXME. We should handle this case better. It
|
||||
// indicates that we have e.g. some region variable
|
||||
// whose value is like `'a+'b` where `'a` and `'b` are
|
||||
// distinct unrelated univesal regions that are not
|
||||
// known to outlive one another. It'd be nice to have
|
||||
// some examples where this arises to decide how best
|
||||
// to report it; we could probably handle it by
|
||||
// iterating over the universal regions and reporting
|
||||
// an error that multiple bounds are required.
|
||||
tcx.sess.span_err(
|
||||
type_test.span,
|
||||
&format!(
|
||||
"`{}` does not live long enough",
|
||||
type_test.generic_kind,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a region inference variable into a `ty::Region` that
|
||||
/// we can use for error reporting. If `r` is universally bound,
|
||||
/// then we use the name that we have on record for it. If `r` is
|
||||
/// existentially bound, then we check its inferred value and try
|
||||
/// to find a good name from that. Returns `None` if we can't find
|
||||
/// one (e.g., this is just some random part of the CFG).
|
||||
fn to_error_region(&self, r: RegionVid) -> Option<ty::Region<'tcx>> {
|
||||
if self.universal_regions.is_universal_region(r) {
|
||||
return self.definitions[r].external_name;
|
||||
} else {
|
||||
let inferred_values = self.inferred_values
|
||||
.as_ref()
|
||||
.expect("region values not yet inferred");
|
||||
let upper_bound = self.universal_upper_bound(r);
|
||||
if inferred_values.contains(r, upper_bound) {
|
||||
self.to_error_region(upper_bound)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -663,20 +706,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
/// encoding `T` as part of `try_promote_type_test_subject` (see
|
||||
/// that fn for details).
|
||||
///
|
||||
/// Since `r` is (potentially) an existential region, it has some
|
||||
/// value which may include (a) any number of points in the CFG
|
||||
/// and (b) any number of `end('x)` elements of universally
|
||||
/// quantified regions. To convert this into a single universal
|
||||
/// region we do as follows:
|
||||
///
|
||||
/// - Ignore the CFG points in `'r`. All universally quantified regions
|
||||
/// include the CFG anyhow.
|
||||
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
|
||||
/// a result `'y`.
|
||||
/// - Finally, we take the non-local upper bound of `'y`.
|
||||
/// - This uses `UniversalRegions::non_local_upper_bound`, which
|
||||
/// is similar to this method but only works on universal
|
||||
/// regions).
|
||||
/// This is based on the result `'y` of `universal_upper_bound`,
|
||||
/// except that it converts further takes the non-local upper
|
||||
/// bound of `'y`, so that the final result is non-local.
|
||||
fn non_local_universal_upper_bound(&self, r: RegionVid) -> RegionVid {
|
||||
let inferred_values = self.inferred_values.as_ref().unwrap();
|
||||
|
||||
|
@ -686,14 +718,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
inferred_values.region_value_str(r)
|
||||
);
|
||||
|
||||
// Find the smallest universal region that contains all other
|
||||
// universal regions within `region`.
|
||||
let mut lub = self.universal_regions.fr_fn_body;
|
||||
for ur in inferred_values.universal_regions_outlived_by(r) {
|
||||
lub = self.universal_regions.postdom_upper_bound(lub, ur);
|
||||
}
|
||||
|
||||
debug!("non_local_universal_upper_bound: lub={:?}", lub);
|
||||
let lub = self.universal_upper_bound(r);
|
||||
|
||||
// Grow further to get smallest universal region known to
|
||||
// creator.
|
||||
|
@ -707,6 +732,41 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
non_local_lub
|
||||
}
|
||||
|
||||
/// Returns a universally quantified region that outlives the
|
||||
/// value of `r` (`r` may be existentially or universally
|
||||
/// quantified).
|
||||
///
|
||||
/// Since `r` is (potentially) an existential region, it has some
|
||||
/// value which may include (a) any number of points in the CFG
|
||||
/// and (b) any number of `end('x)` elements of universally
|
||||
/// quantified regions. To convert this into a single universal
|
||||
/// region we do as follows:
|
||||
///
|
||||
/// - Ignore the CFG points in `'r`. All universally quantified regions
|
||||
/// include the CFG anyhow.
|
||||
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
|
||||
/// a result `'y`.
|
||||
fn universal_upper_bound(&self, r: RegionVid) -> RegionVid {
|
||||
let inferred_values = self.inferred_values.as_ref().unwrap();
|
||||
|
||||
debug!(
|
||||
"universal_upper_bound(r={:?}={})",
|
||||
r,
|
||||
inferred_values.region_value_str(r)
|
||||
);
|
||||
|
||||
// Find the smallest universal region that contains all other
|
||||
// universal regions within `region`.
|
||||
let mut lub = self.universal_regions.fr_fn_body;
|
||||
for ur in inferred_values.universal_regions_outlived_by(r) {
|
||||
lub = self.universal_regions.postdom_upper_bound(lub, ur);
|
||||
}
|
||||
|
||||
debug!("universal_upper_bound: r={:?} lub={:?}", r, lub);
|
||||
|
||||
lub
|
||||
}
|
||||
|
||||
/// Test if `test` is true when applied to `lower_bound` at
|
||||
/// `point`, and returns true or false.
|
||||
fn eval_region_test(
|
||||
|
@ -924,8 +984,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
) {
|
||||
// Obviously uncool error reporting.
|
||||
|
||||
let fr_name = self.definitions[fr].external_name;
|
||||
let outlived_fr_name = self.definitions[outlived_fr].external_name;
|
||||
let fr_name = self.to_error_region(fr);
|
||||
let outlived_fr_name = self.to_error_region(outlived_fr);
|
||||
|
||||
if let (Some(f), Some(o)) = (fr_name, outlived_fr_name) {
|
||||
let tables = infcx.tcx.typeck_tables_of(mir_def_id);
|
||||
|
|
|
@ -40,7 +40,7 @@ where
|
|||
T: Trait<'a>,
|
||||
{
|
||||
establish_relationships(value, |value| {
|
||||
//~^ ERROR `T` does not outlive
|
||||
//~^ ERROR the parameter type `T` may not live long enough
|
||||
|
||||
// This function call requires that
|
||||
//
|
||||
|
|
|
@ -9,7 +9,7 @@ note: External requirements
|
|||
|
|
||||
42 | establish_relationships(value, |value| {
|
||||
| ____________________________________^
|
||||
43 | | //~^ ERROR `T` does not outlive
|
||||
43 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
44 | |
|
||||
45 | | // This function call requires that
|
||||
... |
|
||||
|
@ -26,18 +26,20 @@ note: External requirements
|
|||
= note: number of external vids: 2
|
||||
= note: where T: '_#1r
|
||||
|
||||
error: `T` does not outlive `'_#3r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/propagate-from-trait-match.rs:42:36
|
||||
|
|
||||
42 | establish_relationships(value, |value| {
|
||||
| ____________________________________^
|
||||
43 | | //~^ ERROR `T` does not outlive
|
||||
43 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
44 | |
|
||||
45 | | // This function call requires that
|
||||
... |
|
||||
56 | | //~^ WARNING not reporting region error due to -Znll
|
||||
57 | | });
|
||||
| |_____^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/propagate-from-trait-match.rs:38:1
|
||||
|
|
|
@ -21,7 +21,7 @@ where
|
|||
T: Debug,
|
||||
{
|
||||
x
|
||||
//~^ ERROR `T` does not outlive
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a
|
||||
|
@ -37,7 +37,7 @@ where
|
|||
T: 'b + Debug,
|
||||
{
|
||||
x
|
||||
//~^ ERROR `T` does not outlive
|
||||
//~^ ERROR the parameter type `T` may not live long enough [E0309]
|
||||
}
|
||||
|
||||
fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
|
|
|
@ -10,17 +10,21 @@ warning: not reporting region error due to -Znll
|
|||
34 | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: `T` does not outlive `'_#1r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:23:5
|
||||
|
|
||||
23 | x
|
||||
| ^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: `T` does not outlive `'_#1r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/impl-trait-outlives.rs:39:5
|
||||
|
|
||||
39 | x
|
||||
| ^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ where
|
|||
fn generic2<T: Iterator>(value: T) {
|
||||
twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn invoke2<'a, T, U>(a: &T, b: Cell<&'a Option<U>>)
|
||||
|
|
|
@ -4,11 +4,13 @@ warning: not reporting region error due to -Znll
|
|||
45 | twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
| ^^^^^^^
|
||||
|
||||
error: `T` does not outlive `'_#0r`
|
||||
error[E0310]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-implied-bounds.rs:45:18
|
||||
|
|
||||
45 | twice(value, |value_ref, item| invoke2(value_ref, item));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'static`...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ where
|
|||
{
|
||||
with_signature(x, |mut y| Box::new(y.next()))
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
//~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
#[rustc_regions]
|
||||
|
@ -53,7 +53,7 @@ where
|
|||
{
|
||||
with_signature(x, |mut y| Box::new(y.next()))
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
//~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
#[rustc_regions]
|
||||
|
|
|
@ -72,11 +72,13 @@ note: External requirements
|
|||
= note: number of external vids: 4
|
||||
= note: where <T as std::iter::Iterator>::Item: '_#3r
|
||||
|
||||
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
|
||||
error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
--> $DIR/projection-no-regions-closure.rs:36:23
|
||||
|
|
||||
36 | with_signature(x, |mut y| Box::new(y.next()))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/projection-no-regions-closure.rs:32:1
|
||||
|
@ -86,7 +88,7 @@ note: No external requirements
|
|||
34 | | T: Iterator,
|
||||
35 | | {
|
||||
... |
|
||||
38 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
38 | | //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
39 | | }
|
||||
| |_^
|
||||
|
|
||||
|
@ -111,11 +113,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#6r`
|
||||
error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
--> $DIR/projection-no-regions-closure.rs:54:23
|
||||
|
|
||||
54 | with_signature(x, |mut y| Box::new(y.next()))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/projection-no-regions-closure.rs:50:1
|
||||
|
@ -125,7 +129,7 @@ note: No external requirements
|
|||
52 | | T: 'b + Iterator,
|
||||
53 | | {
|
||||
... |
|
||||
56 | | //~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
56 | | //~| ERROR the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
57 | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
@ -23,7 +23,7 @@ where
|
|||
{
|
||||
Box::new(x.next())
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
//~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
fn correct_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
|
||||
|
@ -39,7 +39,7 @@ where
|
|||
{
|
||||
Box::new(x.next())
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as std::iter::Iterator>::Item` does not outlive
|
||||
//~| the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
}
|
||||
|
||||
fn outlives_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
|
||||
|
|
|
@ -10,17 +10,21 @@ warning: not reporting region error due to -Znll
|
|||
40 | Box::new(x.next())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#4r`
|
||||
error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
--> $DIR/projection-no-regions-fn.rs:24:5
|
||||
|
|
||||
24 | Box::new(x.next())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: `<T as std::iter::Iterator>::Item` does not outlive `'_#5r`
|
||||
error[E0309]: the associated type `<T as std::iter::Iterator>::Item` may not live long enough
|
||||
--> $DIR/projection-no-regions-fn.rs:40:5
|
||||
|
|
||||
40 | Box::new(x.next())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as std::iter::Iterator>::Item: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ where
|
|||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ where
|
|||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR does not outlive free region
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ where
|
|||
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
//~| ERROR free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
|
||||
}
|
||||
|
||||
|
|
|
@ -83,11 +83,13 @@ note: External requirements
|
|||
= note: where T: '_#3r
|
||||
= note: where '_#2r: '_#3r
|
||||
|
||||
error: `T` does not outlive `'_#5r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:56:29
|
||||
|
|
||||
56 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:17), 'a))`...
|
||||
|
||||
error: free region `ReEarlyBound(0, 'b)` does not outlive free region `ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:17), 'a))`
|
||||
--> $DIR/projection-one-region-closure.rs:56:20
|
||||
|
@ -112,11 +114,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `T` does not outlive `'_#6r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:68:29
|
||||
|
|
||||
68 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
|
||||
--> $DIR/projection-one-region-closure.rs:68:20
|
||||
|
@ -142,11 +146,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `T` does not outlive `'_#6r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/projection-one-region-closure.rs:90:29
|
||||
|
|
||||
90 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: free region `ReEarlyBound(1, 'b)` does not outlive free region `ReEarlyBound(0, 'a)`
|
||||
--> $DIR/projection-one-region-closure.rs:90:20
|
||||
|
|
|
@ -48,7 +48,7 @@ where
|
|||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
|
||||
//~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
#[rustc_regions]
|
||||
|
@ -59,7 +59,7 @@ where
|
|||
{
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
//~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
#[rustc_regions]
|
||||
|
@ -80,7 +80,7 @@ where
|
|||
|
||||
with_signature(cell, t, |cell, t| require(cell, t));
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
//~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
}
|
||||
|
||||
#[rustc_regions]
|
||||
|
|
|
@ -152,11 +152,13 @@ note: External requirements
|
|||
= note: number of external vids: 3
|
||||
= note: where <T as Anything<ReClosureBound('_#1r), ReClosureBound('_#1r)>>::AssocType: '_#2r
|
||||
|
||||
error: `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
|
||||
error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:49:29
|
||||
|
|
||||
49 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:19), 'a))`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:45:1
|
||||
|
@ -166,7 +168,7 @@ note: No external requirements
|
|||
47 | | T: Anything<'b, 'c>,
|
||||
48 | | {
|
||||
... |
|
||||
51 | | //~| ERROR `<T as Anything<'_#5r, '_#6r>>::AssocType` does not outlive `'_#7r`
|
||||
51 | | //~| ERROR associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may not live long enough
|
||||
52 | | }
|
||||
| |_^
|
||||
|
|
||||
|
@ -176,11 +178,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:60:29
|
||||
|
|
||||
60 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:55:1
|
||||
|
@ -190,7 +194,7 @@ note: No external requirements
|
|||
57 | | T: Anything<'b, 'c>,
|
||||
58 | | 'a: 'a,
|
||||
... |
|
||||
62 | | //~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
62 | | //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
63 | | }
|
||||
| |_^
|
||||
|
|
||||
|
@ -201,11 +205,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
error[E0309]: the associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:81:29
|
||||
|
|
||||
81 | with_signature(cell, t, |cell, t| require(cell, t));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<T as Anything<'_#6r, '_#7r>>::AssocType: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/projection-two-region-trait-bound-closure.rs:66:1
|
||||
|
@ -215,7 +221,7 @@ note: No external requirements
|
|||
68 | | T: Anything<'b, 'c>,
|
||||
69 | | T::AssocType: 'a,
|
||||
... |
|
||||
83 | | //~| ERROR `<T as Anything<'_#6r, '_#7r>>::AssocType` does not outlive `'_#8r`
|
||||
83 | | //~| ERROR associated type `<T as Anything<'_#6r, '_#7r>>::AssocType` may not live long enough
|
||||
84 | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
@ -43,7 +43,7 @@ fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
|
|||
twice(cell, value, |a, b| invoke(a, b));
|
||||
//~^ WARNING not reporting region error
|
||||
//~| WARNING not reporting region error
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn invoke<'a, 'x, T>(x: Option<Cell<&'x &'a ()>>, y: &T)
|
||||
|
|
|
@ -60,11 +60,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `T` does not outlive `'_#3r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:43:24
|
||||
|
|
||||
43 | twice(cell, value, |a, b| invoke(a, b));
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(1:16), 'a))`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/ty-param-closure-approximate-lower-bound.rs:42:1
|
||||
|
@ -73,7 +75,7 @@ note: No external requirements
|
|||
43 | | twice(cell, value, |a, b| invoke(a, b));
|
||||
44 | | //~^ WARNING not reporting region error
|
||||
45 | | //~| WARNING not reporting region error
|
||||
46 | | //~| ERROR `T` does not outlive
|
||||
46 | | //~| ERROR the parameter type `T` may not live long enough
|
||||
47 | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
@ -36,7 +36,7 @@ where
|
|||
|
||||
with_signature(x, |y| y)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
|
@ -52,7 +52,7 @@ where
|
|||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
|
|
|
@ -25,11 +25,13 @@ note: External requirements
|
|||
= note: number of external vids: 3
|
||||
= note: where T: '_#2r
|
||||
|
||||
error: `T` does not outlive `'_#4r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:37:23
|
||||
|
|
||||
37 | with_signature(x, |y| y)
|
||||
| ^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:26:1
|
||||
|
@ -39,7 +41,7 @@ note: No external requirements
|
|||
28 | | T: Debug,
|
||||
29 | | {
|
||||
... |
|
||||
39 | | //~| ERROR `T` does not outlive
|
||||
39 | | //~| ERROR the parameter type `T` may not live long enough
|
||||
40 | | }
|
||||
| |_^
|
||||
|
|
||||
|
@ -48,11 +50,13 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `T` does not outlive `'_#4r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-return-type.rs:53:5
|
||||
|
|
||||
53 | x
|
||||
| ^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`...
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ where
|
|||
#[rustc_regions]
|
||||
fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
|
||||
with_signature(a, b, |x, y| {
|
||||
//~^ ERROR `T` does not outlive
|
||||
//~^ ERROR the parameter type `T` may not live long enough
|
||||
//
|
||||
// See `correct_region`, which explains the point of this
|
||||
// test. The only difference is that, in the case of this
|
||||
|
@ -74,7 +74,7 @@ where
|
|||
T: 'b,
|
||||
{
|
||||
with_signature(a, b, |x, y| {
|
||||
//~^ ERROR `T` does not outlive
|
||||
//~^ ERROR the parameter type `T` may not live long enough
|
||||
// See `correct_region`
|
||||
require(&x, &y)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
|
|
|
@ -15,7 +15,7 @@ note: External requirements
|
|||
|
|
||||
38 | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
39 | | //~^ ERROR `T` does not outlive
|
||||
39 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
40 | | //
|
||||
41 | | // See `correct_region`, which explains the point of this
|
||||
... |
|
||||
|
@ -58,7 +58,7 @@ note: External requirements
|
|||
|
|
||||
76 | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
77 | | //~^ ERROR `T` does not outlive
|
||||
77 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
78 | | // See `correct_region`
|
||||
79 | | require(&x, &y)
|
||||
80 | | //~^ WARNING not reporting region error due to -Znll
|
||||
|
@ -94,25 +94,27 @@ note: External requirements
|
|||
= note: number of external vids: 4
|
||||
= note: where T: '_#3r
|
||||
|
||||
error: `T` does not outlive `'_#3r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:26
|
||||
|
|
||||
38 | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
39 | | //~^ ERROR `T` does not outlive
|
||||
39 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
40 | | //
|
||||
41 | | // See `correct_region`, which explains the point of this
|
||||
... |
|
||||
46 | | //~^ WARNING not reporting region error due to -Znll
|
||||
47 | | })
|
||||
| |_____^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(1:15), 'a))`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:1
|
||||
|
|
||||
37 | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
|
||||
38 | | with_signature(a, b, |x, y| {
|
||||
39 | | //~^ ERROR `T` does not outlive
|
||||
39 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
40 | | //
|
||||
... |
|
||||
47 | | })
|
||||
|
@ -140,17 +142,19 @@ note: No external requirements
|
|||
T
|
||||
]
|
||||
|
||||
error: `T` does not outlive `'_#5r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26
|
||||
|
|
||||
76 | with_signature(a, b, |x, y| {
|
||||
| __________________________^
|
||||
77 | | //~^ ERROR `T` does not outlive
|
||||
77 | | //~^ ERROR the parameter type `T` may not live long enough
|
||||
78 | | // See `correct_region`
|
||||
79 | | require(&x, &y)
|
||||
80 | | //~^ WARNING not reporting region error due to -Znll
|
||||
81 | | })
|
||||
| |_____^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(1:21), 'a))`...
|
||||
|
||||
note: No external requirements
|
||||
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1
|
||||
|
|
|
@ -29,7 +29,7 @@ fn region_within_body<T>(t: T) {
|
|||
fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
|
||||
outlives(cell, t)
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| ERROR the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn outlives<'a, T>(x: Cell<&'a usize>, y: T)
|
||||
|
|
|
@ -4,11 +4,13 @@ warning: not reporting region error due to -Znll
|
|||
30 | outlives(cell, t)
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `T` does not outlive `'_#4r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn-body.rs:30:5
|
||||
|
|
||||
30 | outlives(cell, t)
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'a`...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ where
|
|||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
|
@ -37,7 +37,7 @@ where
|
|||
{
|
||||
x
|
||||
//~^ WARNING not reporting region error due to -Znll
|
||||
//~| ERROR `T` does not outlive
|
||||
//~| the parameter type `T` may not live long enough
|
||||
}
|
||||
|
||||
fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
|
||||
|
|
|
@ -10,17 +10,21 @@ warning: not reporting region error due to -Znll
|
|||
38 | x
|
||||
| ^
|
||||
|
||||
error: `T` does not outlive `'_#3r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn.rs:22:5
|
||||
|
|
||||
22 | x
|
||||
| ^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'a`...
|
||||
|
||||
error: `T` does not outlive `'_#4r`
|
||||
error[E0309]: the parameter type `T` may not live long enough
|
||||
--> $DIR/ty-param-fn.rs:38:5
|
||||
|
|
||||
38 | x
|
||||
| ^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `T: 'a`...
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue