From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/nll/user-annotations/adt-brace-enums.rs | 50 ------ .../ui/nll/user-annotations/adt-brace-enums.stderr | 42 ----- .../ui/nll/user-annotations/adt-brace-structs.rs | 48 ------ .../nll/user-annotations/adt-brace-structs.stderr | 42 ----- .../ui/nll/user-annotations/adt-nullary-enums.rs | 69 -------- .../nll/user-annotations/adt-nullary-enums.stderr | 45 ----- .../ui/nll/user-annotations/adt-tuple-enums.rs | 53 ------ .../ui/nll/user-annotations/adt-tuple-enums.stderr | 42 ----- .../nll/user-annotations/adt-tuple-struct-calls.rs | 71 -------- .../user-annotations/adt-tuple-struct-calls.stderr | 56 ------ .../ui/nll/user-annotations/adt-tuple-struct.rs | 48 ------ .../nll/user-annotations/adt-tuple-struct.stderr | 42 ----- .../ui/nll/user-annotations/ascribed-type-wf.rs | 16 -- .../nll/user-annotations/cast_static_lifetime.rs | 6 - .../user-annotations/cast_static_lifetime.stderr | 14 -- .../closure-substs.polonius.stderr | 61 ------- src/test/ui/nll/user-annotations/closure-substs.rs | 31 ---- .../ui/nll/user-annotations/closure-substs.stderr | 42 ----- .../constant-in-expr-inherent-1.rs | 12 -- .../constant-in-expr-inherent-1.stderr | 10 -- .../constant-in-expr-inherent-2.rs | 27 --- .../constant-in-expr-inherent-2.stderr | 50 ------ .../user-annotations/constant-in-expr-normalize.rs | 22 --- .../constant-in-expr-normalize.stderr | 10 -- .../constant-in-expr-trait-item-1.rs | 14 -- .../constant-in-expr-trait-item-1.stderr | 10 -- .../constant-in-expr-trait-item-2.rs | 14 -- .../constant-in-expr-trait-item-2.stderr | 10 -- .../constant-in-expr-trait-item-3.rs | 14 -- .../constant-in-expr-trait-item-3.stderr | 10 -- src/test/ui/nll/user-annotations/downcast-infer.rs | 11 -- .../nll/user-annotations/dump-adt-brace-struct.rs | 20 --- .../user-annotations/dump-adt-brace-struct.stderr | 8 - src/test/ui/nll/user-annotations/dump-fn-method.rs | 57 ------- .../ui/nll/user-annotations/dump-fn-method.stderr | 26 --- src/test/ui/nll/user-annotations/fns.rs | 48 ------ src/test/ui/nll/user-annotations/fns.stderr | 42 ----- .../inherent-associated-constants.rs | 15 -- .../inherent-associated-constants.stderr | 10 -- src/test/ui/nll/user-annotations/issue-54124.rs | 8 - .../ui/nll/user-annotations/issue-54124.stderr | 20 --- .../user-annotations/issue-54570-bootstrapping.rs | 30 ---- src/test/ui/nll/user-annotations/issue-55219.rs | 18 -- src/test/ui/nll/user-annotations/issue-55241.rs | 26 --- .../issue-55748-pat-types-constrain-bindings.rs | 68 -------- ...issue-55748-pat-types-constrain-bindings.stderr | 29 ---- .../issue-57731-ascibed-coupled-types.rs | 40 ----- .../issue-57731-ascibed-coupled-types.stderr | 38 ----- src/test/ui/nll/user-annotations/method-call.rs | 69 -------- .../ui/nll/user-annotations/method-call.stderr | 42 ----- src/test/ui/nll/user-annotations/method-ufcs-1.rs | 63 ------- .../ui/nll/user-annotations/method-ufcs-1.stderr | 46 ----- src/test/ui/nll/user-annotations/method-ufcs-2.rs | 63 ------- .../ui/nll/user-annotations/method-ufcs-2.stderr | 46 ----- src/test/ui/nll/user-annotations/method-ufcs-3.rs | 69 -------- .../ui/nll/user-annotations/method-ufcs-3.stderr | 42 ----- .../nll/user-annotations/method-ufcs-inherent-1.rs | 18 -- .../user-annotations/method-ufcs-inherent-1.stderr | 18 -- .../nll/user-annotations/method-ufcs-inherent-2.rs | 19 --- .../user-annotations/method-ufcs-inherent-2.stderr | 33 ---- .../nll/user-annotations/method-ufcs-inherent-3.rs | 18 -- .../user-annotations/method-ufcs-inherent-3.stderr | 18 -- .../nll/user-annotations/method-ufcs-inherent-4.rs | 20 --- .../user-annotations/method-ufcs-inherent-4.stderr | 33 ---- src/test/ui/nll/user-annotations/normalization.rs | 10 -- .../ui/nll/user-annotations/normalization.stderr | 13 -- .../ui/nll/user-annotations/normalize-self-ty.rs | 23 --- .../pattern_substs_on_brace_enum_variant.rs | 22 --- .../pattern_substs_on_brace_enum_variant.stderr | 26 --- .../pattern_substs_on_brace_struct.rs | 20 --- .../pattern_substs_on_brace_struct.stderr | 26 --- .../pattern_substs_on_tuple_enum_variant.rs | 22 --- .../pattern_substs_on_tuple_enum_variant.stderr | 26 --- .../pattern_substs_on_tuple_struct.rs | 20 --- .../pattern_substs_on_tuple_struct.stderr | 26 --- src/test/ui/nll/user-annotations/patterns.rs | 136 --------------- src/test/ui/nll/user-annotations/patterns.stderr | 189 --------------------- .../ui/nll/user-annotations/promoted-annotation.rs | 10 -- .../user-annotations/promoted-annotation.stderr | 17 -- .../user-annotations/type-annotation-with-hrtb.rs | 33 ---- .../type_ascription_static_lifetime.rs | 7 - .../type_ascription_static_lifetime.stderr | 14 -- src/test/ui/nll/user-annotations/wf-self-type.rs | 13 -- .../ui/nll/user-annotations/wf-self-type.stderr | 14 -- 84 files changed, 2779 deletions(-) delete mode 100644 src/test/ui/nll/user-annotations/adt-brace-enums.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-brace-enums.stderr delete mode 100644 src/test/ui/nll/user-annotations/adt-brace-structs.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-brace-structs.stderr delete mode 100644 src/test/ui/nll/user-annotations/adt-nullary-enums.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-nullary-enums.stderr delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-enums.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-enums.stderr delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-struct-calls.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-struct.rs delete mode 100644 src/test/ui/nll/user-annotations/adt-tuple-struct.stderr delete mode 100644 src/test/ui/nll/user-annotations/ascribed-type-wf.rs delete mode 100644 src/test/ui/nll/user-annotations/cast_static_lifetime.rs delete mode 100644 src/test/ui/nll/user-annotations/cast_static_lifetime.stderr delete mode 100644 src/test/ui/nll/user-annotations/closure-substs.polonius.stderr delete mode 100644 src/test/ui/nll/user-annotations/closure-substs.rs delete mode 100644 src/test/ui/nll/user-annotations/closure-substs.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs delete mode 100644 src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr delete mode 100644 src/test/ui/nll/user-annotations/downcast-infer.rs delete mode 100644 src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs delete mode 100644 src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr delete mode 100644 src/test/ui/nll/user-annotations/dump-fn-method.rs delete mode 100644 src/test/ui/nll/user-annotations/dump-fn-method.stderr delete mode 100644 src/test/ui/nll/user-annotations/fns.rs delete mode 100644 src/test/ui/nll/user-annotations/fns.stderr delete mode 100644 src/test/ui/nll/user-annotations/inherent-associated-constants.rs delete mode 100644 src/test/ui/nll/user-annotations/inherent-associated-constants.stderr delete mode 100644 src/test/ui/nll/user-annotations/issue-54124.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-54124.stderr delete mode 100644 src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-55219.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-55241.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr delete mode 100644 src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs delete mode 100644 src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-call.rs delete mode 100644 src/test/ui/nll/user-annotations/method-call.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-1.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-1.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-2.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-2.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-3.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-3.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs delete mode 100644 src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr delete mode 100644 src/test/ui/nll/user-annotations/normalization.rs delete mode 100644 src/test/ui/nll/user-annotations/normalization.stderr delete mode 100644 src/test/ui/nll/user-annotations/normalize-self-ty.rs delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs delete mode 100644 src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr delete mode 100644 src/test/ui/nll/user-annotations/patterns.rs delete mode 100644 src/test/ui/nll/user-annotations/patterns.stderr delete mode 100644 src/test/ui/nll/user-annotations/promoted-annotation.rs delete mode 100644 src/test/ui/nll/user-annotations/promoted-annotation.stderr delete mode 100644 src/test/ui/nll/user-annotations/type-annotation-with-hrtb.rs delete mode 100644 src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs delete mode 100644 src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr delete mode 100644 src/test/ui/nll/user-annotations/wf-self-type.rs delete mode 100644 src/test/ui/nll/user-annotations/wf-self-type.stderr (limited to 'src/test/ui/nll/user-annotations') diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.rs b/src/test/ui/nll/user-annotations/adt-brace-enums.rs deleted file mode 100644 index 0d9828342..000000000 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -enum SomeEnum { - SomeVariant { t: T } -} - -fn no_annot() { - let c = 66; - SomeEnum::SomeVariant { t: &c }; -} - -fn annot_underscore() { - let c = 66; - SomeEnum::SomeVariant::<_> { t: &c }; -} - -fn annot_reference_any_lifetime() { - let c = 66; - SomeEnum::SomeVariant::<&u32> { t: &c }; -} - -fn annot_reference_static_lifetime() { - let c = 66; - SomeEnum::SomeVariant::<&'static u32> { t: &c }; //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - SomeEnum::SomeVariant::<&'a u32> { t: c }; -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - SomeEnum::SomeVariant::<&'a u32> { t: c }; - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr deleted file mode 100644 index 253e38251..000000000 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:25:48 - | -LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:30:43 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:40:47 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.rs b/src/test/ui/nll/user-annotations/adt-brace-structs.rs deleted file mode 100644 index bdbfd87d5..000000000 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -struct SomeStruct { t: T } - -fn no_annot() { - let c = 66; - SomeStruct { t: &c }; -} - -fn annot_underscore() { - let c = 66; - SomeStruct::<_> { t: &c }; -} - -fn annot_reference_any_lifetime() { - let c = 66; - SomeStruct::<&u32> { t: &c }; -} - -fn annot_reference_static_lifetime() { - let c = 66; - SomeStruct::<&'static u32> { t: &c }; //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - SomeStruct::<&'a u32> { t: &c }; //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - SomeStruct::<&'a u32> { t: c }; -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - SomeStruct::<&'a u32> { t: &c }; //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - SomeStruct::<&'a u32> { t: c }; - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr deleted file mode 100644 index 8b9d1705d..000000000 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:23:37 - | -LL | SomeStruct::<&'static u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:28:32 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -LL | let c = 66; -LL | SomeStruct::<&'a u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:38:36 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeStruct::<&'a u32> { t: &c }; - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs b/src/test/ui/nll/user-annotations/adt-nullary-enums.rs deleted file mode 100644 index 53853668d..000000000 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -#![allow(warnings)] - -use std::cell::Cell; - -enum SomeEnum { - SomeVariant(T), - SomeOtherVariant, -} - -fn combine(_: T, _: T) { } - -fn no_annot() { - let c = 66; - combine(SomeEnum::SomeVariant(Cell::new(&c)), SomeEnum::SomeOtherVariant); -} - -fn annot_underscore() { - let c = 66; - combine(SomeEnum::SomeVariant(Cell::new(&c)), SomeEnum::SomeOtherVariant::>); -} - -fn annot_reference_any_lifetime() { - let c = 66; - combine(SomeEnum::SomeVariant(Cell::new(&c)), SomeEnum::SomeOtherVariant::>); -} - -fn annot_reference_static_lifetime() { - let c = 66; - combine( - SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR - SomeEnum::SomeOtherVariant::>, - ); -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - combine( - SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR - SomeEnum::SomeOtherVariant::>, - ); -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - combine(SomeEnum::SomeVariant(Cell::new(c)), SomeEnum::SomeOtherVariant::>); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - combine( - SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR - SomeEnum::SomeOtherVariant::>, - ); - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - combine( - SomeEnum::SomeVariant(Cell::new(c)), - SomeEnum::SomeOtherVariant::>, - ); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr deleted file mode 100644 index 3326fa521..000000000 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:33:41 - | -LL | / combine( -LL | | SomeEnum::SomeVariant(Cell::new(&c)), - | | ^^ borrowed value does not live long enough -LL | | SomeEnum::SomeOtherVariant::>, -LL | | ); - | |_____- argument requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:41:41 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeEnum::SomeVariant(Cell::new(&c)), - | ----------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -... -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:54:45 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeEnum::SomeVariant(Cell::new(&c)), - | ----------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -... -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs b/src/test/ui/nll/user-annotations/adt-tuple-enums.rs deleted file mode 100644 index efe8dfda1..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -#![allow(warnings)] - -enum SomeEnum { - SomeVariant(T), - SomeOtherVariant, -} - -fn no_annot() { - let c = 66; - SomeEnum::SomeVariant(&c); -} - -fn annot_underscore() { - let c = 66; - SomeEnum::SomeVariant::<_>(&c); -} - -fn annot_reference_any_lifetime() { - let c = 66; - SomeEnum::SomeVariant::<&u32>(&c); -} - -fn annot_reference_static_lifetime() { - let c = 66; - SomeEnum::SomeVariant::<&'static u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - SomeEnum::SomeVariant::<&'a u32>(c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - SomeEnum::SomeVariant::<&'a u32>(c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr deleted file mode 100644 index 2fa704263..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:28:43 - | -LL | SomeEnum::SomeVariant::<&'static u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:33:38 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:43:42 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeEnum::SomeVariant::<&'a u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.rs b/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.rs deleted file mode 100644 index 116583223..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -struct SomeStruct(T); - -fn no_annot() { - let c = 66; - let f = SomeStruct; - f(&c); -} - -fn annot_underscore() { - let c = 66; - let f = SomeStruct::<_>; - f(&c); -} - -fn annot_reference_any_lifetime() { - let c = 66; - let f = SomeStruct::<&u32>; - f(&c); -} - -fn annot_reference_static_lifetime() { - let c = 66; - let f = SomeStruct::<&'static u32>; - f(&c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - let f = SomeStruct::<&'a u32>; - f(&c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - let f = SomeStruct::<&'a u32>; - f(c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - let f = SomeStruct::<&'a u32>; - f(&c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_across_closure<'a>(_: &'a u32) { - let f = SomeStruct::<&'a u32>; - let _closure = || { - let c = 66; - f(&c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - let f = SomeStruct::<&'a u32>; - f(c); - }; -} - -fn annot_reference_named_lifetime_across_closure_ok<'a>(c: &'a u32) { - let f = SomeStruct::<&'a u32>; - let _closure = || { - f(c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr deleted file mode 100644 index 9664fb9f5..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct-calls.stderr +++ /dev/null @@ -1,56 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct-calls.rs:27:7 - | -LL | f(&c); - | --^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct-calls.rs:33:7 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | f(&c); - | --^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct-calls.rs:45:11 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | f(&c); - | --^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct-calls.rs:53:11 - | -LL | let f = SomeStruct::<&'a u32>; - | - lifetime `'1` appears in the type of `f` -... -LL | f(&c); - | --^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'1` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs b/src/test/ui/nll/user-annotations/adt-tuple-struct.rs deleted file mode 100644 index 37284e1fd..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -struct SomeStruct(T); - -fn no_annot() { - let c = 66; - SomeStruct(&c); -} - -fn annot_underscore() { - let c = 66; - SomeStruct::<_>(&c); -} - -fn annot_reference_any_lifetime() { - let c = 66; - SomeStruct::<&u32>(&c); -} - -fn annot_reference_static_lifetime() { - let c = 66; - SomeStruct::<&'static u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - SomeStruct::<&'a u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - SomeStruct::<&'a u32>(c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - SomeStruct::<&'a u32>(&c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - SomeStruct::<&'a u32>(c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr deleted file mode 100644 index 76b525225..000000000 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:23:32 - | -LL | SomeStruct::<&'static u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:28:27 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -LL | let c = 66; -LL | SomeStruct::<&'a u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:38:31 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | SomeStruct::<&'a u32>(&c); - | ^^ - | | - | borrowed value does not live long enough - | this usage requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/ascribed-type-wf.rs b/src/test/ui/nll/user-annotations/ascribed-type-wf.rs deleted file mode 100644 index 14460dea5..000000000 --- a/src/test/ui/nll/user-annotations/ascribed-type-wf.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// known-bug: #101350 - -trait Trait { - type Ty; -} - -impl Trait for &'static () { - type Ty = (); -} - -fn extend<'a>() { - None::<<&'a () as Trait>::Ty>; -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs deleted file mode 100644 index bb6129dac..000000000 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![allow(warnings)] - -fn main() { - let x = 22_u32; - let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough -} diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr deleted file mode 100644 index 4599d04e7..000000000 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/cast_static_lifetime.rs:5:19 - | -LL | let y: &u32 = (&x) as &'static u32; - | ^^^^---------------- - | | - | borrowed value does not live long enough - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr b/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr deleted file mode 100644 index af159a6cd..000000000 --- a/src/test/ui/nll/user-annotations/closure-substs.polonius.stderr +++ /dev/null @@ -1,61 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:8:16 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -... -LL | return x; - | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` - -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:15:16 - | -LL | |x: &i32| -> &'static i32 { - | - let's call the lifetime of this reference `'1` -LL | return x; - | ^ returning this value requires that `'1` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:15:16 - | -LL | |x: &i32| -> &'static i32 { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` -LL | return x; - | ^ returning this value requires that `'1` must outlive `'2` - -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:22:9 - | -LL | fn bar<'a>() { - | -- lifetime `'a` defined here -... -LL | b(x); - | ^^^^ argument requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` - -error[E0521]: borrowed data escapes outside of closure - --> $DIR/closure-substs.rs:29:9 - | -LL | |x: &i32, b: fn(&'static i32)| { - | - `x` is a reference that is only valid in the closure body -LL | b(x); - | ^^^^ `x` escapes the closure body here - -error[E0521]: borrowed data escapes outside of closure - --> $DIR/closure-substs.rs:29:9 - | -LL | |x: &i32, b: fn(&'static i32)| { - | - - `b` declared here, outside of the closure body - | | - | `x` is a reference that is only valid in the closure body -LL | b(x); - | ^^^^ `x` escapes the closure body here - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/nll/user-annotations/closure-substs.rs b/src/test/ui/nll/user-annotations/closure-substs.rs deleted file mode 100644 index f7af54e8d..000000000 --- a/src/test/ui/nll/user-annotations/closure-substs.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Test that we enforce user-provided type annotations on closures. - -fn foo<'a>() { - // Here `x` is free in the closure sig: - |x: &'a i32| -> &'static i32 { - return x; //~ ERROR lifetime may not live long enough - }; -} - -fn foo1() { - // Here `x` is bound in the closure sig: - |x: &i32| -> &'static i32 { - return x; //~ ERROR lifetime may not live long enough - }; -} - -fn bar<'a>() { - // Here `x` is free in the closure sig: - |x: &'a i32, b: fn(&'static i32)| { - b(x); //~ ERROR lifetime may not live long enough - }; -} - -fn bar1() { - // Here `x` is bound in the closure sig: - |x: &i32, b: fn(&'static i32)| { - b(x); //~ ERROR borrowed data escapes outside of closure - }; -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr deleted file mode 100644 index 1e8de4ba9..000000000 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:6:16 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -... -LL | return x; - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:13:16 - | -LL | |x: &i32| -> &'static i32 { - | - let's call the lifetime of this reference `'1` -LL | return x; - | ^ returning this value requires that `'1` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/closure-substs.rs:20:9 - | -LL | fn bar<'a>() { - | -- lifetime `'a` defined here -... -LL | b(x); - | ^^^^ argument requires that `'a` must outlive `'static` - -error[E0521]: borrowed data escapes outside of closure - --> $DIR/closure-substs.rs:27:9 - | -LL | |x: &i32, b: fn(&'static i32)| { - | - - let's call the lifetime of this reference `'1` - | | - | `x` is a reference that is only valid in the closure body -LL | b(x); - | ^^^^ - | | - | `x` escapes the closure body here - | argument requires that `'1` must outlive `'static` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs deleted file mode 100644 index e3a8a5f58..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -struct Foo<'a> { x: &'a u32 } - -impl<'a> Foo<'a> { - const C: &'a u32 = &22; -} - -fn foo<'a>(_: &'a u32) -> &'static u32 { - >::C //~ ERROR -} - -fn main() { -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr deleted file mode 100644 index c39301588..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-inherent-1.rs:8:5 - | -LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | >::C - | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs deleted file mode 100644 index 90696d4b1..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Test that we still check constants are well-formed, even when we there's no -// type annotation to check. - -const FUN: fn(&'static ()) = |_| {}; -struct A; -impl A { - const ASSOCIATED_FUN: fn(&'static ()) = |_| {}; -} - -struct B<'a>(&'a ()); -impl B<'static> { - const ALSO_ASSOCIATED_FUN: fn(&'static ()) = |_| {}; -} - -trait Z: 'static { - const TRAIT_ASSOCIATED_FUN: fn(&'static Self) = |_| (); -} - -impl Z for () {} - -fn main() { - let x = (); - FUN(&x); //~ ERROR `x` does not live long enough - A::ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough - B::ALSO_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough - <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr deleted file mode 100644 index 12065a85a..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:23:9 - | -LL | FUN(&x); - | ----^^- - | | | - | | borrowed value does not live long enough - | argument requires that `x` is borrowed for `'static` -... -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:24:23 - | -LL | A::ASSOCIATED_FUN(&x); - | ------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `x` is borrowed for `'static` -... -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:25:28 - | -LL | B::ALSO_ASSOCIATED_FUN(&x); - | -----------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `x` is borrowed for `'static` -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/constant-in-expr-inherent-2.rs:26:31 - | -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); - | --------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs deleted file mode 100644 index b7095430d..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.rs +++ /dev/null @@ -1,22 +0,0 @@ -trait Mirror { - type Me; -} - -impl Mirror for T { - type Me = T; -} - -trait Foo<'a> { - const C: <&'a u32 as Mirror>::Me; -} - -impl<'a, T> Foo<'a> for T { - const C: &'a u32 = &22; -} - -fn foo<'a>(_: &'a u32) -> &'static u32 { - <() as Foo<'a>>::C //~ ERROR -} - -fn main() { -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr deleted file mode 100644 index 541a2cfaf..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-normalize.rs:18:5 - | -LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C - | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs deleted file mode 100644 index e0400b2cc..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.rs +++ /dev/null @@ -1,14 +0,0 @@ -trait Foo<'a> { - const C: &'a u32; -} - -impl<'a, T> Foo<'a> for T { - const C: &'a u32 = &22; -} - -fn foo<'a>(_: &'a u32) -> &'static u32 { - <() as Foo<'a>>::C //~ ERROR -} - -fn main() { -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr deleted file mode 100644 index ea0fcb6d6..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-1.rs:10:5 - | -LL | fn foo<'a>(_: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C - | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs deleted file mode 100644 index 73c4e577b..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.rs +++ /dev/null @@ -1,14 +0,0 @@ -trait Foo<'a> { - const C: &'a u32; -} - -impl<'a, T> Foo<'a> for T { - const C: &'a u32 = &22; -} - -fn foo<'a, T: Foo<'a>>() -> &'static u32 { - >::C //~ ERROR -} - -fn main() { -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr deleted file mode 100644 index ff549f1d8..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-2.rs:10:5 - | -LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { - | -- lifetime `'a` defined here -LL | >::C - | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs deleted file mode 100644 index 567e31ef9..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.rs +++ /dev/null @@ -1,14 +0,0 @@ -trait Foo<'a> { - const C: &'a u32; -} - -impl<'a, T> Foo<'a> for T { - const C: &'a u32 = &22; -} - -fn foo<'a, T: Foo<'a>>() -> &'static u32 { - T::C //~ ERROR -} - -fn main() { -} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr deleted file mode 100644 index 7f160d8e3..000000000 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/constant-in-expr-trait-item-3.rs:10:5 - | -LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { - | -- lifetime `'a` defined here -LL | T::C - | ^^^^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/downcast-infer.rs b/src/test/ui/nll/user-annotations/downcast-infer.rs deleted file mode 100644 index b27429f4d..000000000 --- a/src/test/ui/nll/user-annotations/downcast-infer.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass - -// Check that we don't try to downcast `_` when type-checking the annotation. -fn main() { - let x = Some(Some(Some(1))); - - match x { - Some::>(Some(Some(v))) => (), - _ => (), - } -} diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs deleted file mode 100644 index ccda9129d..000000000 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -// compile-flags:-Zverbose - -#![allow(warnings)] -#![feature(rustc_attrs)] - -struct SomeStruct { t: T } - -#[rustc_dump_user_substs] -fn main() { - SomeStruct { t: 22 }; // Nothing given, no annotation. - - SomeStruct::<_> { t: 22 }; // Nothing interesting given, no annotation. - - SomeStruct:: { t: 22 }; // No lifetime bounds given. - - SomeStruct::<&'static u32> { t: &22 }; //~ ERROR [&ReStatic u32] -} diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr deleted file mode 100644 index 586062190..000000000 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } - --> $DIR/dump-adt-brace-struct.rs:19:5 - | -LL | SomeStruct::<&'static u32> { t: &22 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.rs b/src/test/ui/nll/user-annotations/dump-fn-method.rs deleted file mode 100644 index 148d63d84..000000000 --- a/src/test/ui/nll/user-annotations/dump-fn-method.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -// compile-flags:-Zverbose - -#![feature(rustc_attrs)] - -// Note: we reference the names T and U in the comments below. -trait Bazoom { - fn method(&self, arg: T, arg2: U) { } -} - -impl Bazoom for S { -} - -fn foo<'a, T>(_: T) { } - -#[rustc_dump_user_substs] -fn main() { - // Here: nothing is given, so we don't have any annotation. - let x = foo; - x(22); - - // Here: `u32` is given, which doesn't contain any lifetimes, so we don't - // have any annotation. - let x = foo::; - x(22); - - let x = foo::<&'static u32>; //~ ERROR [&ReStatic u32] - x(&22); - - // Here: we only want the `T` to be given, the rest should be variables. - // - // (`T` refers to the declaration of `Bazoom`) - let x = <_ as Bazoom>::method::<_>; //~ ERROR [^0, u32, ^1] - x(&22, 44, 66); - - // Here: all are given and definitely contain no lifetimes, so we - // don't have any annotation. - let x = >::method::; - x(&22, 44, 66); - - // Here: all are given and we have a lifetime. - let x = >::method::; //~ ERROR [u8, &ReStatic u16, u32] - x(&22, &44, 66); - - // Here: we want in particular that *only* the method `U` - // annotation is given, the rest are variables. - // - // (`U` refers to the declaration of `Bazoom`) - let y = 22_u32; - y.method::(44, 66); //~ ERROR [^0, ^1, u32] - - // Here: nothing is given, so we don't have any annotation. - let y = 22_u32; - y.method(44, 66); -} diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr deleted file mode 100644 index d139efa88..000000000 --- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:29:13 - | -LL | let x = foo::<&'static u32>; - | ^^^^^^^^^^^^^^^^^^^ - -error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } - --> $DIR/dump-fn-method.rs:35:13 - | -LL | let x = <_ as Bazoom>::method::<_>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:44:13 - | -LL | let x = >::method::; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } - --> $DIR/dump-fn-method.rs:52:5 - | -LL | y.method::(44, 66); - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/nll/user-annotations/fns.rs b/src/test/ui/nll/user-annotations/fns.rs deleted file mode 100644 index 38db6d1c4..000000000 --- a/src/test/ui/nll/user-annotations/fns.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -fn some_fn(arg: T) { } - -fn no_annot() { - let c = 66; - some_fn(&c); // OK -} - -fn annot_underscore() { - let c = 66; - some_fn::<_>(&c); // OK -} - -fn annot_reference_any_lifetime() { - let c = 66; - some_fn::<&u32>(&c); // OK -} - -fn annot_reference_static_lifetime() { - let c = 66; - some_fn::<&'static u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let c = 66; - some_fn::<&'a u32>(&c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - some_fn::<&'a u32>(c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let _closure = || { - let c = 66; - some_fn::<&'a u32>(&c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let _closure = || { - some_fn::<&'a u32>(c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr deleted file mode 100644 index e0640da39..000000000 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:23:29 - | -LL | some_fn::<&'static u32>(&c); - | ------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:28:24 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -LL | let c = 66; -LL | some_fn::<&'a u32>(&c); - | -------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:38:28 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | some_fn::<&'a u32>(&c); - | -------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.rs b/src/test/ui/nll/user-annotations/inherent-associated-constants.rs deleted file mode 100644 index fe2641fd6..000000000 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.rs +++ /dev/null @@ -1,15 +0,0 @@ -struct A<'a>(&'a ()); - -impl A<'static> { - const IC: i32 = 10; -} - -fn non_wf_associated_const<'a>(x: i32) { - A::<'a>::IC; //~ ERROR lifetime may not live long enough -} - -fn wf_associated_const<'a>(x: i32) { - A::<'static>::IC; -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr deleted file mode 100644 index ffbfc40f5..000000000 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/inherent-associated-constants.rs:8:5 - | -LL | fn non_wf_associated_const<'a>(x: i32) { - | -- lifetime `'a` defined here -LL | A::<'a>::IC; - | ^^^^^^^^^^^ requires that `'a` must outlive `'static` - -error: aborting due to previous error - diff --git a/src/test/ui/nll/user-annotations/issue-54124.rs b/src/test/ui/nll/user-annotations/issue-54124.rs deleted file mode 100644 index 5ae03c894..000000000 --- a/src/test/ui/nll/user-annotations/issue-54124.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn test<'a>() { - let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough - //~^ ERROR lifetime may not live long enough -} - -fn main() { - test(); -} diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr deleted file mode 100644 index 2556af2dd..000000000 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-54124.rs:2:22 - | -LL | fn test<'a>() { - | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; - | ^ - let's call the lifetime of this reference `'1` - | | - | requires that `'1` must outlive `'a` - -error: lifetime may not live long enough - --> $DIR/issue-54124.rs:2:22 - | -LL | fn test<'a>() { - | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; - | ^ requires that `'a` must outlive `'static` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs b/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs deleted file mode 100644 index ff5b2244e..000000000 --- a/src/test/ui/nll/user-annotations/issue-54570-bootstrapping.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass - -// This test is reduced from a scenario pnkfelix encountered while -// bootstrapping the compiler. - -#[derive(Copy, Clone)] -pub struct Spanned { - pub node: T, - pub span: Span, -} - -pub type Variant = Spanned; -// #[derive(Clone)] pub struct Variant { pub node: VariantKind, pub span: Span, } - -#[derive(Clone)] -pub struct VariantKind { } - -#[derive(Copy, Clone)] -pub struct Span; - -pub fn variant_to_span(variant: Variant) { - match variant { - Variant { - span: _span, - .. - } => { } - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/issue-55219.rs b/src/test/ui/nll/user-annotations/issue-55219.rs deleted file mode 100644 index 147413663..000000000 --- a/src/test/ui/nll/user-annotations/issue-55219.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Regression test for #55219: -// -// The `Self::HASH_LEN` here expands to a "self-type" where `T` is not -// known. This unbound inference variable was causing an ICE. -// -// check-pass - -pub struct Foo(T); - -impl Foo { - const HASH_LEN: usize = 20; - - fn stuff() { - let _ = Self::HASH_LEN; - } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/issue-55241.rs b/src/test/ui/nll/user-annotations/issue-55241.rs deleted file mode 100644 index 29969c7b4..000000000 --- a/src/test/ui/nll/user-annotations/issue-55241.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Regression test for #55241: -// -// The reference to `C::HASHED_NULL_NODE` resulted in a type like `>::Out`; normalizing this type requires knowing the -// value of `_`; solving that requires having normalized, so we can -// test against `C: NodeCodec` in the environment. -// -// run-pass - -pub trait Hasher { - type Out: Eq; -} - -pub trait NodeCodec { - const HASHED_NULL_NODE: H::Out; -} - -pub trait Trie> { - /// Returns the root of the trie. - fn root(&self) -> &H::Out; - - /// Is the trie empty? - fn is_empty(&self) -> bool { *self.root() == C::HASHED_NULL_NODE } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs deleted file mode 100644 index c71937a50..000000000 --- a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs +++ /dev/null @@ -1,68 +0,0 @@ -// This test is ensuring that type ascriptions on let bindings -// constrain both: -// -// 1. the input expression on the right-hand side (after any potential -// coercion, and allowing for covariance), *and* -// -// 2. the bindings (if any) nested within the pattern on the left-hand -// side (and here, the type-constraint is *invariant*). - -#![allow(dead_code, unused_mut)] -type PairUncoupled<'a, 'b, T> = (&'a T, &'b T); -type PairCoupledRegions<'a, T> = (&'a T, &'a T); -type PairCoupledTypes = (T, T); - -fn uncoupled_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((mut y, mut _z),): (PairUncoupled,) = ((s, &_x),); // ok - // Above compiling does *not* imply below would compile. - // ::std::mem::swap(&mut y, &mut _z); - y -} - -fn swap_regions((mut y, mut _z): PairCoupledRegions) { - ::std::mem::swap(&mut y, &mut _z); -} - -fn coupled_regions_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),): (PairCoupledRegions,) = ((s, &_x),); - // If above line compiled, so should line below ... - - // swap_regions((y, _z)); - - // ... but the ascribed type also invalidates this use of `y` - y //~ ERROR lifetime may not live long enough -} - -fn swap_types((mut y, mut _z): PairCoupledTypes<&u32>) { - ::std::mem::swap(&mut y, &mut _z); -} - -fn coupled_types_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),): (PairCoupledTypes<&u32>,) = ((s, &_x),); - // If above line compiled, so should line below ... - - // swap_types((y, _z)); - - // ... but the ascribed type also invalidates this use of `y` - y //~ ERROR lifetime may not live long enough -} - -fn swap_wilds((mut y, mut _z): PairCoupledTypes<&u32>) { - ::std::mem::swap(&mut y, &mut _z); -} - -fn coupled_wilds_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),): (PairCoupledTypes<_>,) = ((s, &_x),); - // If above line compiled, so should line below - // swap_wilds((y, _z)); - - // ... but the ascribed type also invalidates this use of `y` - y //~ ERROR lifetime may not live long enough -} - -fn main() { - uncoupled_lhs(&3, &4); - coupled_regions_lhs(&3, &4); - coupled_types_lhs(&3, &4); - coupled_wilds_lhs(&3, &4); -} diff --git a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr deleted file mode 100644 index 8399ef04e..000000000 --- a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-55748-pat-types-constrain-bindings.rs:33:5 - | -LL | fn coupled_regions_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -... -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/issue-55748-pat-types-constrain-bindings.rs:47:5 - | -LL | fn coupled_types_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -... -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/issue-55748-pat-types-constrain-bindings.rs:60:5 - | -LL | fn coupled_wilds_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -... -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs deleted file mode 100644 index 95c655654..000000000 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Check that repeated type variables are correctly handled - -#![allow(unused)] -#![feature(type_ascription)] - -type PairUncoupled<'a, 'b, T> = (&'a T, &'b T); -type PairCoupledTypes = (T, T); -type PairCoupledRegions<'a, T> = (&'a T, &'a T); - -fn uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = type_ascribe!(((s, _x),), (PairUncoupled<_>,)); - y // OK -} - -fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledTypes<_>,)); - y //~ ERROR lifetime may not live long enough -} - -fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledRegions<_>,)); - y //~ ERROR lifetime may not live long enough -} - -fn cast_uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),) as (PairUncoupled<_>,); - y // OK -} - -fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); - y //~ ERROR lifetime may not live long enough -} - -fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); - y //~ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr deleted file mode 100644 index 8601691e8..000000000 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/issue-57731-ascibed-coupled-types.rs:17:5 - | -LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledTypes<_>,)); -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/issue-57731-ascibed-coupled-types.rs:22:5 - | -LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledRegions<_>,)); -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/issue-57731-ascibed-coupled-types.rs:32:5 - | -LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/issue-57731-ascibed-coupled-types.rs:37:5 - | -LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/nll/user-annotations/method-call.rs b/src/test/ui/nll/user-annotations/method-call.rs deleted file mode 100644 index beafc597a..000000000 --- a/src/test/ui/nll/user-annotations/method-call.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -trait Bazoom { - fn method(&self, arg: T, arg2: U) { } -} - -impl Bazoom for T { -} - -fn no_annot() { - let a = 22; - let b = 44; - let c = 66; - a.method(b, &c); // OK -} - -fn annot_underscore() { - let a = 22; - let b = 44; - let c = 66; - a.method::<_>(b, &c); // OK -} - -fn annot_reference_any_lifetime() { - let a = 22; - let b = 44; - let c = 66; - a.method::<&u32>(b, &c); // OK -} - -fn annot_reference_static_lifetime() { - let a = 22; - let b = 44; - let c = 66; - a.method::<&'static u32>(b, &c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let a = 22; - let b = 44; - let c = 66; - a.method::<&'a u32>(b, &c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - let a = 22; - let b = 44; - a.method::<&'a u32>(b, c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - let c = 66; - a.method::<&'a u32>(b, &c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - a.method::<&'a u32>(b, c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr deleted file mode 100644 index 10447e45a..000000000 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:36:34 - | -LL | a.method::<&'static u32>(b, &c); - | -----------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:43:29 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | a.method::<&'a u32>(b, &c); - | ------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:57:33 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | a.method::<&'a u32>(b, &c); - | ------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.rs b/src/test/ui/nll/user-annotations/method-ufcs-1.rs deleted file mode 100644 index 950771f35..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -trait Bazoom: Sized { - fn method(self, arg: T, arg2: U) { } -} - -impl Bazoom for T { -} - -fn annot_underscore() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method::<_>(&a, b, c); // OK -} - -fn annot_reference_any_lifetime() { - let a = 22; - let b = 44; - let c = 66; - <&u32 as Bazoom<_>>::method(&a, b, c); // OK -} - -fn annot_reference_static_lifetime() { - let a = 22; - let b = 44; - let c = 66; - let x = <&'static u32 as Bazoom<_>>::method; - x(&a, b, c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let a = 22; - let b = 44; - let c = 66; - <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(a: &'a u32) { - let b = 44; - let c = 66; - <&'a u32 as Bazoom<_>>::method(&a, b, c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - let c = 66; - <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(a: &'a u32) { - let b = 44; - let c = 66; - let _closure = || { - <&'a u32 as Bazoom<_>>::method(&a, b, c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr deleted file mode 100644 index 962ddfd2b..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:30:7 - | -LL | x(&a, b, c); - | --^^------- - | | | - | | borrowed value does not live long enough - | argument requires that `a` is borrowed for `'static` -LL | } - | - `a` dropped here while still borrowed - -error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:37:36 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); - | -------------------------------^^------- - | | | - | | borrowed value does not live long enough - | argument requires that `a` is borrowed for `'a` -LL | } - | - `a` dropped here while still borrowed - -error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:51:41 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | let _closure = || { - | -- value captured here -LL | let c = 66; -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); - | --------------------------------^------- - | | | - | | borrowed value does not live long enough - | argument requires that `a` is borrowed for `'a` -LL | }; -LL | } - | - `a` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-2.rs deleted file mode 100644 index 7dc0f0c12..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -trait Bazoom: Sized { - fn method(self, arg: T, arg2: U) { } -} - -impl Bazoom for T { -} - -fn annot_underscore() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method(a, &b, c); // OK -} - -fn annot_reference_any_lifetime() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<&u32>>::method(a, &b, c); // OK -} - -fn annot_reference_static_lifetime() { - let a = 22; - let b = 44; - let c = 66; - let x = <&'static u32 as Bazoom<_>>::method; - x(&a, b, c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(b: &'a u32) { - let a = 44; - let c = 66; - <_ as Bazoom<&'a u32>>::method(a, &b, c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - let c = 66; - <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(b: &'a u32) { - let a = 44; - let c = 66; - let _closure = || { - <_ as Bazoom<&'a u32>>::method(a, &b, c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr deleted file mode 100644 index 63d59905e..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-2.rs:30:7 - | -LL | x(&a, b, c); - | --^^------- - | | | - | | borrowed value does not live long enough - | argument requires that `a` is borrowed for `'static` -LL | } - | - `a` dropped here while still borrowed - -error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:37:39 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); - | ----------------------------------^^---- - | | | - | | borrowed value does not live long enough - | argument requires that `b` is borrowed for `'a` -LL | } - | - `b` dropped here while still borrowed - -error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:51:44 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | let _closure = || { - | -- value captured here -LL | let c = 66; -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); - | -----------------------------------^---- - | | | - | | borrowed value does not live long enough - | argument requires that `b` is borrowed for `'a` -LL | }; -LL | } - | - `b` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.rs b/src/test/ui/nll/user-annotations/method-ufcs-3.rs deleted file mode 100644 index 59d2009d1..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Unit test for the "user substitutions" that are annotated on each -// node. - -trait Bazoom { - fn method(&self, arg: T, arg2: U) { } -} - -impl Bazoom for T { -} - -fn no_annot() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method(&a, b, &c); // OK -} - -fn annot_underscore() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method::<_>(&a, b, &c); // OK -} - -fn annot_reference_any_lifetime() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method::<&u32>(&a, b, &c); // OK -} - -fn annot_reference_static_lifetime() { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); //~ ERROR -} - -fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - let a = 22; - let b = 44; - let c = 66; - <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR -} - -fn annot_reference_named_lifetime_ok<'a>(c: &'a u32) { - let a = 22; - let b = 44; - <_ as Bazoom<_>>::method::<&'a u32>(&a, b, c); -} - -fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - let c = 66; - <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR - }; -} - -fn annot_reference_named_lifetime_in_closure_ok<'a>(c: &'a u32) { - let a = 22; - let b = 44; - let _closure = || { - <_ as Bazoom<_>>::method::<&'a u32>(&a, b, c); - }; -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr deleted file mode 100644 index e7851833e..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:36:53 - | -LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); - | ------------------------------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'static` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:43:48 - | -LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { - | -- lifetime `'a` defined here -... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); - | -------------------------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | } - | - `c` dropped here while still borrowed - -error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:57:52 - | -LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { - | -- lifetime `'a` defined here -... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); - | -------------------------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `c` is borrowed for `'a` -LL | }; - | - `c` dropped here while still borrowed - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs deleted file mode 100644 index 7bfed61d4..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that substitutions given on the self type (here, `A`) carry -// through to NLL. - -struct A<'a> { x: &'a u32 } - -impl<'a> A<'a> { - fn new<'b, T>(x: &'a u32, y: T) -> Self { - Self { x } - } -} - -fn foo<'a>() { - let v = 22; - let x = A::<'a>::new(&v, 22); - //~^ ERROR -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr deleted file mode 100644 index 94861babd..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-1.rs:14:26 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = A::<'a>::new(&v, 22); - | -------------^^----- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -LL | -LL | } - | - `v` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs deleted file mode 100644 index cfbc0bcf6..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Check that substitutions given on the self type (here, `A`) can be -// used in combination with annotations given for method arguments. - -struct A<'a> { x: &'a u32 } - -impl<'a> A<'a> { - fn new<'b, T>(x: &'a u32, y: T) -> Self { - Self { x } - } -} - -fn foo<'a>() { - let v = 22; - let x = A::<'a>::new::<&'a u32>(&v, &v); - //~^ ERROR - //~| ERROR -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr deleted file mode 100644 index 06f20d9b2..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-2.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-2.rs:14:37 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = A::<'a>::new::<&'a u32>(&v, &v); - | ------------------------^^----- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -... -LL | } - | - `v` dropped here while still borrowed - -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-2.rs:14:41 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = A::<'a>::new::<&'a u32>(&v, &v); - | ----------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -... -LL | } - | - `v` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs deleted file mode 100644 index 7ddb13360..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that inherent methods invoked with `::new` style -// carry their annotations through to NLL. - -struct A<'a> { x: &'a u32 } - -impl<'a> A<'a> { - fn new<'b, T>(x: &'a u32, y: T) -> Self { - Self { x } - } -} - -fn foo<'a>() { - let v = 22; - let x = >::new(&v, 22); - //~^ ERROR -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr deleted file mode 100644 index 4ad61dc81..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-3.rs:14:26 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = >::new(&v, 22); - | -------------^^----- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -LL | -LL | } - | - `v` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs deleted file mode 100644 index 85e759739..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Check that inherent methods invoked with `::new` style -// carry their annotations through to NLL in connection with -// method type parameters. - -struct A<'a> { x: &'a u32 } - -impl<'a> A<'a> { - fn new<'b, T>(x: &'a u32, y: T) -> Self { - Self { x } - } -} - -fn foo<'a>() { - let v = 22; - let x = >::new::<&'a u32>(&v, &v); - //~^ ERROR - //~| ERROR -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr deleted file mode 100644 index 0f83e99cd..000000000 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-4.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-4.rs:15:37 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = >::new::<&'a u32>(&v, &v); - | ------------------------^^----- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -... -LL | } - | - `v` dropped here while still borrowed - -error[E0597]: `v` does not live long enough - --> $DIR/method-ufcs-inherent-4.rs:15:41 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let v = 22; -LL | let x = >::new::<&'a u32>(&v, &v); - | ----------------------------^^- - | | | - | | borrowed value does not live long enough - | argument requires that `v` is borrowed for `'a` -... -LL | } - | - `v` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/normalization.rs b/src/test/ui/nll/user-annotations/normalization.rs deleted file mode 100644 index 870e3d811..000000000 --- a/src/test/ui/nll/user-annotations/normalization.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Test that we enforce a `&'static` requirement that is only visible -// after normalization. - -trait Foo { type Out; } -impl Foo for () { type Out = &'static u32; } - -fn main() { - let a = 22; - let b: <() as Foo>::Out = &a; //~ ERROR -} diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr deleted file mode 100644 index 4c7893789..000000000 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0597]: `a` does not live long enough - --> $DIR/normalization.rs:9:31 - | -LL | let b: <() as Foo>::Out = &a; - | ---------------- ^^ borrowed value does not live long enough - | | - | type annotation requires that `a` is borrowed for `'static` -LL | } - | - `a` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/normalize-self-ty.rs b/src/test/ui/nll/user-annotations/normalize-self-ty.rs deleted file mode 100644 index df905c878..000000000 --- a/src/test/ui/nll/user-annotations/normalize-self-ty.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Regression test for #55183: check a case where the self type from -// the inherent impl requires normalization to be equal to the -// user-provided type. -// -// check-pass - -trait Mirror { - type Me; -} - -impl Mirror for T { - type Me = T; -} - -struct Foo(A, B); - -impl Foo::Me> { - fn m(_: A) { } -} - -fn main() { - >::m(&22); -} diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs deleted file mode 100644 index 59cd69c0c..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs +++ /dev/null @@ -1,22 +0,0 @@ -enum Foo<'a> { - Bar { field: &'a u32 } -} - -fn in_let() { - let y = 22; - let foo = Foo::Bar { field: &y }; - //~^ ERROR `y` does not live long enough - let Foo::Bar::<'static> { field: _z } = foo; -} - -fn in_match() { - let y = 22; - let foo = Foo::Bar { field: &y }; - //~^ ERROR `y` does not live long enough - match foo { - Foo::Bar::<'static> { field: _z } => { - } - } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr deleted file mode 100644 index a97e7a9fd..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_enum_variant.rs:7:33 - | -LL | let foo = Foo::Bar { field: &y }; - | ^^ borrowed value does not live long enough -LL | -LL | let Foo::Bar::<'static> { field: _z } = foo; - | --------------------------------- type annotation requires that `y` is borrowed for `'static` -LL | } - | - `y` dropped here while still borrowed - -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_enum_variant.rs:14:33 - | -LL | let foo = Foo::Bar { field: &y }; - | ^^ borrowed value does not live long enough -... -LL | Foo::Bar::<'static> { field: _z } => { - | --------------------------------- type annotation requires that `y` is borrowed for `'static` -... -LL | } - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs deleted file mode 100644 index 1586c4ea3..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs +++ /dev/null @@ -1,20 +0,0 @@ -struct Foo<'a> { field: &'a u32 } - -fn in_let() { - let y = 22; - let foo = Foo { field: &y }; - //~^ ERROR `y` does not live long enough - let Foo::<'static> { field: _z } = foo; -} - -fn in_main() { - let y = 22; - let foo = Foo { field: &y }; - //~^ ERROR `y` does not live long enough - match foo { - Foo::<'static> { field: _z } => { - } - } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr deleted file mode 100644 index 408d7c2a5..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_struct.rs:5:28 - | -LL | let foo = Foo { field: &y }; - | ^^ borrowed value does not live long enough -LL | -LL | let Foo::<'static> { field: _z } = foo; - | ---------------------------- type annotation requires that `y` is borrowed for `'static` -LL | } - | - `y` dropped here while still borrowed - -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_brace_struct.rs:12:28 - | -LL | let foo = Foo { field: &y }; - | ^^ borrowed value does not live long enough -... -LL | Foo::<'static> { field: _z } => { - | ---------------------------- type annotation requires that `y` is borrowed for `'static` -... -LL | } - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs deleted file mode 100644 index 6fa59fdd8..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.rs +++ /dev/null @@ -1,22 +0,0 @@ -enum Foo<'a> { - Bar(&'a u32) -} - -fn in_let() { - let y = 22; - let foo = Foo::Bar(&y); - //~^ ERROR `y` does not live long enough - let Foo::Bar::<'static>(_z) = foo; -} - -fn in_match() { - let y = 22; - let foo = Foo::Bar(&y); - //~^ ERROR `y` does not live long enough - match foo { - Foo::Bar::<'static>(_z) => { - } - } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr deleted file mode 100644 index 920c906f6..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_enum_variant.rs:7:24 - | -LL | let foo = Foo::Bar(&y); - | ^^ borrowed value does not live long enough -LL | -LL | let Foo::Bar::<'static>(_z) = foo; - | ----------------------- type annotation requires that `y` is borrowed for `'static` -LL | } - | - `y` dropped here while still borrowed - -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_enum_variant.rs:14:24 - | -LL | let foo = Foo::Bar(&y); - | ^^ borrowed value does not live long enough -... -LL | Foo::Bar::<'static>(_z) => { - | ----------------------- type annotation requires that `y` is borrowed for `'static` -... -LL | } - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs deleted file mode 100644 index 7486aab0e..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.rs +++ /dev/null @@ -1,20 +0,0 @@ -struct Foo<'a>(&'a u32); - -fn in_let() { - let y = 22; - let foo = Foo(&y); - //~^ ERROR `y` does not live long enough - let Foo::<'static>(_z) = foo; -} - -fn in_match() { - let y = 22; - let foo = Foo(&y); - //~^ ERROR `y` does not live long enough - match foo { - Foo::<'static>(_z) => { - } - } -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr deleted file mode 100644 index 3f01638d8..000000000 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_struct.rs:5:19 - | -LL | let foo = Foo(&y); - | ^^ borrowed value does not live long enough -LL | -LL | let Foo::<'static>(_z) = foo; - | ------------------ type annotation requires that `y` is borrowed for `'static` -LL | } - | - `y` dropped here while still borrowed - -error[E0597]: `y` does not live long enough - --> $DIR/pattern_substs_on_tuple_struct.rs:12:19 - | -LL | let foo = Foo(&y); - | ^^ borrowed value does not live long enough -... -LL | Foo::<'static>(_z) => { - | ------------------ type annotation requires that `y` is borrowed for `'static` -... -LL | } - | - `y` dropped here while still borrowed - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/patterns.rs b/src/test/ui/nll/user-annotations/patterns.rs deleted file mode 100644 index 1f635d7f5..000000000 --- a/src/test/ui/nll/user-annotations/patterns.rs +++ /dev/null @@ -1,136 +0,0 @@ -// Test that various patterns also enforce types. - -fn variable_no_initializer() { - let x = 22; - let y: &'static u32; - y = &x; //~ ERROR -} - -fn tuple_no_initializer() { - - - let x = 22; - let (y, z): (&'static u32, &'static u32); - y = &x; //~ ERROR -} - -fn ref_with_ascribed_static_type() -> u32 { - // Check the behavior in some wacky cases. - let x = 22; - let y = &x; //~ ERROR - let ref z: &'static u32 = y; - **z -} - -fn ref_with_ascribed_any_type() -> u32 { - let x = 22; - let y = &x; - let ref z: &u32 = y; - **z -} - -struct Single { value: T } - -fn struct_no_initializer() { - - - let x = 22; - let Single { value: y }: Single<&'static u32>; - y = &x; //~ ERROR -} - - -fn struct_no_initializer_must_normalize() { - trait Indirect { type Assoc; } - struct StaticU32; - impl Indirect for StaticU32 { type Assoc = &'static u32; } - struct Single2 { value: ::Assoc } - - let x = 22; - let Single2 { value: mut _y }: Single2; - _y = &x; //~ ERROR -} - -fn variable_with_initializer() { - let x = 22; - let y: &'static u32 = &x; //~ ERROR -} - -fn underscore_with_initializer() { - let x = 22; - let _: &'static u32 = &x; //~ ERROR - - let _: Vec<&'static String> = vec![&String::new()]; - //~^ ERROR temporary value dropped while borrowed [E0716] - - let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR temporary value dropped while borrowed [E0716] - - let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); - //~^ ERROR temporary value dropped while borrowed [E0716] -} - -fn pair_underscores_with_initializer() { - let x = 22; - let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR -} - -fn pair_variable_with_initializer() { - let x = 22; - let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR -} - -fn struct_single_field_variable_with_initializer() { - let x = 22; - let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR -} - -fn struct_single_field_underscore_with_initializer() { - let x = 22; - let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR -} - -struct Double { value1: T, value2: T } - -fn struct_double_field_underscore_with_initializer() { - let x = 22; - let Double { value1: _, value2: _ }: Double<&'static u32> = Double { - value1: &x, //~ ERROR - value2: &44, - }; -} - -fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { - - - - - - - let y: &'a u32 = &22; - y //~ ERROR -} - -fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { - - - - - - - - let (y, _z): (&'a u32, u32) = (&22, 44); - y //~ ERROR -} - -fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { - let Single { value: y }: Single<&'a u32> = Single { value: &22 }; - y //~ ERROR -} - -fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { - let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR - y -} - -fn main() { } diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr deleted file mode 100644 index de6f8f80f..000000000 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ /dev/null @@ -1,189 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:6:9 - | -LL | let y: &'static u32; - | ------------ type annotation requires that `x` is borrowed for `'static` -LL | y = &x; - | ^^ borrowed value does not live long enough -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:14:9 - | -LL | let (y, z): (&'static u32, &'static u32); - | ---------------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; - | ^^ borrowed value does not live long enough -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:20:13 - | -LL | let y = &x; - | ^^ borrowed value does not live long enough -LL | let ref z: &'static u32 = y; - | ------------ type annotation requires that `x` is borrowed for `'static` -LL | **z -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:39:9 - | -LL | let Single { value: y }: Single<&'static u32>; - | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; - | ^^ borrowed value does not live long enough -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:51:10 - | -LL | let Single2 { value: mut _y }: Single2; - | ------------------ type annotation requires that `x` is borrowed for `'static` -LL | _y = &x; - | ^^ borrowed value does not live long enough -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:56:27 - | -LL | let y: &'static u32 = &x; - | ------------ ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:61:27 - | -LL | let _: &'static u32 = &x; - | ------------ ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -... -LL | } - | - `x` dropped here while still borrowed - -error[E0716]: temporary value dropped while borrowed - --> $DIR/patterns.rs:63:41 - | -LL | let _: Vec<&'static String> = vec![&String::new()]; - | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | type annotation requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/patterns.rs:66:52 - | -LL | let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44); - | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | type annotation requires that borrow lasts for `'static` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/patterns.rs:69:53 - | -LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); - | ------------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | type annotation requires that borrow lasts for `'static` - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:75:40 - | -LL | let (_, _): (&'static u32, u32) = (&x, 44); - | ------------------- ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:80:40 - | -LL | let (y, _): (&'static u32, u32) = (&x, 44); - | ------------------- ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:85:69 - | -LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; - | -------------------- ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:90:69 - | -LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; - | -------------------- ^^ borrowed value does not live long enough - | | - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error[E0597]: `x` does not live long enough - --> $DIR/patterns.rs:98:17 - | -LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double { - | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | value1: &x, - | ^^ borrowed value does not live long enough -... -LL | } - | - `x` dropped here while still borrowed - -error: lifetime may not live long enough - --> $DIR/patterns.rs:111:5 - | -LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -... -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/patterns.rs:123:5 - | -LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -... -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/patterns.rs:128:5 - | -LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; -LL | y - | ^ returning this value requires that `'a` must outlive `'static` - -error: lifetime may not live long enough - --> $DIR/patterns.rs:132:18 - | -LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { - | -- lifetime `'a` defined here -LL | let (y, _z): (&'static u32, u32) = (x, 44); - | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - -error: aborting due to 19 previous errors - -Some errors have detailed explanations: E0597, E0716. -For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.rs b/src/test/ui/nll/user-annotations/promoted-annotation.rs deleted file mode 100644 index b92f8bfd2..000000000 --- a/src/test/ui/nll/user-annotations/promoted-annotation.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Test that type annotations are checked in promoted constants correctly. - -fn foo<'a>() { - let x = 0; - let f = &drop::<&'a i32>; - f(&x); - //~^ ERROR `x` does not live long enough -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.stderr b/src/test/ui/nll/user-annotations/promoted-annotation.stderr deleted file mode 100644 index cb99a6a36..000000000 --- a/src/test/ui/nll/user-annotations/promoted-annotation.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/promoted-annotation.rs:6:7 - | -LL | fn foo<'a>() { - | -- lifetime `'a` defined here -LL | let x = 0; -LL | let f = &drop::<&'a i32>; - | ---------------- assignment requires that `x` is borrowed for `'a` -LL | f(&x); - | ^^ borrowed value does not live long enough -LL | -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/type-annotation-with-hrtb.rs b/src/test/ui/nll/user-annotations/type-annotation-with-hrtb.rs deleted file mode 100644 index 1f7c06038..000000000 --- a/src/test/ui/nll/user-annotations/type-annotation-with-hrtb.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Regression test for issue #69490 - -// check-pass - -pub trait Trait { - const S: &'static str; -} - -impl Trait<()> for T -where - T: for<'a> Trait<&'a ()>, -{ - // Use of `T::S` here caused an ICE - const S: &'static str = T::S; -} - -// Some similar cases that didn't ICE: - -impl<'a, T> Trait<()> for (T,) -where - T: Trait<&'a ()>, -{ - const S: &'static str = T::S; -} - -impl Trait<()> for [T; 1] -where - T: Trait fn(&'a ())>, -{ - const S: &'static str = T::S; -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs deleted file mode 100644 index 88d646dee..000000000 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![allow(warnings)] -#![feature(type_ascription)] - -fn main() { - let x = 22_u32; - let y: &u32 = type_ascribe!(&x, &'static u32); //~ ERROR E0597 -} diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr deleted file mode 100644 index ccbf3c1d9..000000000 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0597]: `x` does not live long enough - --> $DIR/type_ascription_static_lifetime.rs:6:33 - | -LL | let y: &u32 = type_ascribe!(&x, &'static u32); - | --------------^^--------------- - | | | - | | borrowed value does not live long enough - | type annotation requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/wf-self-type.rs b/src/test/ui/nll/user-annotations/wf-self-type.rs deleted file mode 100644 index 539226aab..000000000 --- a/src/test/ui/nll/user-annotations/wf-self-type.rs +++ /dev/null @@ -1,13 +0,0 @@ -struct Foo<'a, 'b: 'a>(&'a &'b ()); - -impl<'a, 'b> Foo<'a, 'b> { - fn xmute(a: &'b ()) -> &'a () { - unreachable!() - } -} - -pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { - Foo::xmute(u) //~ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/src/test/ui/nll/user-annotations/wf-self-type.stderr b/src/test/ui/nll/user-annotations/wf-self-type.stderr deleted file mode 100644 index 1d3ae7cfb..000000000 --- a/src/test/ui/nll/user-annotations/wf-self-type.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/wf-self-type.rs:10:5 - | -LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | Foo::xmute(u) - | ^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to previous error - -- cgit v1.2.3