From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/nll/ty-outlives/impl-trait-captures.rs | 15 -- .../ui/nll/ty-outlives/impl-trait-captures.stderr | 16 -- src/test/ui/nll/ty-outlives/impl-trait-outlives.rs | 38 ---- .../ui/nll/ty-outlives/impl-trait-outlives.stderr | 25 --- src/test/ui/nll/ty-outlives/issue-53789-1.rs | 87 ------- src/test/ui/nll/ty-outlives/issue-53789-2.rs | 249 --------------------- src/test/ui/nll/ty-outlives/issue-55756.rs | 37 --- src/test/ui/nll/ty-outlives/projection-body.rs | 27 --- .../nll/ty-outlives/projection-implied-bounds.rs | 40 ---- .../ty-outlives/projection-implied-bounds.stderr | 14 -- .../ty-outlives/projection-no-regions-closure.rs | 55 ----- .../projection-no-regions-closure.stderr | 118 ---------- .../ui/nll/ty-outlives/projection-no-regions-fn.rs | 40 ---- .../ty-outlives/projection-no-regions-fn.stderr | 21 -- .../ty-outlives/projection-one-region-closure.rs | 83 ------- .../projection-one-region-closure.stderr | 155 ------------- .../projection-one-region-trait-bound-closure.rs | 84 ------- ...rojection-one-region-trait-bound-closure.stderr | 152 ------------- ...ection-one-region-trait-bound-static-closure.rs | 88 -------- ...on-one-region-trait-bound-static-closure.stderr | 114 ---------- .../projection-two-region-trait-bound-closure.rs | 112 --------- ...rojection-two-region-trait-bound-closure.stderr | 236 ------------------- .../projection-where-clause-env-wrong-bound.rs | 34 --- .../projection-where-clause-env-wrong-bound.stderr | 12 - .../projection-where-clause-env-wrong-lifetime.rs | 25 --- ...ojection-where-clause-env-wrong-lifetime.stderr | 12 - .../nll/ty-outlives/projection-where-clause-env.rs | 28 --- .../ty-outlives/projection-where-clause-none.rs | 24 -- .../projection-where-clause-none.stderr | 14 -- .../ty-outlives/projection-where-clause-trait.rs | 25 --- .../ty-param-closure-approximate-lower-bound.rs | 39 ---- ...ty-param-closure-approximate-lower-bound.stderr | 59 ----- .../ty-param-closure-outlives-from-return-type.rs | 53 ----- ...-param-closure-outlives-from-return-type.stderr | 49 ---- .../ty-param-closure-outlives-from-where-clause.rs | 82 ------- ...param-closure-outlives-from-where-clause.stderr | 122 ---------- src/test/ui/nll/ty-outlives/ty-param-fn-body.rs | 27 --- .../ui/nll/ty-outlives/ty-param-fn-body.stderr | 14 -- src/test/ui/nll/ty-outlives/ty-param-fn.rs | 36 --- src/test/ui/nll/ty-outlives/ty-param-fn.stderr | 25 --- .../ui/nll/ty-outlives/ty-param-implied-bounds.rs | 28 --- src/test/ui/nll/ty-outlives/wf-unreachable.rs | 52 ----- src/test/ui/nll/ty-outlives/wf-unreachable.stderr | 73 ------ 43 files changed, 2639 deletions(-) delete mode 100644 src/test/ui/nll/ty-outlives/impl-trait-captures.rs delete mode 100644 src/test/ui/nll/ty-outlives/impl-trait-captures.stderr delete mode 100644 src/test/ui/nll/ty-outlives/impl-trait-outlives.rs delete mode 100644 src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr delete mode 100644 src/test/ui/nll/ty-outlives/issue-53789-1.rs delete mode 100644 src/test/ui/nll/ty-outlives/issue-53789-2.rs delete mode 100644 src/test/ui/nll/ty-outlives/issue-55756.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-body.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-implied-bounds.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-closure.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-env.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-none.rs delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr delete mode 100644 src/test/ui/nll/ty-outlives/projection-where-clause-trait.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn.rs delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-fn.stderr delete mode 100644 src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs delete mode 100644 src/test/ui/nll/ty-outlives/wf-unreachable.rs delete mode 100644 src/test/ui/nll/ty-outlives/wf-unreachable.stderr (limited to 'src/test/ui/nll/ty-outlives') diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs deleted file mode 100644 index 67b31b8bc..000000000 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs +++ /dev/null @@ -1,15 +0,0 @@ -// compile-flags:-Zverbose - -#![allow(warnings)] - -trait Foo<'a> { -} - -impl<'a, T> Foo<'a> for T { } - -fn foo<'a, T>(x: &T) -> impl Foo<'a> { - x - //~^ ERROR captures lifetime that does not appear in bounds -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr deleted file mode 100644 index 7b9ed171d..000000000 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds - --> $DIR/impl-trait-captures.rs:11:5 - | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | -- hidden type `&ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) T` captures the anonymous lifetime defined here -LL | x - | ^ - | -help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReEarlyBound(0, 'a), T, ReEarlyBound(2, 'a)])` captures `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))`, you can add an explicit `ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_))` lifetime bound - | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReFree(DefId(0:8 ~ impl_trait_captures[1afc]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[1afc]::foo::'_), '_)) { - | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0700`. diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs deleted file mode 100644 index 68ccb51fc..000000000 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs +++ /dev/null @@ -1,38 +0,0 @@ -// compile-flags:-Zverbose - -#![allow(warnings)] - -use std::fmt::Debug; - -fn no_region<'a, T>(x: Box) -> impl Debug + 'a -where - T: Debug, -{ - x - //~^ ERROR the parameter type `T` may not live long enough [E0309] -} - -fn correct_region<'a, T>(x: Box) -> impl Debug + 'a -where - T: 'a + Debug, -{ - x -} - -fn wrong_region<'a, 'b, T>(x: Box) -> impl Debug + 'a -where - T: 'b + Debug, -{ - x - //~^ ERROR the parameter type `T` may not live long enough [E0309] -} - -fn outlives_region<'a, 'b, T>(x: Box) -> impl Debug + 'a -where - T: 'b + Debug, - 'b: 'a, -{ - x -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr deleted file mode 100644 index 64b08a9b3..000000000 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:11:5 - | -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: Debug + 'a, - | ++++ - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:26:5 - | -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: 'b + Debug + 'a, - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/issue-53789-1.rs b/src/test/ui/nll/ty-outlives/issue-53789-1.rs deleted file mode 100644 index a5201d4bb..000000000 --- a/src/test/ui/nll/ty-outlives/issue-53789-1.rs +++ /dev/null @@ -1,87 +0,0 @@ -// Regression test for #53789. -// -// check-pass - -use std::collections::BTreeMap; - -trait ValueTree { - type Value; -} - -trait Strategy { - type Value: ValueTree; -} - -type StrategyFor = StrategyType<'static, A>; -type StrategyType<'a, A> = >::Strategy; - -impl Strategy for (K, V) { - type Value = TupleValueTree<(K, V)>; -} - -impl ValueTree for TupleValueTree<(K, V)> { - type Value = BTreeMapValueTree; -} - -struct TupleValueTree { - tree: T, -} - -struct BTreeMapStrategy(std::marker::PhantomData<(K, V)>) -where - K: Strategy, - V: Strategy; - -struct BTreeMapValueTree(std::marker::PhantomData<(K, V)>) -where - K: ValueTree, - V: ValueTree; - -impl Strategy for BTreeMapStrategy -where - K: Strategy, - V: Strategy, -{ - type Value = BTreeMapValueTree; -} - -impl ValueTree for BTreeMapValueTree -where - K: ValueTree, - V: ValueTree, -{ - type Value = BTreeMap; -} - -trait Arbitrary<'a>: Sized { - fn arbitrary_with(args: Self::Parameters) -> Self::Strategy; - type Parameters; - type Strategy: Strategy; - type ValueTree: ValueTree; -} - -impl<'a, A, B> Arbitrary<'a> for BTreeMap -where - A: Arbitrary<'static>, - B: Arbitrary<'static>, - StrategyFor: 'static, - StrategyFor: 'static, -{ - type ValueTree = ::Value; - type Parameters = (A::Parameters, B::Parameters); - type Strategy = BTreeMapStrategy; - fn arbitrary_with(args: Self::Parameters) -> BTreeMapStrategy { - let (a, b) = args; - btree_map(any_with::(a), any_with::(b)) - } -} - -fn btree_map(key: K, value: V) -> BTreeMapStrategy { - unimplemented!() -} - -fn any_with<'a, A: Arbitrary<'a>>(args: A::Parameters) -> StrategyType<'a, A> { - unimplemented!() -} - -fn main() { } diff --git a/src/test/ui/nll/ty-outlives/issue-53789-2.rs b/src/test/ui/nll/ty-outlives/issue-53789-2.rs deleted file mode 100644 index 5109a0e4a..000000000 --- a/src/test/ui/nll/ty-outlives/issue-53789-2.rs +++ /dev/null @@ -1,249 +0,0 @@ -// Regression test for #53789. -// -// check-pass - -use std::cmp::Ord; -use std::collections::BTreeMap; -use std::ops::Range; - -macro_rules! valuetree { - () => { - type ValueTree = ::Value; - }; -} - -macro_rules! product_unpack { - ($factor: pat) => { - ($factor,) - }; - ($($factor: pat),*) => { - ( $( $factor ),* ) - }; - ($($factor: pat),*,) => { - ( $( $factor ),* ) - }; -} - -macro_rules! product_type { - ($factor: ty) => { - ($factor,) - }; - ($($factor: ty),*) => { - ( $( $factor, )* ) - }; - ($($factor: ty),*,) => { - ( $( $factor, )* ) - }; -} - -macro_rules! default { - ($type: ty, $val: expr) => { - impl Default for $type { - fn default() -> Self { - $val.into() - } - } - }; -} - -// Pervasive internal sugar -macro_rules! mapfn { - ($(#[$meta:meta])* [$($vis:tt)*] - fn $name:ident[$($gen:tt)*]($parm:ident: $input:ty) -> $output:ty { - $($body:tt)* - }) => { - $(#[$meta])* - #[derive(Clone, Copy)] - $($vis)* struct $name; - impl $($gen)* statics::MapFn<$input> for $name { - type Output = $output; - } - } -} - -macro_rules! opaque_strategy_wrapper { - ($(#[$smeta:meta])* pub struct $stratname:ident - [$($sgen:tt)*][$($swhere:tt)*] - ($innerstrat:ty) -> $stratvtty:ty; - - $(#[$vmeta:meta])* pub struct $vtname:ident - [$($vgen:tt)*][$($vwhere:tt)*] - ($innervt:ty) -> $actualty:ty; - ) => { - $(#[$smeta])* struct $stratname $($sgen)* (std::marker::PhantomData<(K, V)>) - $($swhere)*; - - $(#[$vmeta])* struct $vtname $($vgen)* ($innervt) $($vwhere)*; - - impl $($sgen)* Strategy for $stratname $($sgen)* $($swhere)* { - type Value = $stratvtty; - } - - impl $($vgen)* ValueTree for $vtname $($vgen)* $($vwhere)* { - type Value = $actualty; - } - } -} - -trait ValueTree { - type Value; -} - -trait Strategy { - type Value: ValueTree; -} - -#[derive(Clone)] -struct VecStrategy { - element: T, - size: Range, -} - -fn vec(element: T, size: Range) -> VecStrategy { - VecStrategy { element: element, size: size } -} - -type ValueFor = <::Value as ValueTree>::Value; - -trait Arbitrary<'a>: Sized { - fn arbitrary_with(args: Self::Parameters) -> Self::Strategy; - - type Parameters: Default; - type Strategy: Strategy; - type ValueTree: ValueTree; -} - -type StrategyFor = StrategyType<'static, A>; -type StrategyType<'a, A> = >::Strategy; - -//#[derive(Clone, PartialEq, Eq, Hash, Debug, From, Into)] -struct SizeBounds(Range); -default!(SizeBounds, 0..100); - -impl From> for SizeBounds { - fn from(high: Range) -> Self { - unimplemented!() - } -} - -impl From for Range { - fn from(high: SizeBounds) -> Self { - unimplemented!() - } -} - -fn any_with<'a, A: Arbitrary<'a>>(args: A::Parameters) -> StrategyType<'a, A> { - unimplemented!() -} - -impl Strategy for (K, V) -where - ::Value: Ord, -{ - type Value = TupleValueTree<(K, V)>; -} - -impl ValueTree for TupleValueTree<(K, V)> -where - ::Value: Ord, -{ - type Value = BTreeMapValueTree; -} - -#[derive(Clone)] -struct VecValueTree { - elements: Vec, -} - -#[derive(Clone, Copy)] -struct TupleValueTree { - tree: T, -} - -opaque_strategy_wrapper! { - #[derive(Clone)] - pub struct BTreeMapStrategy[] - [where K : Strategy, V : Strategy, ValueFor : Ord]( - statics::Filter, - VecToBTreeMap>, MinSize>) - -> BTreeMapValueTree; - - #[derive(Clone)] - pub struct BTreeMapValueTree[] - [where K : ValueTree, V : ValueTree, K::Value : Ord]( - statics::Filter>, - VecToBTreeMap>, MinSize>) - -> BTreeMap; -} - -type RangedParams2 = product_type![SizeBounds, A, B]; - -impl<'a, A, B> Arbitrary<'a> for BTreeMap -where - A: Arbitrary<'static> + Ord, - B: Arbitrary<'static>, - StrategyFor: 'static, - StrategyFor: 'static, -{ - valuetree!(); - type Parameters = RangedParams2; - type Strategy = BTreeMapStrategy; - fn arbitrary_with(args: Self::Parameters) -> Self::Strategy { - let product_unpack![range, a, b] = args; - btree_map(any_with::(a), any_with::(b), range.into()) - } -} - -#[derive(Clone, Copy)] -struct MinSize(usize); - -mapfn! { - [] fn VecToBTreeMap[] - (vec: Vec<(K, V)>) -> BTreeMap - { - vec.into_iter().collect() - } -} - -fn btree_map( - key: K, - value: V, - size: Range, -) -> BTreeMapStrategy -where - ValueFor: Ord, -{ - unimplemented!() -} - -mod statics { - pub(super) trait MapFn { - type Output; - } - - #[derive(Clone)] - pub struct Filter { - source: S, - fun: F, - } - - impl Filter { - pub fn new(source: S, whence: String, filter: F) -> Self { - unimplemented!() - } - } - - #[derive(Clone)] - pub struct Map { - source: S, - fun: F, - } - - impl Map { - pub fn new(source: S, fun: F) -> Self { - unimplemented!() - } - } -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/issue-55756.rs b/src/test/ui/nll/ty-outlives/issue-55756.rs deleted file mode 100644 index e1a3bc3c4..000000000 --- a/src/test/ui/nll/ty-outlives/issue-55756.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Regression test for #55756. -// -// In this test, the result of `self.callee` is a projection `>::Guard`. As it may contain a destructor, the dropck -// rules require that this type outlivess the scope of `state`. Unfortunately, -// our region inference is not smart enough to figure out how to -// translate a requirement like -// -// >::guard: 'r -// -// into a requirement that `'0: 'r` -- in particular, it fails to do -// so because it *also* knows that `>::Guard: 'a` -// from the trait definition. Faced with so many choices, the current -// solver opts to do nothing. -// -// Fixed by tweaking the solver to recognize that the constraint from -// the environment duplicates one from the trait. -// -// check-pass - -#![crate_type="lib"] - -pub trait Database<'a> { - type Guard: 'a; -} - -pub struct Stateful<'a, D: 'a>(&'a D); - -impl<'b, D: for <'a> Database<'a>> Stateful<'b, D> { - pub fn callee<'a>(&'a self) -> >::Guard { - unimplemented!() - } - pub fn caller<'a>(&'a self) -> >::Guard { - let state = self.callee(); - unimplemented!() - } -} diff --git a/src/test/ui/nll/ty-outlives/projection-body.rs b/src/test/ui/nll/ty-outlives/projection-body.rs deleted file mode 100644 index b03a539eb..000000000 --- a/src/test/ui/nll/ty-outlives/projection-body.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Test that when we infer the lifetime to a subset of the fn body, it -// works out. -// -// check-pass - -trait MyTrait<'a> { - type Output; -} - -fn foo1() -where - for<'x> T: MyTrait<'x>, -{ - // Here the region `'c` in `>::Output` will be - // inferred to a subset of the fn body. - let x = bar::(); - drop(x); -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs b/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs deleted file mode 100644 index e1dac0824..000000000 --- a/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Test that we can deduce when projections like `T::Item` outlive the -// function body. Test that this does not imply that `T: 'a` holds. - -// compile-flags:-Zverbose - -use std::cell::Cell; - -fn twice(mut value: T, mut f: F) -where - F: FnMut(&T, Cell<&Option>), - T: Iterator, -{ - let mut n = value.next(); - f(&value, Cell::new(&n)); - f(&value, Cell::new(&n)); -} - -fn generic1(value: T) { - // No error here: - twice(value, |value_ref, item| invoke1(item)); -} - -fn invoke1<'a, T>(x: Cell<&'a Option>) -where - T: 'a, -{ -} - -fn generic2(value: T) { - twice(value, |value_ref, item| invoke2(value_ref, item)); - //~^ ERROR the parameter type `T` may not live long enough -} - -fn invoke2<'a, T, U>(a: &T, b: Cell<&'a Option>) -where - T: 'a, -{ -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr deleted file mode 100644 index d949e29b2..000000000 --- a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0310]: the parameter type `T` may not live long enough - --> $DIR/projection-implied-bounds.rs:30:36 - | -LL | twice(value, |value_ref, item| invoke2(value_ref, item)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn generic2(value: T) { - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs deleted file mode 100644 index 2d9c008c7..000000000 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs +++ /dev/null @@ -1,55 +0,0 @@ -// compile-flags:-Zverbose - -// Tests closures that propagate an outlives relationship to their -// creator where the subject is a projection with no regions (`::Item`, to be exact). - -#![allow(warnings)] -#![feature(rustc_attrs)] - -trait Anything { } - -impl Anything for T { } - -fn with_signature<'a, T, F>(x: Box, op: F) -> Box - where F: FnOnce(Box) -> Box -{ - op(x) -} - -#[rustc_regions] -fn no_region<'a, T>(x: Box) -> Box -where - T: Iterator, -{ - with_signature(x, |mut y| Box::new(y.next())) - //~^ ERROR the associated type `::Item` may not live long enough -} - -#[rustc_regions] -fn correct_region<'a, T>(x: Box) -> Box -where - T: 'a + Iterator, -{ - with_signature(x, |mut y| Box::new(y.next())) -} - -#[rustc_regions] -fn wrong_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Iterator, -{ - with_signature(x, |mut y| Box::new(y.next())) - //~^ ERROR the associated type `::Item` may not live long enough -} - -#[rustc_regions] -fn outlives_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Iterator, - 'b: 'a, -{ - with_signature(x, |mut y| Box::new(y.next())) -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr deleted file mode 100644 index 4933b9348..000000000 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ /dev/null @@ -1,118 +0,0 @@ -note: external requirements - --> $DIR/projection-no-regions-closure.rs:25:23 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^ - | - = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, - (), - ] - = note: number of external vids: 3 - = note: where ::Item: '_#2r - -note: no external requirements - --> $DIR/projection-no-regions-closure.rs:21:1 - | -LL | / fn no_region<'a, T>(x: Box) -> Box -LL | | where -LL | | T: Iterator, - | |________________^ - | - = note: defining type: no_region::<'_#1r, T> - -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:25:31 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - = note: ...so that the type `::Item` will meet its required lifetime bounds - -note: external requirements - --> $DIR/projection-no-regions-closure.rs:34:23 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^ - | - = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, - (), - ] - = note: number of external vids: 3 - = note: where ::Item: '_#2r - -note: no external requirements - --> $DIR/projection-no-regions-closure.rs:30:1 - | -LL | / fn correct_region<'a, T>(x: Box) -> Box -LL | | where -LL | | T: 'a + Iterator, - | |_____________________^ - | - = note: defining type: correct_region::<'_#1r, T> - -note: external requirements - --> $DIR/projection-no-regions-closure.rs:42:23 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^ - | - = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, - (), - ] - = note: number of external vids: 4 - = note: where ::Item: '_#3r - -note: no external requirements - --> $DIR/projection-no-regions-closure.rs:38:1 - | -LL | / fn wrong_region<'a, 'b, T>(x: Box) -> Box -LL | | where -LL | | T: 'b + Iterator, - | |_____________________^ - | - = note: defining type: wrong_region::<'_#1r, '_#2r, T> - -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:42:31 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - = note: ...so that the type `::Item` will meet its required lifetime bounds - -note: external requirements - --> $DIR/projection-no-regions-closure.rs:52:23 - | -LL | with_signature(x, |mut y| Box::new(y.next())) - | ^^^^^^^ - | - = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, - (), - ] - = note: number of external vids: 4 - = note: where ::Item: '_#3r - -note: no external requirements - --> $DIR/projection-no-regions-closure.rs:47:1 - | -LL | / fn outlives_region<'a, 'b, T>(x: Box) -> Box -LL | | where -LL | | T: 'b + Iterator, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: outlives_region::<'_#1r, '_#2r, T> - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs deleted file mode 100644 index a10a0366a..000000000 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs +++ /dev/null @@ -1,40 +0,0 @@ -// compile-flags:-Zverbose - -#![allow(warnings)] - -trait Anything { } - -impl Anything for T { } - -fn no_region<'a, T>(mut x: T) -> Box -where - T: Iterator, -{ - Box::new(x.next()) - //~^ ERROR the associated type `::Item` may not live long enough -} - -fn correct_region<'a, T>(mut x: T) -> Box -where - T: 'a + Iterator, -{ - Box::new(x.next()) -} - -fn wrong_region<'a, 'b, T>(mut x: T) -> Box -where - T: 'b + Iterator, -{ - Box::new(x.next()) - //~^ ERROR the associated type `::Item` may not live long enough -} - -fn outlives_region<'a, 'b, T>(mut x: T) -> Box -where - T: 'b + Iterator, - 'b: 'a, -{ - Box::new(x.next()) -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr deleted file mode 100644 index e0ff544fe..000000000 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-fn.rs:13:5 - | -LL | Box::new(x.next()) - | ^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - = note: ...so that the type `::Item` will meet its required lifetime bounds - -error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-fn.rs:28:5 - | -LL | Box::new(x.next()) - | ^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `::Item: 'a`... - = note: ...so that the type `::Item` will meet its required lifetime bounds - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs deleted file mode 100644 index af361e990..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Test cases where we constrain `>::AssocType` to -// outlive `'a` and there are no bounds in the trait definition of -// `Anything`. This means that the constraint can only be satisfied in two -// ways: -// -// - by ensuring that `T: 'a` and `'b: 'a`, or -// - by something in the where clauses. -// -// As of this writing, the where clause option does not work because -// of limitations in our region inferencing system (this is true both -// with and without NLL). See `projection_outlives`. -// -// Ensuring that both `T: 'a` and `'b: 'a` holds does work (`elements_outlive`). - -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -trait Anything<'a> { - type AssocType; -} - -fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) -where - F: FnOnce(Cell<&'a ()>, T), -{ - op(cell, t) -} - -fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ -} - -#[rustc_regions] -fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR the parameter type `T` may not live long enough - //~| ERROR -} - -#[rustc_regions] -fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - 'a: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR the parameter type `T` may not live long enough - //~| ERROR -} - -#[rustc_regions] -fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ - // We are projecting `>::AssocType`, and we know - // that this outlives `'a` because of the where-clause. - - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - T: 'a, - 'b: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr deleted file mode 100644 index dbda04c42..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ /dev/null @@ -1,155 +0,0 @@ -note: external requirements - --> $DIR/projection-one-region-closure.rs:45:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: late-bound region is '_#3r - = note: number of external vids: 4 - = note: where T: '_#2r - = note: where '_#1r: '_#2r - -note: no external requirements - --> $DIR/projection-one-region-closure.rs:41:1 - | -LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, - | |____________________^ - | - = note: defining type: no_relationships_late::<'_#1r, T> - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:45:39 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: Anything<'b> + 'a, - | ++++ - -error: lifetime may not live long enough - --> $DIR/projection-one-region-closure.rs:45:39 - | -LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -note: external requirements - --> $DIR/projection-one-region-closure.rs:56:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where T: '_#3r - = note: where '_#2r: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-closure.rs:51:1 - | -LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | 'a: 'a, - | |___________^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:56:39 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: Anything<'b> + 'a, - | ++++ - -error: lifetime may not live long enough - --> $DIR/projection-one-region-closure.rs:56:39 - | -LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -note: external requirements - --> $DIR/projection-one-region-closure.rs:70:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where >::AssocType: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-closure.rs:62:1 - | -LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | T::AssocType: 'a, - | |_____________________^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T> - -note: external requirements - --> $DIR/projection-one-region-closure.rs:80:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where T: '_#3r - = note: where '_#2r: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-closure.rs:74:1 - | -LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | T: 'a, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T> - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs deleted file mode 100644 index 6f8513491..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Test cases where we constrain `>::AssocType` to -// outlive `'a` and there is a unique bound in the trait definition of -// `Anything` -- i.e., we know that `AssocType` outlives `'b`. In this -// case, the best way to satisfy the trait bound is to show that `'b: -// 'a`, which can be done in various ways. - -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -trait Anything<'a> { - type AssocType: 'a; -} - -fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) -where - F: FnOnce(Cell<&'a ()>, T), -{ - op(cell, t) -} - -fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ -} - -#[rustc_regions] -fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR -} - -#[rustc_regions] -fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - 'a: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR -} - -#[rustc_regions] -fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ - // We are projecting `>::AssocType`, and we know - // that this outlives `'a` because of the where-clause. - - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - 'b: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'a>, -{ - // Note that in this case the closure still propagates an external - // requirement between two variables in its signature, but the - // creator maps both those two region variables to `'a` on its - // side. - with_signature(cell, t, |cell, t| require(cell, t)); -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr deleted file mode 100644 index 250c796e2..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ /dev/null @@ -1,152 +0,0 @@ -note: external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:37:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: late-bound region is '_#3r - = note: number of external vids: 4 - = note: where '_#1r: '_#2r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:33:1 - | -LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, - | |____________________^ - | - = note: defining type: no_relationships_late::<'_#1r, T> - -error: lifetime may not live long enough - --> $DIR/projection-one-region-trait-bound-closure.rs:37:39 - | -LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -note: external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:47:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where '_#2r: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:42:1 - | -LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | 'a: 'a, - | |___________^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> - -error: lifetime may not live long enough - --> $DIR/projection-one-region-trait-bound-closure.rs:47:39 - | -LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -note: external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:60:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where >::AssocType: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 - | -LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | T::AssocType: 'a, - | |_____________________^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T> - -note: external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:69:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where '_#2r: '_#3r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:64:1 - | -LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T> - -note: external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:81:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: number of external vids: 3 - = note: where '_#1r: '_#2r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:73:1 - | -LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'a>, - | |____________________^ - | - = note: defining type: one_region::<'_#1r, T> - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs deleted file mode 100644 index 7c0a3bc72..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Test cases where we constrain `>::AssocType` to -// outlive `'static`. In this case, we don't get any errors, and in fact -// we don't even propagate constraints from the closures to the callers. - -// compile-flags:-Zverbose -// check-pass - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -trait Anything<'a> { - type AssocType: 'static; -} - -fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) -where - F: FnOnce(Cell<&'a ()>, T), -{ - op(cell, t) -} - -fn require<'a, 'b, T>(_cell: Cell<&'a ()>, _t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ -} - -#[rustc_regions] -fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - 'a: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - T::AssocType: 'a, -{ - // This error is unfortunate. This code ought to type-check: we - // are projecting `>::AssocType`, and we know - // that this outlives `'a` because of the where-clause. However, - // the way the region checker works, we don't register this - // outlives obligation, and hence we get an error: this is because - // what we see is a projection like `>::AssocType`, and we don't yet know if `?0` will - // equal `'b` or not, so we ignore the where-clause. Obviously we - // can do better here with a more involved verification step. - - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b>, - 'b: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'a>, -{ - // Note that in this case the closure still propagates an external - // requirement between two variables in its signature, but the - // creator maps both those two region variables to `'a` on its - // side. - with_signature(cell, t, |cell, t| require(cell, t)); -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr deleted file mode 100644 index b27186b05..000000000 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ /dev/null @@ -1,114 +0,0 @@ -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:36:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_late::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: late-bound region is '_#3r - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:32:1 - | -LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, - | |____________________^ - | - = note: defining type: no_relationships_late::<'_#1r, T> - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:45:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:40:1 - | -LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | 'a: 'a, - | |___________^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, T> - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:64:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:49:1 - | -LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | T::AssocType: 'a, - | |_____________________^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, T> - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:73:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:68:1 - | -LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b>, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: elements_outlive::<'_#1r, '_#2r, T> - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:85:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - -note: no external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:77:1 - | -LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'a>, - | |____________________^ - | - = note: defining type: one_region::<'_#1r, T> - diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs deleted file mode 100644 index 7b4a3c03a..000000000 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs +++ /dev/null @@ -1,112 +0,0 @@ -// Test cases where we constrain `>::AssocType` -// to outlive `'a` and there are two bounds in the trait definition of -// `Anything` -- i.e., we know that `AssocType` outlives `'a` and -// `'b`. In this case, it's not clear what is the best way to satisfy -// the trait bound, and hence we propagate it to the caller as a type -// test. - -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -trait Anything<'a, 'b> { - type AssocType: 'a + 'b; -} - -fn with_signature<'a, T, F>(cell: Cell<&'a ()>, t: T, op: F) -where - F: FnOnce(Cell<&'a ()>, T), -{ - op(cell, t) -} - -fn require<'a, 'b, 'c, T>(_cell: Cell<&'a ()>, _t: T) -where - T: Anything<'b, 'c>, - T::AssocType: 'a, -{ -} - -#[rustc_regions] -fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'c>, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR may not live long enough -} - -#[rustc_regions] -fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'c>, - 'a: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR may not live long enough -} - -#[rustc_regions] -fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'c>, - T::AssocType: 'a, -{ - // We are projecting `>::AssocType`, and we know - // that this outlives `'a` because of the where-clause. - - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'c>, - 'b: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'c>, - 'c: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'b>, -{ - with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR lifetime may not live long enough -} - -#[rustc_regions] -fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'b, 'b>, - 'b: 'a, -{ - with_signature(cell, t, |cell, t| require(cell, t)); -} - -#[rustc_regions] -fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -where - T: Anything<'a, 'a>, -{ - // Note that in this case the closure still propagates an external - // requirement between two variables in its signature, but the - // creator maps both those two region variables to `'a` on its - // side. - with_signature(cell, t, |cell, t| require(cell, t)); -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr deleted file mode 100644 index 90f049142..000000000 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ /dev/null @@ -1,236 +0,0 @@ -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:38:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_late::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: late-bound region is '_#4r - = note: number of external vids: 5 - = note: where >::AssocType: '_#3r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 - | -LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'c>, - | |________________________^ - | - = note: defining type: no_relationships_late::<'_#1r, '_#2r, T> - -error[E0309]: the associated type `>::AssocType` may not live long enough - --> $DIR/projection-two-region-trait-bound-closure.rs:38:39 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... - = note: ...so that the type `>::AssocType` will meet its required lifetime bounds - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), - ] - = note: number of external vids: 5 - = note: where >::AssocType: '_#4r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 - | -LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'c>, -LL | | 'a: 'a, - | |___________^ - | - = note: defining type: no_relationships_early::<'_#1r, '_#2r, '_#3r, T> - -error[E0309]: the associated type `>::AssocType` may not live long enough - --> $DIR/projection-two-region-trait-bound-closure.rs:48:39 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `>::AssocType: 'a`... - = note: ...so that the type `>::AssocType` will meet its required lifetime bounds - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), - ] - = note: number of external vids: 5 - = note: where >::AssocType: '_#4r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 - | -LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'c>, -LL | | T::AssocType: 'a, - | |_____________________^ - | - = note: defining type: projection_outlives::<'_#1r, '_#2r, '_#3r, T> - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:70:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), - ] - = note: number of external vids: 5 - = note: where >::AssocType: '_#4r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 - | -LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'c>, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: elements_outlive1::<'_#1r, '_#2r, '_#3r, T> - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:79:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#4r ()>, T)), - (), - ] - = note: number of external vids: 5 - = note: where >::AssocType: '_#4r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 - | -LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'c>, -LL | | 'c: 'a, - | |___________^ - | - = note: defining type: elements_outlive2::<'_#1r, '_#2r, '_#3r, T> - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: two_regions::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: late-bound region is '_#3r - = note: number of external vids: 4 - = note: where >::AssocType: '_#2r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 - | -LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'b>, - | |________________________^ - | - = note: defining type: two_regions::<'_#1r, T> - -error: lifetime may not live long enough - --> $DIR/projection-two-region-trait-bound-closure.rs:87:5 - | -LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - = note: requirement occurs because of the type `Cell<&'_#8r ()>`, which makes the generic argument `&'_#8r ()` invariant - = note: the struct `Cell` is invariant over the parameter `T` - = help: see for more information about variance - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where >::AssocType: '_#3r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 - | -LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'b, 'b>, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: two_regions_outlive::<'_#1r, '_#2r, T> - -note: external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:109:29 - | -LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^ - | - = note: defining type: one_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: number of external vids: 3 - = note: where >::AssocType: '_#2r - -note: no external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 - | -LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) -LL | | where -LL | | T: Anything<'a, 'a>, - | |________________________^ - | - = note: defining type: one_region::<'_#1r, T> - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs deleted file mode 100644 index dce88b88c..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Test that we are able to establish that `>::Output` outlives `'b` here. We need to prove however -// that `>::Output` outlives `'a`, so we also have to -// prove that `'b: 'a`. - -trait MyTrait<'a> { - type Output; -} - -fn foo1<'a, 'b, T>() -> &'a () -where - T: MyTrait<'a>, - >::Output: 'b, -{ - bar::() //~ ERROR may not live long enough -} - -fn foo2<'a, 'b, T>() -> &'a () -where - T: MyTrait<'a>, - >::Output: 'b, - 'b: 'a, -{ - bar::() // OK -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr deleted file mode 100644 index b4435fe06..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 - | -LL | bar::() - | ^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `>::Output: 'a`... - = note: ...so that the type `>::Output` will meet its required lifetime bounds - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs deleted file mode 100644 index 987148dce..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Test that if we need to prove that `>::Output: -// 'a`, but we only know that `>::Output: 'a`, that -// doesn't suffice. - -trait MyTrait<'a> { - type Output; -} - -fn foo1<'a, 'b, T>() -> &'a () -where - for<'x> T: MyTrait<'x>, - >::Output: 'a, -{ - bar::<>::Output>() - //~^ ERROR the associated type `>::Output` may not live long enough -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr deleted file mode 100644 index ddeaf3c1f..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0309]: the associated type `>::Output` may not live long enough - --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 - | -LL | bar::<>::Output>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `>::Output: 'a`... - = note: ...so that the type `>::Output` will meet its required lifetime bounds - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs deleted file mode 100644 index a41116232..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Test that when we have a `>::Output: 'a` -// relationship in the environment we take advantage of it. In this -// case, that means we **don't** have to prove that `T: 'a`. -// -// Regression test for #53121. -// -// check-pass - -trait MyTrait<'a> { - type Output; -} - -fn foo<'a, T>() -> &'a () -where - T: MyTrait<'a>, - >::Output: 'a, -{ - bar::() -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-none.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-none.rs deleted file mode 100644 index bb201e5c0..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-none.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Test that we are NOT able to establish that `>::Output: 'a` outlives `'a` here -- we have only one -// recourse, which is to prove that `T: 'a` and `'a: 'a`, but we don't -// know that `T: 'a`. - -trait MyTrait<'a> { - type Output; -} - -fn foo<'a, T>() -> &'a () -where - T: MyTrait<'a>, -{ - bar::() //~ ERROR the parameter type `T` may not live long enough -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr deleted file mode 100644 index 0df44644d..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-where-clause-none.rs:14:5 - | -LL | bar::() - | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: MyTrait<'a> + 'a, - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-trait.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-trait.rs deleted file mode 100644 index 1a40d3b4c..000000000 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-trait.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Test that we are able to establish that `>::Output: 'a` outlives `'a` (because the trait says -// so). -// -// check-pass - -trait MyTrait<'a> { - type Output: 'a; -} - -fn foo<'a, T>() -> &'a () -where - T: MyTrait<'a>, -{ - bar::() -} - -fn bar<'a, T>() -> &'a () -where - T: 'a, -{ - &() -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs deleted file mode 100644 index 4d8380599..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs +++ /dev/null @@ -1,39 +0,0 @@ -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -// Invoke in such a way that the callee knows: -// -// - 'a: 'x -// -// and it must prove that `T: 'x`. Callee passes along `T: 'a`. -fn twice<'a, F, T>(v: Cell<&'a ()>, value: T, mut f: F) -where - F: for<'x> FnMut(Option>, &T), -{ - f(None, &value); - f(None, &value); -} - -#[rustc_regions] -fn generic(value: T) { - let cell = Cell::new(&()); - twice(cell, value, |a, b| invoke(a, b)); -} - -#[rustc_regions] -fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { - twice(cell, value, |a, b| invoke(a, b)); - //~^ ERROR the parameter type `T` may not live long enough -} - -fn invoke<'a, 'x, T>(x: Option>, y: &T) -where - T: 'x, -{ -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr deleted file mode 100644 index a442cf12d..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ /dev/null @@ -1,59 +0,0 @@ -note: external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:24:24 - | -LL | twice(cell, value, |a, b| invoke(a, b)); - | ^^^^^^ - | - = note: defining type: generic::::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), - (), - ] - = note: number of external vids: 2 - = note: where T: '_#1r - -note: no external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 - | -LL | fn generic(value: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: defining type: generic:: - -note: external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 - | -LL | twice(cell, value, |a, b| invoke(a, b)); - | ^^^^^^ - | - = note: defining type: generic_fail::::{closure#0} with closure substs [ - i16, - for extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), - (), - ] - = note: late-bound region is '_#2r - = note: number of external vids: 3 - = note: where T: '_#1r - -note: no external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 - | -LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: defining type: generic_fail:: - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:31 - | -LL | twice(cell, value, |a, b| invoke(a, b)); - | ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn generic_fail<'a, T: 'a>(cell: Cell<&'a ()>, value: T) { - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs deleted file mode 100644 index 4343c3aee..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs +++ /dev/null @@ -1,53 +0,0 @@ -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::fmt::Debug; - -fn with_signature<'a, T, F>(x: Box, op: F) -> Box - where F: FnOnce(Box) -> Box -{ - op(x) -} - -#[rustc_regions] -fn no_region<'a, T>(x: Box) -> Box -where - T: Debug, -{ - // Here, the closure winds up being required to prove that `T: - // 'a`. In principle, it could know that, except that it is - // type-checked in a fully generic way, and hence it winds up with - // a propagated requirement that `T: '_#2`, where `'_#2` appears - // in the return type. The caller makes the mapping from `'_#2` to - // `'a` (and subsequently reports an error). - - with_signature(x, |y| y) - //~^ ERROR the parameter type `T` may not live long enough -} - -fn correct_region<'a, T>(x: Box) -> Box -where - T: 'a + Debug, -{ - x -} - -fn wrong_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Debug, -{ - x - //~^ ERROR the parameter type `T` may not live long enough -} - -fn outlives_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Debug, - 'b: 'a, -{ - x -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr deleted file mode 100644 index 35979c8bf..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ /dev/null @@ -1,49 +0,0 @@ -note: external requirements - --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23 - | -LL | with_signature(x, |y| y) - | ^^^ - | - = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::boxed::Box,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, - (), - ] - = note: number of external vids: 3 - = note: where T: '_#2r - -note: no external requirements - --> $DIR/ty-param-closure-outlives-from-return-type.rs:15:1 - | -LL | / fn no_region<'a, T>(x: Box) -> Box -LL | | where -LL | | T: Debug, - | |_____________^ - | - = note: defining type: no_region::<'_#1r, T> - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:27 - | -LL | with_signature(x, |y| y) - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: Debug + 'a, - | ++++ - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-return-type.rs:41:5 - | -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: 'b + Debug + 'a, - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs deleted file mode 100644 index b80287610..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs +++ /dev/null @@ -1,82 +0,0 @@ -// Test that we can propagate `T: 'a` obligations to our caller. See -// `correct_region` for an explanation of how this test is setup; it's -// somewhat intricate. - -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -use std::cell::Cell; - -fn with_signature<'a, T, F>(a: Cell<&'a ()>, b: T, op: F) -where - F: FnOnce(Cell<&'a ()>, T), -{ - op(a, b) -} - -fn require<'a, T>(_a: &Cell<&'a ()>, _b: &T) -where - T: 'a, -{ -} - -#[rustc_regions] -fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { - with_signature(a, b, |x, y| { - // See `correct_region`, which explains the point of this - // test. The only difference is that, in the case of this - // function, there is no where clause *anywhere*, and hence we - // get an error (but reported by the closure creator). - require(&x, &y) - //~^ ERROR the parameter type `T` may not live long enough - }) -} - -#[rustc_regions] -fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) -where - T: 'a, -{ - with_signature(a, b, |x, y| { - // Key point of this test: - // - // The *closure* is being type-checked with all of its free - // regions "universalized". In particular, it does not know - // that `x` has the type `Cell<&'a ()>`, but rather treats it - // as if the type of `x` is `Cell<&'A ()>`, where `'A` is some - // fresh, independent region distinct from the `'a` which - // appears in the environment. The call to `require` here - // forces us then to prove that `T: 'A`, but the closure - // cannot do it on its own. It has to surface this requirement - // to its creator (which knows that `'a == 'A`). - require(&x, &y) - }) -} - -#[rustc_regions] -fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) -where - T: 'b, -{ - with_signature(a, b, |x, y| { - // See `correct_region` - require(&x, &y) - //~^ ERROR the parameter type `T` may not live long enough - }) -} - -#[rustc_regions] -fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) -where - T: 'b, - 'b: 'a, -{ - with_signature(a, b, |x, y| { - // See `correct_region` - require(&x, &y) - }) -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr deleted file mode 100644 index 4c97db58c..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ /dev/null @@ -1,122 +0,0 @@ -note: external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26 - | -LL | with_signature(a, b, |x, y| { - | ^^^^^^ - | - = note: defining type: no_region::::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)), - (), - ] - = note: late-bound region is '_#2r - = note: number of external vids: 3 - = note: where T: '_#1r - -note: no external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 - | -LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: defining type: no_region:: - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:32:9 - | -LL | require(&x, &y) - | ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn no_region<'a, T: 'a>(a: Cell<&'a ()>, b: T) { - | ++++ - -note: external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:42:26 - | -LL | with_signature(a, b, |x, y| { - | ^^^^^^ - | - = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: number of external vids: 3 - = note: where T: '_#2r - -note: no external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:38:1 - | -LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) -LL | | where -LL | | T: 'a, - | |__________^ - | - = note: defining type: correct_region::<'_#1r, T> - -note: external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:63:26 - | -LL | with_signature(a, b, |x, y| { - | ^^^^^^ - | - = note: defining type: wrong_region::<'_#1r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#2r ()>, T)), - (), - ] - = note: late-bound region is '_#3r - = note: number of external vids: 4 - = note: where T: '_#2r - -note: no external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:59:1 - | -LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) -LL | | where -LL | | T: 'b, - | |__________^ - | - = note: defining type: wrong_region::<'_#1r, T> - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:65:9 - | -LL | require(&x, &y) - | ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: 'b + 'a, - | ++++ - -note: external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:76:26 - | -LL | with_signature(a, b, |x, y| { - | ^^^^^^ - | - = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ - i32, - extern "rust-call" fn((std::cell::Cell<&'_#3r ()>, T)), - (), - ] - = note: number of external vids: 4 - = note: where T: '_#3r - -note: no external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:71:1 - | -LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) -LL | | where -LL | | T: 'b, -LL | | 'b: 'a, - | |___________^ - | - = note: defining type: outlives_region::<'_#1r, '_#2r, T> - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs deleted file mode 100644 index 98239f416..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Test that we assume that universal types like `T` outlive the -// function body. - -#![allow(warnings)] - -use std::cell::Cell; - -// No errors here, because `'a` is local to the body. -fn region_within_body(t: T) { - let some_int = 22; - let cell = Cell::new(&some_int); - outlives(cell, t) -} - -// Error here, because T: 'a is not satisfied. -fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) { - outlives(cell, t) - //~^ ERROR the parameter type `T` may not live long enough -} - -fn outlives<'a, T>(x: Cell<&'a usize>, y: T) -where - T: 'a, -{ -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr deleted file mode 100644 index 5fb69255d..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn-body.rs:17:5 - | -LL | outlives(cell, t) - | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | fn region_static<'a, T: 'a>(cell: Cell<&'a usize>, t: T) { - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.rs b/src/test/ui/nll/ty-outlives/ty-param-fn.rs deleted file mode 100644 index 4393a3b41..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-fn.rs +++ /dev/null @@ -1,36 +0,0 @@ -#![allow(warnings)] - -use std::fmt::Debug; - -fn no_region<'a, T>(x: Box) -> Box -where - T: Debug, -{ - x - //~^ ERROR the parameter type `T` may not live long enough -} - -fn correct_region<'a, T>(x: Box) -> Box -where - T: 'a + Debug, -{ - x -} - -fn wrong_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Debug, -{ - x - //~^ ERROR the parameter type `T` may not live long enough -} - -fn outlives_region<'a, 'b, T>(x: Box) -> Box -where - T: 'b + Debug, - 'b: 'a, -{ - x -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr deleted file mode 100644 index 825b26d2f..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn.rs:9:5 - | -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: Debug + 'a, - | ++++ - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn.rs:24:5 - | -LL | x - | ^ ...so that the type `T` will meet its required lifetime bounds - | -help: consider adding an explicit lifetime bound... - | -LL | T: 'b + Debug + 'a, - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs deleted file mode 100644 index 9042844e8..000000000 --- a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs +++ /dev/null @@ -1,28 +0,0 @@ -// compile-flags:-Zverbose -// check-pass - -// Test that we assume that universal types like `T` outlive the -// function body. - -use std::cell::Cell; - -fn twice(value: T, mut f: F) -where - F: FnMut(Cell<&T>), -{ - f(Cell::new(&value)); - f(Cell::new(&value)); -} - -fn generic(value: T) { - // No error here: - twice(value, |r| invoke(r)); -} - -fn invoke<'a, T>(x: Cell<&'a T>) -where - T: 'a, -{ -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.rs b/src/test/ui/nll/ty-outlives/wf-unreachable.rs deleted file mode 100644 index c6f4c4afa..000000000 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Test that we check that user type annotations are well-formed, even in dead -// code. - -fn uninit<'a>() { - return; - let x: &'static &'a (); //~ ERROR lifetime may not live long enough -} - -fn var_type<'a>() { - return; - let x: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough -} - -fn uninit_infer<'a>() { - let x: &'static &'a _; //~ ERROR lifetime may not live long enough - x = && (); -} - -fn infer<'a>() { - return; - let x: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough -} - -fn uninit_no_var<'a>() { - return; - let _: &'static &'a (); //~ ERROR lifetime may not live long enough -} - -fn no_var<'a>() { - return; - let _: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough -} - -fn infer_no_var<'a>() { - return; - let _: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough -} - -trait X<'a, 'b> {} - -struct C<'a, 'b, T: X<'a, 'b>>(T, &'a (), &'b ()); - -impl X<'_, '_> for i32 {} -impl<'a> X<'a, 'a> for () {} - -// This type annotation is not well-formed because we substitute `()` for `_`. -fn required_substs<'a>() { - return; - let _: C<'static, 'a, _> = C((), &(), &()); //~ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr deleted file mode 100644 index a62157f44..000000000 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr +++ /dev/null @@ -1,73 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:6:12 - | -LL | fn uninit<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let x: &'static &'a (); - | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:11:12 - | -LL | fn var_type<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let x: &'static &'a () = &&(); - | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:15:12 - | -LL | fn uninit_infer<'a>() { - | -- lifetime `'a` defined here -LL | let x: &'static &'a _; - | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:21:12 - | -LL | fn infer<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let x: &'static &'a _ = &&(); - | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:26:12 - | -LL | fn uninit_no_var<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let _: &'static &'a (); - | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:31:12 - | -LL | fn no_var<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let _: &'static &'a () = &&(); - | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:36:12 - | -LL | fn infer_no_var<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let _: &'static &'a _ = &&(); - | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/wf-unreachable.rs:49:12 - | -LL | fn required_substs<'a>() { - | -- lifetime `'a` defined here -LL | return; -LL | let _: C<'static, 'a, _> = C((), &(), &()); - | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: aborting due to 8 previous errors - -- cgit v1.2.3