diff options
Diffstat (limited to 'tests')
332 files changed, 4905 insertions, 1555 deletions
diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen/debug-fndef-size.rs index 5551d2cc39c..27bf00adf0e 100644 --- a/tests/codegen/debug-fndef-size.rs +++ b/tests/codegen/debug-fndef-size.rs @@ -13,6 +13,6 @@ pub fn main() { } // CHECK: %compare.dbg.spill = alloca [0 x i8], align 1 -// CHECK: call void @llvm.dbg.declare(metadata ptr %compare.dbg.spill, metadata ![[VAR:.*]], metadata !DIExpression()), !dbg !{{.*}} +// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression() // CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}}) // CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1) diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen/debuginfo-constant-locals.rs index f607e0dd08b..c8f1d964722 100644 --- a/tests/codegen/debuginfo-constant-locals.rs +++ b/tests/codegen/debuginfo-constant-locals.rs @@ -18,8 +18,8 @@ fn foo(x: i32) { } // CHECK-LABEL: @check_it -// CHECK: call void @llvm.dbg.value(metadata i32 1, metadata ![[a_metadata:[0-9]+]], metadata !DIExpression()) -// CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[b_metadata:[0-9]+]], metadata !DIExpression()) +// CHECK: dbg{{.}}value({{(metadata )?}}i32 1, {{(metadata )?}}![[a_metadata:[0-9]+]], {{(metadata )?}}!DIExpression() +// CHECK: dbg{{.}}value({{(metadata )?}}i32 42, {{(metadata )?}}![[b_metadata:[0-9]+]], {{(metadata )?}}!DIExpression() // CHECK: ![[a_metadata]] = !DILocalVariable(name: "a" // CHECK-SAME: line: 9 diff --git a/tests/codegen/inline-debuginfo.rs b/tests/codegen/inline-debuginfo.rs index b6ea489f99f..f327180560d 100644 --- a/tests/codegen/inline-debuginfo.rs +++ b/tests/codegen/inline-debuginfo.rs @@ -9,7 +9,7 @@ pub extern "C" fn callee(x: u32) -> u32 { } // CHECK-LABEL: caller -// CHECK: call void @llvm.dbg.value(metadata i32 %y, metadata !{{.*}}, metadata !DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value)), !dbg [[A:!.*]] +// CHECK: dbg{{.}}value({{(metadata )?}}i32 %y, {{(metadata )?}}!{{.*}}, {{(metadata )?}}!DIExpression(DW_OP_constu, 3, DW_OP_minus, DW_OP_stack_value){{.*}} [[A:![0-9]+]] // CHECK: [[A]] = !DILocation(line: {{.*}}, scope: {{.*}}, inlinedAt: {{.*}}) #[no_mangle] pub extern "C" fn caller(y: u32) -> u32 { diff --git a/tests/codegen/mir-aggregate-no-alloca.rs b/tests/codegen/mir-aggregate-no-alloca.rs new file mode 100644 index 00000000000..a7752d714fe --- /dev/null +++ b/tests/codegen/mir-aggregate-no-alloca.rs @@ -0,0 +1,123 @@ +//@ compile-flags: -O -C no-prepopulate-passes -Z randomize-layout=no + +#![crate_type = "lib"] + +#[repr(transparent)] +pub struct Transparent32(u32); + +// CHECK: i32 @make_transparent(i32 noundef %x) +#[no_mangle] +pub fn make_transparent(x: u32) -> Transparent32 { + // CHECK-NOT: alloca + // CHECK: ret i32 %x + let a = Transparent32(x); + a +} + +// CHECK: i32 @make_closure(i32 noundef %x) +#[no_mangle] +pub fn make_closure(x: i32) -> impl Fn(i32) -> i32 { + // CHECK-NOT: alloca + // CHECK: ret i32 %x + move |y| x + y +} + +#[repr(transparent)] +pub struct TransparentPair((), (u16, u16), ()); + +// CHECK: { i16, i16 } @make_transparent_pair(i16 noundef %x.0, i16 noundef %x.1) +#[no_mangle] +pub fn make_transparent_pair(x: (u16, u16)) -> TransparentPair { + // CHECK-NOT: alloca + // CHECK: %[[TEMP0:.+]] = insertvalue { i16, i16 } poison, i16 %x.0, 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i16, i16 } %[[TEMP0]], i16 %x.1, 1 + // CHECK: ret { i16, i16 } %[[TEMP1]] + let a = TransparentPair((), x, ()); + a +} + +// CHECK-LABEL: { i32, i32 } @make_2_tuple(i32 noundef %x) +#[no_mangle] +pub fn make_2_tuple(x: u32) -> (u32, u32) { + // CHECK-NOT: alloca + // CHECK: %[[TEMP0:.+]] = insertvalue { i32, i32 } poison, i32 %x, 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i32, i32 } %[[TEMP0]], i32 %x, 1 + // CHECK: ret { i32, i32 } %[[TEMP1]] + let pair = (x, x); + pair +} + +// CHECK-LABEL: i8 @make_cell_of_bool(i1 noundef zeroext %b) +#[no_mangle] +pub fn make_cell_of_bool(b: bool) -> std::cell::Cell<bool> { + // CHECK: %[[BYTE:.+]] = zext i1 %b to i8 + // CHECK: ret i8 %[[BYTE]] + std::cell::Cell::new(b) +} + +// CHECK-LABLE: { i8, i16 } @make_cell_of_bool_and_short(i1 noundef zeroext %b, i16 noundef %s) +#[no_mangle] +pub fn make_cell_of_bool_and_short(b: bool, s: u16) -> std::cell::Cell<(bool, u16)> { + // CHECK-NOT: alloca + // CHECK: %[[BYTE:.+]] = zext i1 %b to i8 + // CHECK: %[[TEMP0:.+]] = insertvalue { i8, i16 } poison, i8 %[[BYTE]], 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i8, i16 } %[[TEMP0]], i16 %s, 1 + // CHECK: ret { i8, i16 } %[[TEMP1]] + std::cell::Cell::new((b, s)) +} + +// CHECK-LABEL: { i1, i1 } @make_tuple_of_bools(i1 noundef zeroext %a, i1 noundef zeroext %b) +#[no_mangle] +pub fn make_tuple_of_bools(a: bool, b: bool) -> (bool, bool) { + // CHECK-NOT: alloca + // CHECK: %[[TEMP0:.+]] = insertvalue { i1, i1 } poison, i1 %a, 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i1, i1 } %[[TEMP0]], i1 %b, 1 + // CHECK: ret { i1, i1 } %[[TEMP1]] + (a, b) +} + +pub struct Struct0(); + +// CHECK-LABEL: void @make_struct_0() +#[no_mangle] +pub fn make_struct_0() -> Struct0 { + // CHECK: ret void + let s = Struct0(); + s +} + +pub struct Struct1(i32); + +// CHECK-LABEL: i32 @make_struct_1(i32 noundef %a) +#[no_mangle] +pub fn make_struct_1(a: i32) -> Struct1 { + // CHECK: ret i32 %a + let s = Struct1(a); + s +} + +pub struct Struct2Asc(i16, i64); + +// CHECK-LABEL: { i64, i16 } @make_struct_2_asc(i16 noundef %a, i64 noundef %b) +#[no_mangle] +pub fn make_struct_2_asc(a: i16, b: i64) -> Struct2Asc { + // CHECK-NOT: alloca + // CHECK: %[[TEMP0:.+]] = insertvalue { i64, i16 } poison, i64 %b, 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i64, i16 } %[[TEMP0]], i16 %a, 1 + // CHECK: ret { i64, i16 } %[[TEMP1]] + let s = Struct2Asc(a, b); + s +} + +pub struct Struct2Desc(i64, i16); + +// CHECK-LABEL: { i64, i16 } @make_struct_2_desc(i64 noundef %a, i16 noundef %b) +#[no_mangle] +pub fn make_struct_2_desc(a: i64, b: i16) -> Struct2Desc { + // CHECK-NOT: alloca + // CHECK: %[[TEMP0:.+]] = insertvalue { i64, i16 } poison, i64 %a, 0 + // CHECK: %[[TEMP1:.+]] = insertvalue { i64, i16 } %[[TEMP0]], i16 %b, 1 + // CHECK: ret { i64, i16 } %[[TEMP1]] + let s = Struct2Desc(a, b); + s +} diff --git a/tests/codegen/sroa-fragment-debuginfo.rs b/tests/codegen/sroa-fragment-debuginfo.rs index 32786d2a76a..670ddb56540 100644 --- a/tests/codegen/sroa-fragment-debuginfo.rs +++ b/tests/codegen/sroa-fragment-debuginfo.rs @@ -17,9 +17,9 @@ pub fn extra(s: &[u8]) { // CHECK: %slice.dbg.spill1 = alloca [4 x i8], // CHECK: %slice.dbg.spill = alloca [16 x i8], // CHECK: %s.dbg.spill = alloca [16 x i8], -// CHECK: call void @llvm.dbg.declare(metadata ptr %s.dbg.spill, metadata ![[S_EXTRA:.*]], metadata !DIExpression()), -// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata ![[SLICE_EXTRA:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 128)), -// CHECK: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill1, metadata ![[SLICE_EXTRA]], metadata !DIExpression(DW_OP_LLVM_fragment, 128, 32)), +// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %s.dbg.spill, {{(metadata )?}}![[S_EXTRA:.*]], {{(metadata )?}}!DIExpression() +// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}![[SLICE_EXTRA:.*]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 0, 128) +// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill1, {{(metadata )?}}![[SLICE_EXTRA]], {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, 128, 32) let slice = ExtraSlice { slice: s, extra: s.len() as u32 }; } @@ -36,9 +36,9 @@ pub fn zst(s: &[u8]) { // variable, so is not a fragment. In that case, the variable must have no fragment. // CHECK: void @zst( -// CHECK-NOT: call void @llvm.dbg.declare(metadata ptr %slice.dbg.spill, metadata !{}, metadata !DIExpression(DW_OP_LLVM_fragment, -// CHECK: call void @llvm.dbg.declare(metadata ptr %{{.*}}, metadata ![[SLICE_ZST:.*]], metadata !DIExpression()), -// CHECK-NOT: call void @llvm.dbg.declare(metadata ptr %{{.*}}, metadata ![[SLICE_ZST]], +// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %slice.dbg.spill, {{(metadata )?}}!{}, {{(metadata )?}}!DIExpression(DW_OP_LLVM_fragment, +// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST:.*]], {{(metadata )?}}!DIExpression() +// CHECK-NOT: dbg{{.}}declare({{(metadata )?}}ptr %{{.*}}, {{(metadata )?}}![[SLICE_ZST]], let slice = ZstSlice { slice: s, extra: Zst }; } diff --git a/tests/coverage/branch/if-let.cov-map b/tests/coverage/branch/if-let.cov-map index c12df8d9801..0c7d986933e 100644 --- a/tests/coverage/branch/if-let.cov-map +++ b/tests/coverage/branch/if-let.cov-map @@ -1,13 +1,16 @@ Function name: if_let::if_let -Raw bytes (38): 0x[01, 01, 02, 05, 09, 09, 02, 06, 01, 0c, 01, 01, 10, 02, 03, 11, 00, 12, 05, 00, 16, 00, 1b, 02, 00, 1c, 02, 06, 09, 02, 0c, 02, 06, 07, 03, 05, 01, 02] +Raw bytes (45): 0x[01, 01, 02, 05, 09, 09, 02, 07, 01, 0c, 01, 01, 10, 20, 02, 09, 03, 0c, 00, 13, 02, 00, 11, 00, 12, 05, 00, 16, 00, 1b, 02, 00, 1c, 02, 06, 09, 02, 0c, 02, 06, 07, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 2 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub) -Number of file 0 mappings: 6 +Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 12, 1) to (start + 1, 16) -- Code(Expression(0, Sub)) at (prev + 3, 17) to (start + 0, 18) +- Branch { true: Expression(0, Sub), false: Counter(2) } at (prev + 3, 12) to (start + 0, 19) + true = (c1 - c2) + false = c2 +- Code(Expression(0, Sub)) at (prev + 0, 17) to (start + 0, 18) = (c1 - c2) - Code(Counter(1)) at (prev + 0, 22) to (start + 0, 27) - Code(Expression(0, Sub)) at (prev + 0, 28) to (start + 2, 6) @@ -17,7 +20,7 @@ Number of file 0 mappings: 6 = (c2 + (c1 - c2)) Function name: if_let::if_let_chain -Raw bytes (52): 0x[01, 01, 04, 01, 05, 05, 09, 0f, 0d, 05, 09, 08, 01, 17, 01, 00, 33, 02, 01, 11, 00, 12, 01, 00, 16, 00, 17, 0d, 01, 15, 00, 16, 02, 00, 1a, 00, 1b, 0d, 01, 05, 03, 06, 0f, 03, 0c, 02, 06, 0b, 03, 05, 01, 02] +Raw bytes (66): 0x[01, 01, 04, 01, 05, 05, 09, 0f, 0d, 05, 09, 0a, 01, 17, 01, 00, 33, 20, 02, 05, 01, 0c, 00, 13, 02, 00, 11, 00, 12, 01, 00, 16, 00, 17, 20, 0d, 09, 01, 10, 00, 17, 0d, 00, 15, 00, 16, 02, 00, 1a, 00, 1b, 0d, 01, 05, 03, 06, 0f, 03, 0c, 02, 06, 0b, 03, 05, 01, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 @@ -25,12 +28,18 @@ Number of expressions: 4 - expression 1 operands: lhs = Counter(1), rhs = Counter(2) - expression 2 operands: lhs = Expression(3, Add), rhs = Counter(3) - expression 3 operands: lhs = Counter(1), rhs = Counter(2) -Number of file 0 mappings: 8 +Number of file 0 mappings: 10 - Code(Counter(0)) at (prev + 23, 1) to (start + 0, 51) -- Code(Expression(0, Sub)) at (prev + 1, 17) to (start + 0, 18) +- Branch { true: Expression(0, Sub), false: Counter(1) } at (prev + 1, 12) to (start + 0, 19) + true = (c0 - c1) + false = c1 +- Code(Expression(0, Sub)) at (prev + 0, 17) to (start + 0, 18) = (c0 - c1) - Code(Counter(0)) at (prev + 0, 22) to (start + 0, 23) -- Code(Counter(3)) at (prev + 1, 21) to (start + 0, 22) +- Branch { true: Counter(3), false: Counter(2) } at (prev + 1, 16) to (start + 0, 23) + true = c3 + false = c2 +- Code(Counter(3)) at (prev + 0, 21) to (start + 0, 22) - Code(Expression(0, Sub)) at (prev + 0, 26) to (start + 0, 27) = (c0 - c1) - Code(Counter(3)) at (prev + 1, 5) to (start + 3, 6) diff --git a/tests/coverage/branch/if-let.coverage b/tests/coverage/branch/if-let.coverage index f30c5d34eca..9a3f0113f75 100644 --- a/tests/coverage/branch/if-let.coverage +++ b/tests/coverage/branch/if-let.coverage @@ -14,6 +14,9 @@ LL| | LL| 3| if let Some(x) = input { ^2 + ------------------ + | Branch (LL:12): [True: 2, False: 1] + ------------------ LL| 2| say(x); LL| 2| } else { LL| 1| say("none"); @@ -24,8 +27,14 @@ LL| 15|fn if_let_chain(a: Option<&str>, b: Option<&str>) { LL| 15| if let Some(x) = a ^12 + ------------------ + | Branch (LL:12): [True: 12, False: 3] + ------------------ LL| 12| && let Some(y) = b ^8 + ------------------ + | Branch (LL:16): [True: 8, False: 4] + ------------------ LL| 8| { LL| 8| say(x); LL| 8| say(y); diff --git a/tests/coverage/branch/let-else.cov-map b/tests/coverage/branch/let-else.cov-map index ad987bd6bb1..c7f7adddbc2 100644 --- a/tests/coverage/branch/let-else.cov-map +++ b/tests/coverage/branch/let-else.cov-map @@ -1,13 +1,16 @@ Function name: let_else::let_else -Raw bytes (38): 0x[01, 01, 02, 05, 09, 09, 02, 06, 01, 0c, 01, 01, 10, 02, 03, 0e, 00, 0f, 05, 00, 13, 00, 18, 09, 01, 09, 01, 0f, 02, 04, 05, 00, 0b, 07, 01, 01, 00, 02] +Raw bytes (45): 0x[01, 01, 02, 05, 09, 09, 02, 07, 01, 0c, 01, 01, 10, 20, 02, 09, 03, 09, 00, 10, 02, 00, 0e, 00, 0f, 05, 00, 13, 00, 18, 09, 01, 09, 01, 0f, 02, 04, 05, 00, 0b, 07, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 2 - expression 0 operands: lhs = Counter(1), rhs = Counter(2) - expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub) -Number of file 0 mappings: 6 +Number of file 0 mappings: 7 - Code(Counter(0)) at (prev + 12, 1) to (start + 1, 16) -- Code(Expression(0, Sub)) at (prev + 3, 14) to (start + 0, 15) +- Branch { true: Expression(0, Sub), false: Counter(2) } at (prev + 3, 9) to (start + 0, 16) + true = (c1 - c2) + false = c2 +- Code(Expression(0, Sub)) at (prev + 0, 14) to (start + 0, 15) = (c1 - c2) - Code(Counter(1)) at (prev + 0, 19) to (start + 0, 24) - Code(Counter(2)) at (prev + 1, 9) to (start + 1, 15) diff --git a/tests/coverage/branch/let-else.coverage b/tests/coverage/branch/let-else.coverage index 83730e1dfba..22ad8f2b0e1 100644 --- a/tests/coverage/branch/let-else.coverage +++ b/tests/coverage/branch/let-else.coverage @@ -14,6 +14,9 @@ LL| | LL| 3| let Some(x) = value else { ^2 + ------------------ + | Branch (LL:9): [True: 2, False: 1] + ------------------ LL| 1| say("none"); LL| 1| return; LL| | }; diff --git a/tests/crashes/120421.rs b/tests/crashes/120421.rs deleted file mode 100644 index b6059f3ace4..00000000000 --- a/tests/crashes/120421.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ known-bug: #120421 -//@ compile-flags: -Zlint-mir - -#![feature(never_patterns)] - -enum Void {} - -fn main() { - let res_void: Result<bool, Void> = Ok(true); - - for (Ok(mut _x) | Err(!)) in [res_void] {} -} diff --git a/tests/crashes/122989.rs b/tests/crashes/122989.rs deleted file mode 100644 index 70ad7d3b65c..00000000000 --- a/tests/crashes/122989.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #122989 -trait Traitor<const N: N<2> = 1, const N: N<2> = N> { - fn N(&N) -> N<2> { - M - } -} - -trait N<const N: Traitor<2> = 12> {} diff --git a/tests/crashes/123911.rs b/tests/crashes/123911.rs deleted file mode 100644 index 1a4d6a79512..00000000000 --- a/tests/crashes/123911.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #123911 - -macro_rules! m { - ($attr_path: path) => { - #[$attr_path] - fn f() {} - } -} - -m!(inline<{ - let a = CharCharFloat { a: 1 }; - let b = rustrt::rust_dbg_abi_4(a); - println!("a: {}", b.a); -}>); - -fn main() {} diff --git a/tests/crashes/123912.rs b/tests/crashes/123912.rs deleted file mode 100644 index 35216caabcd..00000000000 --- a/tests/crashes/123912.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: #123912 - -macro_rules! m { - ($attr_path: path) => { - #[$attr_path] - fn f() {} - } -} - -m!(inline<{ - let a = CharCharFloat { a: 1 }; - println!("a: {}", a); -}>); - -fn main() {} diff --git a/tests/crashes/124436.rs b/tests/crashes/124436.rs new file mode 100644 index 00000000000..aed830e8f0e --- /dev/null +++ b/tests/crashes/124436.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#124436 +//@ compile-flags: -Zdump-mir=all -Zpolymorphize=on + +pub trait TraitCat {} +pub trait TraitDog {} + +pub fn gamma<T: TraitCat + TraitDog>(t: [TraitDog; 32]) {} diff --git a/tests/crashes/124440.rs b/tests/crashes/124440.rs new file mode 100644 index 00000000000..431c4e444f1 --- /dev/null +++ b/tests/crashes/124440.rs @@ -0,0 +1,23 @@ +//@ known-bug: rust-lang/rust#124440 + +#![allow(warnings)] + +trait Foo {} + +impl<F> Foo for F where F: FnMut(&()) {} + +struct Bar<F> { + f: F, +} + +impl<F> Foo for Bar<F> where F: Foo {} + +fn assert_foo<F>(_: F) +where + Bar<F>: Foo, +{ +} + +fn main() { + assert_foo(|_| ()); +} diff --git a/tests/crashes/124464.rs b/tests/crashes/124464.rs new file mode 100644 index 00000000000..471479f5cf1 --- /dev/null +++ b/tests/crashes/124464.rs @@ -0,0 +1,17 @@ +//@ known-bug: rust-lang/rust #124464 +enum TestOption<T> { + TestSome(T), + TestSome(T), +} + +pub struct Request { + bar: TestOption<u64>, + bar: u8, +} + +fn default_instance() -> &'static Request { + static instance: Request = Request { bar: 17 }; + &instance +} + +pub fn main() {} diff --git a/tests/crashes/124490.rs b/tests/crashes/124490.rs new file mode 100644 index 00000000000..9f605c32cf2 --- /dev/null +++ b/tests/crashes/124490.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#124490 +use io::{self as std}; +use std::collections::{self as io}; + +mod a { + pub mod b { + pub mod c {} + } +} + +use a::*; + +use b::c; +use c as b; + +fn main() {} diff --git a/tests/crashes/124552.rs b/tests/crashes/124552.rs new file mode 100644 index 00000000000..5320ce27843 --- /dev/null +++ b/tests/crashes/124552.rs @@ -0,0 +1,12 @@ +//@ known-bug: rust-lang/rust#124552 + +struct B; + +struct Foo { + b: u32, + b: B, +} + +static BAR: Foo = Foo { b: B }; + +fn main() {} diff --git a/tests/crashes/124563.rs b/tests/crashes/124563.rs new file mode 100644 index 00000000000..b082739af53 --- /dev/null +++ b/tests/crashes/124563.rs @@ -0,0 +1,46 @@ +//@ known-bug: rust-lang/rust#124563 + +use std::marker::PhantomData; + +pub trait Trait {} + +pub trait Foo { + type Trait: Trait; + type Bar: Bar; + fn foo(&mut self); +} + +pub struct FooImpl<'a, 'b, A: Trait>(PhantomData<&'a &'b A>); + +impl<'a, 'b, T> Foo for FooImpl<'a, 'b, T> +where + T: Trait, +{ + type Trait = T; + type Bar = BarImpl<'a, 'b, T>; + + fn foo(&mut self) { + self.enter_scope(|ctx| { + BarImpl(ctx); + }); + } +} + +impl<'a, 'b, T> FooImpl<'a, 'b, T> +where + T: Trait, +{ + fn enter_scope(&mut self, _scope: impl FnOnce(&mut Self)) {} +} +pub trait Bar { + type Foo: Foo; +} + +pub struct BarImpl<'a, 'b, T: Trait>(&'b mut FooImpl<'a, 'b, T>); + +impl<'a, 'b, T> Bar for BarImpl<'a, 'b, T> +where + T: Trait, +{ + type Foo = FooImpl<'a, 'b, T>; +} diff --git a/tests/crashes/124583.rs b/tests/crashes/124583.rs new file mode 100644 index 00000000000..ffd9d7521ad --- /dev/null +++ b/tests/crashes/124583.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#124583 + +fn main() { + let _ = -(-0.0f16); +} diff --git a/tests/crashes/124751.rs b/tests/crashes/124751.rs new file mode 100644 index 00000000000..f15e39965d3 --- /dev/null +++ b/tests/crashes/124751.rs @@ -0,0 +1,8 @@ +//@ known-bug: rust-lang/rust#124751 +//@ compile-flags: -Zunstable-options --edition=2024 + +#![feature(gen_blocks)] + +fn main() { + let _ = async gen || {}; +} diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index 39883ffd0b6..fc2ab62a21c 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 -//@ needs-rust-lldb +//@ min-lldb-version: 1800 //@ compile-flags:-g @@ -23,10 +23,13 @@ // lldb-command:run // lldb-command:v *the_a_ref +// lldbg-check:(borrowed_enum::ABC) *the_a_ref = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } // lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 } // lldb-command:v *the_b_ref +// lldbg-check:(borrowed_enum::ABC) *the_b_ref = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 } // lldb-command:v *univariant_ref +// lldbg-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } // lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index e13f20455a8..746b7e40eda 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -1,8 +1,9 @@ // Require a gdb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 +//@ min-lldb-version: 1800 -// LLDB without native Rust support cannot read DW_TAG_variant_part, -// so it prints nothing for coroutines. But those tests are kept to +// LLDB (18.1+) now supports DW_TAG_variant_part, but there is some bug in either compiler or LLDB +// with memory layout of discriminant for this particular enum // ensure that LLDB won't crash at least (like #57822). //@ compile-flags:-g @@ -26,16 +27,7 @@ // lldb-command:run // lldb-command:v b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = -// lldb-command:continue -// lldb-command:v b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = -// lldb-command:continue -// lldb-command:v b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = -// lldb-command:continue -// lldb-command:v b -// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) b = +// lldb-check:(coroutine_objects::main::{coroutine_env#0}) b = { value = { _ref__a = 0x[...] } $discr$ = [...] } // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index f3f17758931..42a0d1e28f8 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -1,6 +1,6 @@ // Require a gdb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 - +//@ min-lldb-version: 1800 //@ compile-flags:-g -Z thinlto // === GDB TESTS =================================================================================== @@ -15,7 +15,7 @@ // lldb-command:run // lldb-command:v *abc -// lldbg-check:(enum_thinlto::ABC) *abc = +// lldbg-check:(enum_thinlto::ABC) *abc = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } // lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452) #![allow(unused_variables)] diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index 995779a6a9c..cadd9b542e9 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -3,7 +3,7 @@ // Require a gdb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 - +//@ min-lldb-version: 1800 //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -24,7 +24,7 @@ // lldbg-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } } // lldb-command:v b -// lldbg-check:(issue_57822::main::{coroutine_env#3}) b = +// lldbg-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' } #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs index 0293ec0ec39..a6032cc8642 100644 --- a/tests/debuginfo/msvc-pretty-enums.rs +++ b/tests/debuginfo/msvc-pretty-enums.rs @@ -1,6 +1,80 @@ -//@ only-cdb +//@ min-lldb-version: 1800 +//@ ignore-gdb //@ compile-flags:-g -// + +// === LLDB TESTS ================================================================================== +// lldb-command:run + +// lldb-command:v a +// lldbg-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) a = { value = { 0 = Low } } + +// lldb-command:v b +// lldbg-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) b = { value = $discr$ = '\x01' } + +// lldb-command:v c +// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) c = { value = $discr$ = '\x11' } + +// lldb-command:v d +// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) d = { value = { my_data = High } } + +// lldb-command:v e +// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) e = { value = $discr$ = '\x13' } + +// lldb-command:v h +// lldbg-check:(core::option::Option<u32>) h = { value = { 0 = 12 } $discr$ = 1 } + +// lldb-command:v i +// lldbg-check:(core::option::Option<u32>) i = { value = $discr$ = 0 } + +// lldb-command:v j +// lldbg-check:(msvc_pretty_enums::CStyleEnum) j = High + +// lldb-command:v k +// lldbg-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { vec = size=21 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } } + +// lldb-command:v l +// lldbg-check:(core::result::Result<u32, msvc_pretty_enums::Empty>) l = { value = { 0 = {} } } + +// lldb-command:v niche128_some +// lldbg-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_some = { value = $discr$ = 123456 } + +// lldb-command:v niche128_none +// lldbg-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_none = { value = $discr$ = 0 } + +// lldb-command:v wrapping_niche128_untagged +// lldbg-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_untagged = { value = { 0 = { 0 = 340282366920938463463374607431768211454 } } } + +// lldb-command:v wrapping_niche128_none1 +// lldbg-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_none1 = { value = { 0 = { 0 = 2 } } } + +// lldb-command:v direct_tag_128_a +// lldbg-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_a = { value = { 0 = 42 } $discr$ = 0 } + +// lldb-command:v direct_tag_128_b +// lldbg-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_b = { value = { 0 = 137 } $discr$ = 1 } + +// &u32 is incorrectly formatted and LLDB thinks it's a char* so skipping niche_w_fields_1_some + +// lldb-command:v niche_w_fields_1_none +// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields1) niche_w_fields_1_none = { value = { 0 = 99 } $discr$ = 1 } + +// lldb-command:v niche_w_fields_2_some +// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields2) niche_w_fields_2_some = { value = { 0 = 800 { __0 = { 0 = 800 } } 1 = 900 } $discr$ = 0 } + +// lldb-command:v niche_w_fields_3_some +// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_some = { value = { 0 = '\x89' 1 = true } } + +// lldb-command:v niche_w_fields_3_niche3 +// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_niche3 = { value = { 0 = '"' } $discr$ = '\x04' } + +// lldb-command:v arbitrary_discr1 +// lldbg-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr1 = { value = { 0 = 1234 } $discr$ = 1000 } + +// lldb-command:v arbitrary_discr2 +// lldbg-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr2 = { value = { 0 = 5678 } $discr$ = 5000000 } + +// === CDB TESTS ================================================================================== + // cdb-command: g // // cdb-command: dx a diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index 517b76c1412..42368017cae 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,7 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 -//@ needs-rust-lldb - +//@ min-lldb-version: 1800 //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -27,15 +26,19 @@ // lldb-command:run // lldb-command:v case1 +// lldbg-check:(struct_style_enum::Regular) case1 = { value = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } $discr$ = 0 } // lldbr-check:(struct_style_enum::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } // lldb-command:v case2 +// lldbg-check:(struct_style_enum::Regular) case2 = { value = { a = 0 b = 286331153 c = 286331153 } $discr$ = 1 } // lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } // lldb-command:v case3 +// lldbg-check:(struct_style_enum::Regular) case3 = { value = { a = 0 b = 6438275382588823897 } $discr$ = 2 } // lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } // lldb-command:v univariant +// lldbg-check:(struct_style_enum::Univariant) univariant = { value = { a = -1 } } // lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { TheOnlyCase: TheOnlyCase { a: -1 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index 883aa658eb2..3de4ecb1284 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 -//@ needs-rust-lldb +//@ min-lldb-version: 1800 //@ compile-flags:-g @@ -27,15 +27,19 @@ // lldb-command:run // lldb-command:v case1 +// lldbg-check:(tuple_style_enum::Regular) case1 = { value = { 0 = 0 1 = 31868 2 = 31868 3 = 31868 4 = 31868 } $discr$ = 0 } // lldbr-check:(tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 } // lldb-command:v case2 +// lldbg-check:(tuple_style_enum::Regular) case2 = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } // lldb-command:v case3 +// lldbg-check:(tuple_style_enum::Regular) case3 = { value = { 0 = 0 1 = 6438275382588823897 } $discr$ = 2 } // lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } // lldb-command:v univariant +// lldbg-check:(tuple_style_enum::Univariant) univariant = { value = { 0 = -1 } } // lldbr-check:(tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } } #![allow(unused_variables)] diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index b3879468e0a..514c7c50812 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. //@ min-gdb-version: 8.2 -//@ needs-rust-lldb +//@ min-lldb-version: 1800 //@ compile-flags:-g @@ -23,12 +23,15 @@ // lldb-command:run // lldb-command:v *the_a +// lldbg-check:(unique_enum::ABC) *the_a = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } // lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { TheA: 0, TheB: 8970181431921507452 } // lldb-command:v *the_b +// lldbg-check:(unique_enum::ABC) *the_b = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldbr-check:(unique_enum::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 } // lldb-command:v *univariant +// lldbg-check:(unique_enum::Univariant) *univariant = { value = { 0 = 123234 } } // lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } } #![allow(unused_variables)] diff --git a/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir new file mode 100644 index 00000000000..78356a90743 --- /dev/null +++ b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir @@ -0,0 +1,41 @@ +// MIR for `opt1` after SimplifyCfg-initial + +fn opt1(_1: &Result<u32, Void>) -> &u32 { + debug res => _1; + let mut _0: &u32; + let mut _2: isize; + let _3: &u32; + let mut _4: !; + let mut _5: (); + scope 1 { + debug x => _3; + } + + bb0: { + PlaceMention(_1); + _2 = discriminant((*_1)); + switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; + } + + bb1: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb2: { + falseEdge -> [real: bb4, imaginary: bb3]; + } + + bb3: { + FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); + unreachable; + } + + bb4: { + StorageLive(_3); + _3 = &(((*_1) as Ok).0: u32); + _0 = &(*_3); + StorageDead(_3); + return; + } +} diff --git a/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir new file mode 100644 index 00000000000..979fbb2860d --- /dev/null +++ b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir @@ -0,0 +1,35 @@ +// MIR for `opt2` after SimplifyCfg-initial + +fn opt2(_1: &Result<u32, Void>) -> &u32 { + debug res => _1; + let mut _0: &u32; + let mut _2: isize; + let _3: &u32; + scope 1 { + debug x => _3; + } + + bb0: { + PlaceMention(_1); + _2 = discriminant((*_1)); + switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; + } + + bb1: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb2: { + StorageLive(_3); + _3 = &(((*_1) as Ok).0: u32); + _0 = &(*_3); + StorageDead(_3); + return; + } + + bb3: { + FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); + unreachable; + } +} diff --git a/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir new file mode 100644 index 00000000000..93ebe600b3f --- /dev/null +++ b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir @@ -0,0 +1,35 @@ +// MIR for `opt3` after SimplifyCfg-initial + +fn opt3(_1: &Result<u32, Void>) -> &u32 { + debug res => _1; + let mut _0: &u32; + let mut _2: isize; + let _3: &u32; + scope 1 { + debug x => _3; + } + + bb0: { + PlaceMention(_1); + _2 = discriminant((*_1)); + switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; + } + + bb1: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb2: { + FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); + unreachable; + } + + bb3: { + StorageLive(_3); + _3 = &(((*_1) as Ok).0: u32); + _0 = &(*_3); + StorageDead(_3); + return; + } +} diff --git a/tests/mir-opt/building/match/never_patterns.rs b/tests/mir-opt/building/match/never_patterns.rs new file mode 100644 index 00000000000..8b52440da4c --- /dev/null +++ b/tests/mir-opt/building/match/never_patterns.rs @@ -0,0 +1,44 @@ +#![feature(never_patterns)] +#![allow(incomplete_features)] + +enum Void {} + +// EMIT_MIR never_patterns.opt1.SimplifyCfg-initial.after.mir +fn opt1(res: &Result<u32, Void>) -> &u32 { + // CHECK-LABEL: fn opt1( + // CHECK: bb0: { + // CHECK-NOT: {{bb.*}}: { + // CHECK: return; + match res { + Ok(x) => x, + Err(!), + } +} + +// EMIT_MIR never_patterns.opt2.SimplifyCfg-initial.after.mir +fn opt2(res: &Result<u32, Void>) -> &u32 { + // CHECK-LABEL: fn opt2( + // CHECK: bb0: { + // CHECK-NOT: {{bb.*}}: { + // CHECK: return; + match res { + Ok(x) | Err(!) => x, + } +} + +// EMIT_MIR never_patterns.opt3.SimplifyCfg-initial.after.mir +fn opt3(res: &Result<u32, Void>) -> &u32 { + // CHECK-LABEL: fn opt3( + // CHECK: bb0: { + // CHECK-NOT: {{bb.*}}: { + // CHECK: return; + match res { + Err(!) | Ok(x) => x, + } +} + +fn main() { + assert_eq!(opt1(&Ok(0)), &0); + assert_eq!(opt2(&Ok(0)), &0); + assert_eq!(opt3(&Ok(0)), &0); +} diff --git a/tests/mir-opt/building/match/sort_candidates.rs b/tests/mir-opt/building/match/sort_candidates.rs index a2583ff8284..f207f0b3234 100644 --- a/tests/mir-opt/building/match/sort_candidates.rs +++ b/tests/mir-opt/building/match/sort_candidates.rs @@ -1,5 +1,4 @@ // Check specific cases of sorting candidates in match lowering. -#![feature(exclusive_range_pattern)] // EMIT_MIR sort_candidates.constant_eq.SimplifyCfg-initial.after.mir fn constant_eq(s: &str, b: bool) -> u32 { diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index 2a36ccaab11..df873600577 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -11,10 +11,28 @@ + scope 1 (inlined std::ptr::drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) { + let mut _6: &mut std::vec::Vec<A>; + let mut _7: (); ++ scope 2 (inlined <Vec<A> as Drop>::drop) { ++ let mut _8: *mut [A]; ++ let mut _9: *mut A; ++ let mut _10: usize; ++ scope 3 (inlined Vec::<A>::as_mut_ptr) { ++ let mut _11: &alloc::raw_vec::RawVec<A>; ++ scope 4 (inlined alloc::raw_vec::RawVec::<A>::ptr) { ++ let mut _13: std::ptr::NonNull<A>; ++ scope 5 (inlined Unique::<A>::as_ptr) { ++ scope 6 (inlined NonNull::<A>::as_ptr) { ++ let mut _12: *const A; ++ } ++ } ++ } ++ } ++ scope 7 (inlined slice_from_raw_parts_mut::<A>) { ++ } ++ } + } -+ scope 2 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) { -+ let mut _8: isize; -+ let mut _9: isize; ++ scope 8 (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>))) { ++ let mut _14: isize; ++ let mut _15: isize; + } bb0: { @@ -25,7 +43,24 @@ + StorageLive(_6); + StorageLive(_7); + _6 = &mut (*_4); -+ _7 = <Vec<A> as Drop>::drop(move _6) -> [return: bb2, unwind unreachable]; ++ StorageLive(_8); ++ StorageLive(_9); ++ StorageLive(_11); ++ _11 = &((*_6).0: alloc::raw_vec::RawVec<A>); ++ StorageLive(_13); ++ _13 = ((((*_6).0: alloc::raw_vec::RawVec<A>).0: std::ptr::Unique<A>).0: std::ptr::NonNull<A>); ++ StorageLive(_12); ++ _12 = (_13.0: *const A); ++ _9 = move _12 as *mut A (PtrToPtr); ++ StorageDead(_12); ++ StorageDead(_13); ++ StorageDead(_11); ++ StorageLive(_10); ++ _10 = ((*_6).1: usize); ++ _8 = *mut [A] from (_9, _10); ++ StorageDead(_10); ++ StorageDead(_9); ++ _7 = std::ptr::drop_in_place::<[A]>(move _8) -> [return: bb2, unwind unreachable]; } bb1: { @@ -36,19 +71,20 @@ StorageLive(_5); _5 = _2; - _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable]; -+ StorageLive(_8); -+ StorageLive(_9); -+ _8 = discriminant((*_5)); -+ switchInt(move _8) -> [0: bb3, otherwise: bb4]; ++ StorageLive(_14); ++ StorageLive(_15); ++ _14 = discriminant((*_5)); ++ switchInt(move _14) -> [0: bb3, otherwise: bb4]; } bb2: { ++ StorageDead(_8); + drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable]; + } + + bb3: { -+ StorageDead(_9); -+ StorageDead(_8); ++ StorageDead(_15); ++ StorageDead(_14); StorageDead(_5); return; + } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index ef3f4a21720..62fe1a86857 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -4,20 +4,47 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { - let mut _3: *mut [u32]; - let mut _4: *mut [u32]; + let mut _5: *mut [u32]; + let mut _9: *mut [u32]; + scope 2 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { + let _6: usize; + let mut _7: *mut u32; + let mut _8: *mut u32; + scope 3 { + scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { + } + scope 7 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) { + } + scope 8 (inlined slice_from_raw_parts_mut::<u32>) { + } + } + scope 4 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) { + scope 5 (inlined std::ptr::metadata::<[u32]>) { + } + } + } } bb0: { - StorageLive(_3); - _3 = &raw mut (*_1); - _4 = <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut(move _2, move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_3); - _0 = &mut (*_4); + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_6); + _6 = SubUnchecked(_4, _3); + StorageLive(_8); + StorageLive(_7); + _7 = _5 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _3); + StorageDead(_7); + _9 = *mut [u32] from (_8, _6); + StorageDead(_8); + StorageDead(_6); + StorageDead(_5); + _0 = &mut (*_9); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 9e93a43ac72..62fe1a86857 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -4,20 +4,47 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug slice => _1; debug index => _2; let mut _0: &mut [u32]; + let mut _3: usize; + let mut _4: usize; scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { - let mut _3: *mut [u32]; - let mut _4: *mut [u32]; + let mut _5: *mut [u32]; + let mut _9: *mut [u32]; + scope 2 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { + let _6: usize; + let mut _7: *mut u32; + let mut _8: *mut u32; + scope 3 { + scope 6 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { + } + scope 7 (inlined std::ptr::mut_ptr::<impl *mut u32>::add) { + } + scope 8 (inlined slice_from_raw_parts_mut::<u32>) { + } + } + scope 4 (inlined std::ptr::mut_ptr::<impl *mut [u32]>::len) { + scope 5 (inlined std::ptr::metadata::<[u32]>) { + } + } + } } bb0: { - StorageLive(_3); - _3 = &raw mut (*_1); - _4 = <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut(move _2, move _3) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageDead(_3); - _0 = &mut (*_4); + _3 = move (_2.0: usize); + _4 = move (_2.1: usize); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_6); + _6 = SubUnchecked(_4, _3); + StorageLive(_8); + StorageLive(_7); + _7 = _5 as *mut u32 (PtrToPtr); + _8 = Offset(_7, _3); + StorageDead(_7); + _9 = *mut [u32] from (_8, _6); + StorageDead(_8); + StorageDead(_6); + StorageDead(_5); + _0 = &mut (*_9); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir index 018ff6c357d..000432ccca7 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir @@ -17,11 +17,6 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - scope 7 (inlined std::ptr::const_ptr::<impl *const u32>::add) { } scope 8 (inlined slice_from_raw_parts::<u32>) { - let mut _8: *const (); - scope 9 (inlined std::ptr::const_ptr::<impl *const u32>::cast::<()>) { - } - scope 10 (inlined std::ptr::from_raw_parts::<[u32]>) { - } } } scope 4 (inlined std::ptr::const_ptr::<impl *const [u32]>::len) { @@ -41,10 +36,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - _6 = _1 as *const u32 (PtrToPtr); _7 = Offset(_6, _3); StorageDead(_6); - StorageLive(_8); - _8 = _7 as *const () (PtrToPtr); - _0 = *const [u32] from (_8, _5); - StorageDead(_8); + _0 = *const [u32] from (_7, _5); StorageDead(_7); StorageDead(_5); return; diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir index 018ff6c357d..000432ccca7 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir @@ -17,11 +17,6 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - scope 7 (inlined std::ptr::const_ptr::<impl *const u32>::add) { } scope 8 (inlined slice_from_raw_parts::<u32>) { - let mut _8: *const (); - scope 9 (inlined std::ptr::const_ptr::<impl *const u32>::cast::<()>) { - } - scope 10 (inlined std::ptr::from_raw_parts::<[u32]>) { - } } } scope 4 (inlined std::ptr::const_ptr::<impl *const [u32]>::len) { @@ -41,10 +36,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - _6 = _1 as *const u32 (PtrToPtr); _7 = Offset(_6, _3); StorageDead(_6); - StorageLive(_8); - _8 = _7 as *const () (PtrToPtr); - _0 = *const [u32] from (_8, _5); - StorageDead(_8); + _0 = *const [u32] from (_7, _5); StorageDead(_7); StorageDead(_5); return; diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 18728d543ad..eabecaed051 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -25,7 +25,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 6 (inlined std::slice::from_raw_parts::<'_, u8>) { debug data => _4; debug len => _5; - let _7: *const [u8]; + let _6: *const [u8]; scope 7 (inlined core::ub_checks::check_language_ub) { scope 8 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -37,14 +37,6 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 11 (inlined slice_from_raw_parts::<u8>) { debug data => _4; debug len => _5; - let mut _6: *const (); - scope 12 (inlined std::ptr::const_ptr::<impl *const u8>::cast::<()>) { - debug self => _4; - } - scope 13 (inlined std::ptr::from_raw_parts::<[u8]>) { - debug data_pointer => _6; - debug metadata => _5; - } } } } @@ -60,13 +52,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); - StorageLive(_6); - _6 = _4 as *const () (PtrToPtr); - _7 = *const [u8] from (_6, _5); - StorageDead(_6); + _6 = *const [u8] from (_4, _5); StorageDead(_5); StorageDead(_4); - _0 = &(*_7); + _0 = &(*_6); return; } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 18728d543ad..eabecaed051 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -25,7 +25,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 6 (inlined std::slice::from_raw_parts::<'_, u8>) { debug data => _4; debug len => _5; - let _7: *const [u8]; + let _6: *const [u8]; scope 7 (inlined core::ub_checks::check_language_ub) { scope 8 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -37,14 +37,6 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { scope 11 (inlined slice_from_raw_parts::<u8>) { debug data => _4; debug len => _5; - let mut _6: *const (); - scope 12 (inlined std::ptr::const_ptr::<impl *const u8>::cast::<()>) { - debug self => _4; - } - scope 13 (inlined std::ptr::from_raw_parts::<[u8]>) { - debug data_pointer => _6; - debug metadata => _5; - } } } } @@ -60,13 +52,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { StorageDead(_2); StorageLive(_5); _5 = ((*_1).1: usize); - StorageLive(_6); - _6 = _4 as *const () (PtrToPtr); - _7 = *const [u8] from (_6, _5); - StorageDead(_6); + _6 = *const [u8] from (_4, _5); StorageDead(_5); StorageDead(_4); - _0 = &(*_7); + _0 = &(*_6); return; } } diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs index 4b7ce4e57d5..1bdb6347571 100644 --- a/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs +++ b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs @@ -13,7 +13,8 @@ fn main() { let mut stable_path = PathBuf::from(env!("TMPDIR")); stable_path.push("libstable.rmeta"); - let output = rustc().input("main.rs").emit("metadata").extern_("stable", &stable_path).output(); + let output = + rustc().input("main.rs").emit("metadata").extern_("stable", &stable_path).command_output(); let stderr = String::from_utf8_lossy(&output.stderr); let version = include_str!(concat!(env!("S"), "/src/version")); diff --git a/tests/run-make/alloc-no-oom-handling/Makefile b/tests/run-make/alloc-no-oom-handling/Makefile index 87f74c69c79..7c3ae90b58d 100644 --- a/tests/run-make/alloc-no-oom-handling/Makefile +++ b/tests/run-make/alloc-no-oom-handling/Makefile @@ -1,3 +1,6 @@ +# This test checks that alloc can still compile correctly when the unstable no_global_oom_handling feature is turned on. +# See https://github.com/rust-lang/rust/pull/84266 + include ../tools.mk all: diff --git a/tests/run-make/alloc-no-rc/Makefile b/tests/run-make/alloc-no-rc/Makefile index 9824b17e6c2..fcfe1603b6c 100644 --- a/tests/run-make/alloc-no-rc/Makefile +++ b/tests/run-make/alloc-no-rc/Makefile @@ -1,3 +1,6 @@ +# This test checks that alloc can still compile correctly when the unstable no_rc feature is turned on. +# See https://github.com/rust-lang/rust/pull/89891 + include ../tools.mk all: diff --git a/tests/run-make/alloc-no-sync/Makefile b/tests/run-make/alloc-no-sync/Makefile index 04ec4c7d8bc..997dbcf6603 100644 --- a/tests/run-make/alloc-no-sync/Makefile +++ b/tests/run-make/alloc-no-sync/Makefile @@ -1,3 +1,6 @@ +# This test checks that alloc can still compile correctly when the unstable no_sync feature is turned on. +# See https://github.com/rust-lang/rust/pull/89891 + include ../tools.mk all: diff --git a/tests/run-make/allocator-shim-circular-deps/Makefile b/tests/run-make/allocator-shim-circular-deps/Makefile index 4624b846803..f667e2e2ec2 100644 --- a/tests/run-make/allocator-shim-circular-deps/Makefile +++ b/tests/run-make/allocator-shim-circular-deps/Makefile @@ -1,3 +1,8 @@ +# This test is designed to intentionally introduce a circular dependency scenario to check that a specific compiler bug doesn't make a resurgence. +# The bug in question arose when at least one crate required a global allocator, and that crate was placed after the one defining it in the linker order. +# The generated symbols.o should not result in any linker errors. +# See https://github.com/rust-lang/rust/issues/112715 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/archive-duplicate-names/Makefile b/tests/run-make/archive-duplicate-names/Makefile index 5433a42d252..207eee39299 100644 --- a/tests/run-make/archive-duplicate-names/Makefile +++ b/tests/run-make/archive-duplicate-names/Makefile @@ -1,3 +1,7 @@ +# When two object archives with the same filename are present, an iterator is supposed to inspect each object, recognize the duplication and extract each one to a different directory. +# This test checks that this duplicate handling behaviour has not been broken. +# See https://github.com/rust-lang/rust/pull/24439 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/bare-outfile/Makefile b/tests/run-make/bare-outfile/Makefile index 23b619ea0ba..ad6fe4bd167 100644 --- a/tests/run-make/bare-outfile/Makefile +++ b/tests/run-make/bare-outfile/Makefile @@ -1,3 +1,5 @@ +# This test checks that manually setting the output file as a bare file with no file extension still results in successful compilation. + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-dynamic-dylib/Makefile b/tests/run-make/c-dynamic-dylib/Makefile index b5bfbc76539..0d409640486 100644 --- a/tests/run-make/c-dynamic-dylib/Makefile +++ b/tests/run-make/c-dynamic-dylib/Makefile @@ -1,3 +1,6 @@ +# This test checks that dynamic Rust linking with C does not encounter any errors, with dynamic dependencies given preference over static. +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-dynamic-rlib/Makefile b/tests/run-make/c-dynamic-rlib/Makefile index 0475bd8acae..a64e89cc0dc 100644 --- a/tests/run-make/c-dynamic-rlib/Makefile +++ b/tests/run-make/c-dynamic-rlib/Makefile @@ -1,3 +1,6 @@ +# This test checks that dynamic Rust linking with C does not encounter any errors, with static dependencies given preference over dynamic. (This is the default behaviour.) +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-link-to-rust-dylib/Makefile b/tests/run-make/c-link-to-rust-dylib/Makefile index 2763cb6ed1d..201f717ece4 100644 --- a/tests/run-make/c-link-to-rust-dylib/Makefile +++ b/tests/run-make/c-link-to-rust-dylib/Makefile @@ -1,3 +1,6 @@ +# This test checks that C linking with Rust does not encounter any errors, with dynamic libraries. +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-link-to-rust-staticlib/Makefile b/tests/run-make/c-link-to-rust-staticlib/Makefile index e14775f5c18..d36cc421c46 100644 --- a/tests/run-make/c-link-to-rust-staticlib/Makefile +++ b/tests/run-make/c-link-to-rust-staticlib/Makefile @@ -1,3 +1,6 @@ +# This test checks that C linking with Rust does not encounter any errors, with static libraries. +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-static-dylib/Makefile b/tests/run-make/c-static-dylib/Makefile index 4e23edb6c57..05da1743c83 100644 --- a/tests/run-make/c-static-dylib/Makefile +++ b/tests/run-make/c-static-dylib/Makefile @@ -1,3 +1,6 @@ +# This test checks that static Rust linking with C does not encounter any errors, with dynamic dependencies given preference over static. +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-static-rlib/Makefile b/tests/run-make/c-static-rlib/Makefile index 4e351127cb6..298e432cdb8 100644 --- a/tests/run-make/c-static-rlib/Makefile +++ b/tests/run-make/c-static-rlib/Makefile @@ -1,3 +1,6 @@ +# This test checks that static Rust linking with C does not encounter any errors, with static dependencies given preference over dynamic. (This is the default behaviour.) +# See https://github.com/rust-lang/rust/issues/10434 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile index b8e0e9483cd..2bb8d42495d 100644 --- a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile @@ -1,3 +1,6 @@ +# Exercise unwinding a panic. This catches a panic across an FFI boundary and downcasts it into an integer. The Rust code that panics is in a separate crate. +# See https://github.com/rust-lang/rust/commit/baf227ea0c1e07fc54395a51e4b3881d701180cb + # ignore-cross-compile # needs-unwind include ../tools.mk diff --git a/tests/run-make/c-unwind-abi-catch-panic/Makefile b/tests/run-make/c-unwind-abi-catch-panic/Makefile index 1760ddb3061..0a38d838e32 100644 --- a/tests/run-make/c-unwind-abi-catch-panic/Makefile +++ b/tests/run-make/c-unwind-abi-catch-panic/Makefile @@ -1,3 +1,6 @@ +# Exercise unwinding a panic. This catches a panic across an FFI boundary and downcasts it into an integer. The Rust code that panics is in the same directory. +# See https://github.com/rust-lang/rust/commit/baf227ea0c1e07fc54395a51e4b3881d701180cb + # ignore-cross-compile # needs-unwind include ../tools.mk diff --git a/tests/run-make/cat-and-grep-sanity-check/Makefile b/tests/run-make/cat-and-grep-sanity-check/Makefile index 82351e22009..8ee69c0a0de 100644 --- a/tests/run-make/cat-and-grep-sanity-check/Makefile +++ b/tests/run-make/cat-and-grep-sanity-check/Makefile @@ -1,3 +1,7 @@ +# grep in run-make tests was partially replaced with a custom script, CGREP. This tests that CGREP does its job correctly. +# See https://github.com/rust-lang/rust/commit/ab788a2ee175c7560f0ca58bbc183ecfd57d2f7a +# FIXME(Oneirical): Note that this test will likely become useless after the port to rmake.rs tests (see https://github.com/rust-lang/rust/issues/121876) + include ../tools.mk all: diff --git a/tests/run-make/cdylib-dylib-linkage/Makefile b/tests/run-make/cdylib-dylib-linkage/Makefile index 51fbfef2d85..db8393d3c05 100644 --- a/tests/run-make/cdylib-dylib-linkage/Makefile +++ b/tests/run-make/cdylib-dylib-linkage/Makefile @@ -1,3 +1,6 @@ +# This test checks that cdylibs can link against dylibs as dependencies, after this restriction was disabled. +# See https://github.com/rust-lang/rust/commit/72aaa3a414d17aa0c4f19feafa5bab5f84b60e63 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/cdylib-fewer-symbols/Makefile b/tests/run-make/cdylib-fewer-symbols/Makefile index 4e08f979c36..d587cece5be 100644 --- a/tests/run-make/cdylib-fewer-symbols/Makefile +++ b/tests/run-make/cdylib-fewer-symbols/Makefile @@ -1,6 +1,8 @@ # ignore-cross-compile + # Test that allocator-related symbols don't show up as exported from a cdylib as # they're internal to Rust and not part of the public ABI. +# See https://github.com/rust-lang/rust/commit/fbf98697021173a30b84d9145df0966a23a2f9d2 include ../tools.mk diff --git a/tests/run-make/cdylib/Makefile b/tests/run-make/cdylib/Makefile index 3c8b5269554..2c6414c3255 100644 --- a/tests/run-make/cdylib/Makefile +++ b/tests/run-make/cdylib/Makefile @@ -1,3 +1,6 @@ +# When the cdylib crate type was added as a variation of dylib, it needed a test to check its function. +# See https://github.com/rust-lang/rust/pull/33553 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/codegen-options-parsing/Makefile b/tests/run-make/codegen-options-parsing/Makefile index 56bb900b7d8..beaf233502b 100644 --- a/tests/run-make/codegen-options-parsing/Makefile +++ b/tests/run-make/codegen-options-parsing/Makefile @@ -1,3 +1,5 @@ +# This test intentionally feeds invalid inputs to codegen and checks if the error message outputs contain specific helpful indications. + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/comment-section/Makefile b/tests/run-make/comment-section/Makefile index 9f810063cc8..d0b98176ffe 100644 --- a/tests/run-make/comment-section/Makefile +++ b/tests/run-make/comment-section/Makefile @@ -1,3 +1,6 @@ +# Both GCC and Clang write by default a `.comment` section with compiler information. Rustc received a similar .comment section, so this tests checks that this section properly appears. +# See https://github.com/rust-lang/rust/commit/74b8d324eb77a8f337b35dc68ac91b0c2c06debc + include ../tools.mk # only-linux diff --git a/tests/run-make/compile-stdin/Makefile b/tests/run-make/compile-stdin/Makefile index 2a495281c24..b3d7cc777a0 100644 --- a/tests/run-make/compile-stdin/Makefile +++ b/tests/run-make/compile-stdin/Makefile @@ -1,3 +1,6 @@ +# When provided standard input piped directly into rustc, this test checks that the compilation completes successfully and that the output can be executed. +# See https://github.com/rust-lang/rust/pull/28805 + # ignore-cross-compile include ../tools.mk diff --git a/tests/run-make/compiler-lookup-paths-2/Makefile b/tests/run-make/compiler-lookup-paths-2/Makefile index d4ff7d8daab..ecc0577384a 100644 --- a/tests/run-make/compiler-lookup-paths-2/Makefile +++ b/tests/run-make/compiler-lookup-paths-2/Makefile @@ -1,3 +1,6 @@ +# This test checks that extern crate declarations in Cargo without a corresponding declaration in the manifest of a dependency are NOT allowed. +# See https://github.com/rust-lang/rust/pull/21113 + include ../tools.mk all: diff --git a/tests/run-make/compiler-lookup-paths/Makefile b/tests/run-make/compiler-lookup-paths/Makefile index 310d6772c34..fc0cbde4c35 100644 --- a/tests/run-make/compiler-lookup-paths/Makefile +++ b/tests/run-make/compiler-lookup-paths/Makefile @@ -1,3 +1,6 @@ +# rustc supports different types of lookup paths, such as dependency, native or crate. This test checks that these lookup paths are functional and result in functional compilation. +# See https://github.com/rust-lang/rust/pull/19941 + include ../tools.mk # ignore-wasm32 (need a C compiler) diff --git a/tests/run-make/doctests-runtool/Makefile b/tests/run-make/doctests-runtool/Makefile deleted file mode 100644 index 7d5df1e307f..00000000000 --- a/tests/run-make/doctests-runtool/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Tests behavior of rustdoc --runtool - -MY_SRC_DIR := ${CURDIR} - -all: with_test_run_directory - -# Behavior with --runtool with relative paths and --test-run-directory. -with_test_run_directory: - mkdir -p $(TMPDIR)/rundir - mkdir -p $(TMPDIR)/runtool - $(RUSTC) --crate-type rlib t.rs - $(RUSTC) runtool.rs -o $(TMPDIR)/runtool/runtool - ( cd $(TMPDIR); \ - $(RUSTDOC) -Zunstable-options --test --test-run-directory rundir \ - --runtool runtool/runtool --extern t=libt.rlib $(MY_SRC_DIR)/t.rs \ - ) - rm -rf $(TMPDIR)/rundir $(TMPDIR)/runtool diff --git a/tests/run-make/doctests-runtool/rmake.rs b/tests/run-make/doctests-runtool/rmake.rs new file mode 100644 index 00000000000..6f89bf23b47 --- /dev/null +++ b/tests/run-make/doctests-runtool/rmake.rs @@ -0,0 +1,39 @@ +// Tests behavior of rustdoc `--runtool`. + +use run_make_support::{rustc, rustdoc, tmp_dir}; +use std::env::current_dir; +use std::fs::{create_dir, remove_dir_all}; +use std::path::PathBuf; + +fn mkdir(name: &str) -> PathBuf { + let dir = tmp_dir().join(name); + create_dir(&dir).expect("failed to create doctests folder"); + dir +} + +// Behavior with --runtool with relative paths and --test-run-directory. +fn main() { + let run_dir_name = "rundir"; + let run_dir = mkdir(run_dir_name); + let run_tool = mkdir("runtool"); + let run_tool_binary = run_tool.join("runtool"); + + rustc().input("t.rs").crate_type("rlib").run(); + rustc().input("runtool.rs").output(&run_tool_binary).run(); + + rustdoc() + .input(current_dir().unwrap().join("t.rs")) + .arg("-Zunstable-options") + .arg("--test") + .arg("--test-run-directory") + .arg(run_dir_name) + .arg("--runtool") + .arg(&run_tool_binary) + .arg("--extern") + .arg("t=libt.rlib") + .current_dir(tmp_dir()) + .run(); + + remove_dir_all(run_dir); + remove_dir_all(run_tool); +} diff --git a/tests/run-make/exit-code/rmake.rs b/tests/run-make/exit-code/rmake.rs index b1143153d0a..76d7777581b 100644 --- a/tests/run-make/exit-code/rmake.rs +++ b/tests/run-make/exit-code/rmake.rs @@ -15,7 +15,7 @@ fn main() { .arg("compile-error.rs") .run_fail_assert_exit_code(101); - rustdoc().arg("success.rs").arg("-o").arg(tmp_dir().join("exit-code")).run(); + rustdoc().arg("success.rs").output(tmp_dir().join("exit-code")).run(); rustdoc().arg("--invalid-arg-foo").run_fail_assert_exit_code(1); diff --git a/tests/run-make/libtest-padding/Makefile b/tests/run-make/libtest-padding/Makefile index 42bc1192925..c8e2fc01f67 100644 --- a/tests/run-make/libtest-padding/Makefile +++ b/tests/run-make/libtest-padding/Makefile @@ -2,7 +2,7 @@ # needs-unwind because #[bench] and -Cpanic=abort requires -Zpanic-abort-tests include ../tools.mk -NORMALIZE=sed 's%[0-9,]\{1,\} ns/iter (+/- [0-9,]\{1,\})%?? ns/iter (+/- ??)%' | sed 's%finished in [0-9\.]\{1,\}%finished in ??%' +NORMALIZE=sed 's%[0-9,\.]\{1,\} ns/iter (+/- [0-9,\.]\{1,\})%?? ns/iter (+/- ??)%' | sed 's%finished in [0-9\.]\{1,\}%finished in ??%' all: $(RUSTC) --test tests.rs diff --git a/tests/run-make/repr128-dwarf/rmake.rs b/tests/run-make/repr128-dwarf/rmake.rs index d734b2add79..fd5dd810444 100644 --- a/tests/run-make/repr128-dwarf/rmake.rs +++ b/tests/run-make/repr128-dwarf/rmake.rs @@ -10,7 +10,7 @@ use std::rc::Rc; fn main() { let output = tmp_dir().join("repr128"); - rustc().input("main.rs").arg("-o").arg(&output).arg("-Cdebuginfo=2").run(); + rustc().input("main.rs").output(&output).arg("-Cdebuginfo=2").run(); // Mach-O uses packed debug info let dsym_location = output .with_extension("dSYM") diff --git a/tests/run-make/rustdoc-determinism/rmake.rs b/tests/run-make/rustdoc-determinism/rmake.rs index 38ae75199fd..09097d4507d 100644 --- a/tests/run-make/rustdoc-determinism/rmake.rs +++ b/tests/run-make/rustdoc-determinism/rmake.rs @@ -1,18 +1,19 @@ -use run_make_support::{diff, rustc, rustdoc, tmp_dir}; +// Assert that the search index is generated deterministically, regardless of the +// order that crates are documented in. + +use run_make_support::{diff, rustdoc, tmp_dir}; -/// Assert that the search index is generated deterministically, regardless of the -/// order that crates are documented in. fn main() { - let dir_first = tmp_dir().join("first"); - rustdoc().out_dir(&dir_first).input("foo.rs").run(); - rustdoc().out_dir(&dir_first).input("bar.rs").run(); + let foo_first = tmp_dir().join("foo_first"); + rustdoc().input("foo.rs").output(&foo_first).run(); + rustdoc().input("bar.rs").output(&foo_first).run(); - let dir_second = tmp_dir().join("second"); - rustdoc().out_dir(&dir_second).input("bar.rs").run(); - rustdoc().out_dir(&dir_second).input("foo.rs").run(); + let bar_first = tmp_dir().join("bar_first"); + rustdoc().input("bar.rs").output(&bar_first).run(); + rustdoc().input("foo.rs").output(&bar_first).run(); diff() - .expected_file(dir_first.join("search-index.js")) - .actual_file(dir_second.join("search-index.js")) + .expected_file(foo_first.join("search-index.js")) + .actual_file(bar_first.join("search-index.js")) .run(); } diff --git a/tests/run-make/rustdoc-error-lines/Makefile b/tests/run-make/rustdoc-error-lines/Makefile deleted file mode 100644 index 2dc30f56b83..00000000000 --- a/tests/run-make/rustdoc-error-lines/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true - $(CGREP) 'input.rs - foo (line 5)' < $(TMPDIR)/output - $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 15)' < $(TMPDIR)/output - $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 24)' < $(TMPDIR)/output - $(CGREP) 'input.rs:26:15' < $(TMPDIR)/output diff --git a/tests/run-make/rustdoc-error-lines/rmake.rs b/tests/run-make/rustdoc-error-lines/rmake.rs new file mode 100644 index 00000000000..31536c78dd4 --- /dev/null +++ b/tests/run-make/rustdoc-error-lines/rmake.rs @@ -0,0 +1,22 @@ +// Assert that the search index is generated deterministically, regardless of the +// order that crates are documented in. + +use run_make_support::rustdoc; + +fn main() { + let output = + String::from_utf8(rustdoc().input("input.rs").arg("--test").command_output().stdout) + .unwrap(); + + let should_contain = &[ + "input.rs - foo (line 5)", + "input.rs:7:15", + "input.rs - bar (line 15)", + "input.rs:17:15", + "input.rs - bar (line 24)", + "input.rs:26:15", + ]; + for text in should_contain { + assert!(output.contains(text), "output doesn't contains {:?}", text); + } +} diff --git a/tests/run-make/rustdoc-map-file/Makefile b/tests/run-make/rustdoc-map-file/Makefile deleted file mode 100644 index 5cbf7747af6..00000000000 --- a/tests/run-make/rustdoc-map-file/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -Z unstable-options --generate-redirect-map foo.rs -o "$(TMPDIR)/out" - "$(PYTHON)" validate_json.py "$(TMPDIR)/out" diff --git a/tests/run-make/rustdoc-map-file/rmake.rs b/tests/run-make/rustdoc-map-file/rmake.rs new file mode 100644 index 00000000000..aaa7fea0b6b --- /dev/null +++ b/tests/run-make/rustdoc-map-file/rmake.rs @@ -0,0 +1,15 @@ +use run_make_support::{rustdoc, tmp_dir}; +use std::process::Command; + +fn main() { + let out_dir = tmp_dir().join("out"); + rustdoc() + .input("foo.rs") + .arg("-Zunstable-options") + .arg("--generate-redirect-map") + .output(&out_dir) + .run(); + // FIXME (GuillaumeGomez): Port the python script to Rust as well. + let python = std::env::var("PYTHON").unwrap_or("python".into()); + assert!(Command::new(python).arg("validate_json.py").arg(&out_dir).status().unwrap().success()); +} diff --git a/tests/run-make/rustdoc-output-path/Makefile b/tests/run-make/rustdoc-output-path/Makefile deleted file mode 100644 index 8f5cda9e56e..00000000000 --- a/tests/run-make/rustdoc-output-path/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -o "$(TMPDIR)/foo/bar/doc" foo.rs diff --git a/tests/run-make/rustdoc-output-path/rmake.rs b/tests/run-make/rustdoc-output-path/rmake.rs new file mode 100644 index 00000000000..74fb0a56ac6 --- /dev/null +++ b/tests/run-make/rustdoc-output-path/rmake.rs @@ -0,0 +1,9 @@ +// Checks that if the output folder doesn't exist, rustdoc will create it. + +use run_make_support::{rustdoc, tmp_dir}; + +fn main() { + let out_dir = tmp_dir().join("foo/bar/doc"); + rustdoc().input("foo.rs").output(&out_dir).run(); + assert!(out_dir.exists()); +} diff --git a/tests/rustdoc-gui/javascript-disabled.goml b/tests/rustdoc-gui/javascript-disabled.goml index a7579ef7ec1..c6a7ad94b3f 100644 --- a/tests/rustdoc-gui/javascript-disabled.goml +++ b/tests/rustdoc-gui/javascript-disabled.goml @@ -4,7 +4,7 @@ javascript: false go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" show-text: true -assert-css: (".sub", {"display": "none"}) +assert-false: ".sub" // Even though JS is disabled, we should still have themes applied. Links are never black-colored // if styles are applied so we check that they are not. diff --git a/tests/rustdoc-gui/settings-button.goml b/tests/rustdoc-gui/settings-button.goml new file mode 100644 index 00000000000..c38a537e047 --- /dev/null +++ b/tests/rustdoc-gui/settings-button.goml @@ -0,0 +1,31 @@ +// This test ensures that the icon of the settings button looks as expected on +// all themes. +include: "utils.goml" +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +show-text: true + +define-function: ( + "check-image", + [theme, filter], + block { + call-function: ("switch-theme", {"theme": |theme|}) + assert-css: ("#settings-menu > a::before", { + "filter": |filter|, + "width": "22px", + "height": "22px", + }) + } +) + +call-function: ("check-image", { + "theme": "ayu", + "filter": "invert(1)", +}) +call-function: ("check-image", { + "theme": "dark", + "filter": "none", +}) +call-function: ("check-image", { + "theme": "light", + "filter": "none", +}) diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index 0011e44ca59..3f4f2946bf5 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -1,6 +1,5 @@ // This test ensures that the settings menu display is working as expected and that // the settings page is also rendered as expected. -include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true // needed when we check for colors below. // First, we check that the settings page doesn't exist. diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 3bfbe820b8d..7ce3be8a5b3 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -4,7 +4,7 @@ javascript: false go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // Since the javascript is disabled, there shouldn't be a toggle. wait-for-css: (".sidebar", {"display": "none"}) -assert-css: ("#sidebar-button", {"display": "none"}) +assert-false: "#sidebar-button" // Let's retry with javascript enabled. javascript: true diff --git a/tests/rustdoc-gui/src/theme_css/custom-theme.css b/tests/rustdoc-gui/src/theme_css/custom-theme.css index b7f89d4cf15..a56c31ab9d2 100644 --- a/tests/rustdoc-gui/src/theme_css/custom-theme.css +++ b/tests/rustdoc-gui/src/theme_css/custom-theme.css @@ -49,6 +49,7 @@ --search-tab-button-not-selected-background: #e6e6e6; --search-tab-button-selected-border-top-color: #0089ff; --search-tab-button-selected-background: #fff; + --settings-menu-filter: none; --stab-background-color: #fff5d6; --stab-code-color: #000; --code-highlight-kw-color: #8959a8; diff --git a/tests/rustdoc-js-std/parser-reference.js b/tests/rustdoc-js-std/parser-reference.js new file mode 100644 index 00000000000..6b1250146be --- /dev/null +++ b/tests/rustdoc-js-std/parser-reference.js @@ -0,0 +1,527 @@ +const PARSED = [ + { + query: '&[', + elems: [], + foundElems: 0, + original: '&[', + returned: [], + userQuery: '&[', + error: 'Unclosed `[`', + }, + { + query: '[&', + elems: [], + foundElems: 0, + original: '[&', + returned: [], + userQuery: '[&', + error: 'Unclosed `[`', + }, + { + query: '&&&D, []', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "d", + fullPath: ["d"], + pathWithoutLast: [], + pathLast: "d", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: 1, + }, + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [], + typeFilter: 1, + }, + ], + foundElems: 2, + original: '&&&D, []', + returned: [], + userQuery: '&&&d, []', + error: null, + }, + { + query: '&&&[D]', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "d", + fullPath: ["d"], + pathWithoutLast: [], + pathLast: "d", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: '&&&[D]', + returned: [], + userQuery: '&&&[d]', + error: null, + }, + { + query: '&', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [], + typeFilter: 1, + }, + ], + foundElems: 1, + original: '&', + returned: [], + userQuery: '&', + error: null, + }, + { + query: '&mut', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "mut", + fullPath: ["mut"], + pathWithoutLast: [], + pathLast: "mut", + generics: [], + typeFilter: 0, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: '&mut', + returned: [], + userQuery: '&mut', + error: null, + }, + { + query: '&,u8', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [], + typeFilter: 1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "&,u8", + returned: [], + userQuery: "&,u8", + error: null, + }, + { + query: '&mut,u8', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "mut", + fullPath: ["mut"], + pathWithoutLast: [], + pathLast: "mut", + generics: [], + typeFilter: 0, + }, + ], + typeFilter: 1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "&mut,u8", + returned: [], + userQuery: "&mut,u8", + error: null, + }, + { + query: '&u8', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "&u8", + returned: [], + userQuery: "&u8", + error: null, + }, + { + query: '&u8<u8>', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "&u8<u8>", + returned: [], + userQuery: "&u8<u8>", + error: null, + }, + { + query: 'u8<&u8>', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "u8<&u8>", + returned: [], + userQuery: "u8<&u8>", + error: null, + }, + { + query: 'u8<&u8, u8>', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "u8<&u8, u8>", + returned: [], + userQuery: "u8<&u8, u8>", + error: null, + }, + { + query: 'u8<&u8>', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "u8<&u8>", + returned: [], + userQuery: "u8<&u8>", + error: null, + }, + { + query: 'u8<&mut u8, u8>', + elems: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "mut", + fullPath: ["mut"], + pathWithoutLast: [], + pathLast: "mut", + generics: [], + typeFilter: 0, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "u8<&mut u8, u8>", + returned: [], + userQuery: "u8<&mut u8, u8>", + error: null, + }, + { + query: 'primitive:&u8', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "primitive:&u8", + returned: [], + userQuery: "primitive:&u8", + error: null, + }, + { + query: 'macro:&u8', + elems: [], + foundElems: 0, + original: "macro:&u8", + returned: [], + userQuery: "macro:&u8", + error: "Invalid search type: primitive `&` and `macro` both specified", + }, + { + query: '¯o:u8', + elems: [ + { + name: "reference", + fullPath: ["reference"], + pathWithoutLast: [], + pathLast: "reference", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: 16, + }, + ], + typeFilter: 1, + }, + ], + foundElems: 1, + original: "¯o:u8", + returned: [], + userQuery: "¯o:u8", + error: null, + }, +]; diff --git a/tests/rustdoc-js/reference.js b/tests/rustdoc-js/reference.js new file mode 100644 index 00000000000..b4a1fb15d36 --- /dev/null +++ b/tests/rustdoc-js/reference.js @@ -0,0 +1,236 @@ +// exact-check + +const EXPECTED = [ + // pinkie with explicit names + { + 'query': 'usize, usize -> ()', + 'others': [ + { 'path': 'reference', 'name': 'pinky' }, + ], + }, + { + 'query': 'reference<usize>, usize -> ()', + 'others': [ + { 'path': 'reference', 'name': 'pinky' }, + ], + }, + { + 'query': 'reference<usize>, reference<usize> -> ()', + 'others': [], + }, + { + 'query': 'reference<mut, usize>, usize -> ()', + 'others': [], + }, + // thumb with explicit names + { + 'query': 'thumb, thumb -> ()', + 'others': [ + { 'path': 'reference::Thumb', 'name': 'up' }, + ], + }, + { + 'query': 'reference<thumb>, thumb -> ()', + 'others': [ + { 'path': 'reference::Thumb', 'name': 'up' }, + ], + }, + { + 'query': 'reference<thumb>, reference<thumb> -> ()', + 'others': [], + }, + { + 'query': 'reference<mut, thumb>, thumb -> ()', + 'others': [], + }, + // index with explicit names + { + 'query': 'index, index -> ()', + 'others': [ + { 'path': 'reference::Index', 'name': 'point' }, + ], + }, + { + 'query': 'reference<index>, index -> ()', + 'others': [ + { 'path': 'reference::Index', 'name': 'point' }, + ], + }, + { + 'query': 'reference<index>, reference<index> -> ()', + 'others': [], + }, + { + 'query': 'reference<mut, index>, index -> ()', + 'others': [], + }, + // ring with explicit names + { + 'query': 'ring, ring -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'reference<ring>, ring -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'reference<ring>, reference<ring> -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'reference<mut, ring>, reference<ring> -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': 'reference<mut, ring>, reference<mut, ring> -> ()', + 'others': [], + }, + // middle with explicit names + { + 'query': 'middle, middle -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': 'reference<middle>, reference<middle> -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': 'reference<mut, middle>, reference<mut, middle> -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': 'reference<reference<mut, middle>>, reference<mut, reference<middle>> -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': 'reference<mut, reference<middle>>, reference<reference<mut, middle>> -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': 'reference<reference<mut, middle>>, reference<reference<mut, middle>> -> ()', + 'others': [], + }, + { + 'query': 'reference<mut, reference<middle>>, reference<mut, reference<middle>> -> ()', + 'others': [], + }, + // pinkie with shorthand + { + 'query': '&usize, usize -> ()', + 'others': [ + { 'path': 'reference', 'name': 'pinky' }, + ], + }, + { + 'query': '&usize, &usize -> ()', + 'others': [], + }, + { + 'query': '&mut usize, usize -> ()', + 'others': [], + }, + // thumb with shorthand + { + 'query': '&thumb, thumb -> ()', + 'others': [ + { 'path': 'reference::Thumb', 'name': 'up' }, + ], + }, + { + 'query': '&thumb, &thumb -> ()', + 'others': [], + }, + { + 'query': '&mut thumb, thumb -> ()', + 'others': [], + }, + // index with explicit names + { + 'query': '&index, index -> ()', + 'others': [ + { 'path': 'reference::Index', 'name': 'point' }, + ], + }, + { + 'query': '&index, &index -> ()', + 'others': [], + }, + { + 'query': '&mut index, index -> ()', + 'others': [], + }, + // ring with shorthand + { + 'query': '&ring, ring -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '&ring, ring -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '&mut ring, &ring -> ()', + 'others': [ + { 'path': 'reference::Ring', 'name': 'wear' }, + ], + }, + { + 'query': '&mut ring, &mut ring -> ()', + 'others': [], + }, + // middle with shorthand + { + 'query': '&middle, &middle -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': '&mut middle, &mut middle -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': '&&mut middle, &mut &middle -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': '&mut &middle, &&mut middle -> ()', + 'others': [ + { 'path': 'reference', 'name': 'show' }, + ], + }, + { + 'query': '&&mut middle, &&mut middle -> ()', + 'others': [], + }, + { + 'query': '&mut &middle, &mut &middle -> ()', + 'others': [], + }, +]; diff --git a/tests/rustdoc-js/reference.rs b/tests/rustdoc-js/reference.rs new file mode 100644 index 00000000000..3a0a23c65d5 --- /dev/null +++ b/tests/rustdoc-js/reference.rs @@ -0,0 +1,32 @@ +#![feature(extern_types)] + +pub fn pinky(input: &usize, manage: usize) { + unimplemented!() +} + +pub struct Thumb; + +impl Thumb { + pub fn up(&self, finger: Thumb) { unimplemented!() } +} + +pub enum Index {} + +impl Index { + pub fn point(self, data: &Index) { unimplemented!() } +} + +pub union Ring { + magic: u32, + marriage: f32, +} + +impl Ring { + pub fn wear(&mut self, extra: &Ring) { unimplemented!() } +} + +extern "C" { + pub type Middle; +} + +pub fn show(left: &&mut Middle, right: &mut &Middle) { unimplemented!() } diff --git a/tests/rustdoc/inline_cross/issue-76736-2.rs b/tests/rustdoc/inline_cross/issue-76736-2.rs index 83529dd1887..d4e6a697fc8 100644 --- a/tests/rustdoc/inline_cross/issue-76736-2.rs +++ b/tests/rustdoc/inline_cross/issue-76736-2.rs @@ -1,6 +1,8 @@ //@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs +// https://github.com/rust-lang/rust/issues/124635 + #![crate_name = "foo"] #![feature(rustc_private)] @@ -8,9 +10,9 @@ extern crate issue_76736_1; extern crate issue_76736_2; // @has foo/struct.Foo.html -// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' pub struct Foo; // @has foo/struct.Bar.html -// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' +// @!has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' pub use issue_76736_2::Bar; diff --git a/tests/rustdoc/inline_cross/issue-76736-4.rs b/tests/rustdoc/inline_cross/issue-76736-4.rs new file mode 100644 index 00000000000..297657ef9de --- /dev/null +++ b/tests/rustdoc/inline_cross/issue-76736-4.rs @@ -0,0 +1,19 @@ +//@ aux-build:issue-76736-1.rs +//@ aux-build:issue-76736-2.rs + +// https://github.com/rust-lang/rust/issues/124635 + +#![crate_name = "foo"] +#![feature(rustc_private, staged_api)] +#![unstable(feature = "rustc_private", issue = "none")] + +extern crate issue_76736_1; +extern crate issue_76736_2; + +// @has foo/struct.Foo.html +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' +pub struct Foo; + +// @has foo/struct.Bar.html +// @has - '//*[@class="impl"]//h3[@class="code-header"]' 'MaybeResult' +pub use issue_76736_2::Bar; diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs index 475a69f4ad0..2b1fec94387 100644 --- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs @@ -180,7 +180,10 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { 18 => { let pat = P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: DUMMY_SP, tokens: None }); - iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP, None))) + iter_exprs( + depth - 1, + &mut |e| g(ExprKind::Let(pat.clone(), e, DUMMY_SP, Recovered::No)) + ) } _ => panic!("bad counter value in iter_exprs"), } diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 74801e007c4..359dd4146ba 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -99,7 +99,7 @@ fn check_result(abi: &ArgAbi) { assert_matches!(layout.variants, VariantsShape::Multiple { .. }) } -/// Check the niche information about: `NonZeroU8` +/// Checks the niche information about `NonZero<u8>`. fn check_niche(abi: &ArgAbi) { assert!(abi.ty.kind().is_struct()); assert_matches!(abi.mode, PassMode::Direct { .. }); @@ -150,12 +150,12 @@ fn generate_input(path: &str) -> std::io::Result<()> { #![feature(c_variadic)] #![allow(unused_variables)] - use std::num::NonZeroU8; + use std::num::NonZero; pub fn fn_abi( ignore: [u8; 0], primitive: char, - niche: NonZeroU8, + niche: NonZero<u8>, ) -> Result<usize, &'static str> {{ // We only care about the signature. todo!() diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr index 00fc7d1ece1..7365839da89 100644 --- a/tests/ui/abi/debug.stderr +++ b/tests/ui/abi/debug.stderr @@ -576,7 +576,9 @@ error: ABIs are not compatible }, abi: Scalar( Initialized { - value: F32, + value: Float( + F32, + ), valid_range: $FULL, }, ), diff --git a/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr b/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr new file mode 100644 index 00000000000..9082044fe06 --- /dev/null +++ b/tests/ui/associated-types/bound-lifetime-constrained.ok.stderr @@ -0,0 +1,8 @@ +error: fatal error triggered by #[rustc_error] + --> $DIR/bound-lifetime-constrained.rs:48:1 + | +LL | fn main() { } + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/associated-types/bound-lifetime-constrained.rs b/tests/ui/associated-types/bound-lifetime-constrained.rs index 880d350bdf6..1dc3b2f5c2b 100644 --- a/tests/ui/associated-types/bound-lifetime-constrained.rs +++ b/tests/ui/associated-types/bound-lifetime-constrained.rs @@ -1,4 +1,4 @@ -//@ revisions: func object clause +//@ revisions: func object clause ok #![allow(dead_code)] #![feature(rustc_attrs)] diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.rs b/tests/ui/async-await/async-block-control-flow-static-semantics.rs index 0ef7cb7574a..6e04c535cf1 100644 --- a/tests/ui/async-await/async-block-control-flow-static-semantics.rs +++ b/tests/ui/async-await/async-block-control-flow-static-semantics.rs @@ -29,14 +29,14 @@ async fn return_targets_async_block_not_async_fn() -> u8 { fn no_break_in_async_block() { async { - break 0u8; //~ ERROR `break` inside of an `async` block + break 0u8; //~ ERROR `break` inside `async` block }; } fn no_break_in_async_block_even_with_outer_loop() { loop { async { - break 0u8; //~ ERROR `break` inside of an `async` block + break 0u8; //~ ERROR `break` inside `async` block }; } } diff --git a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr index c89671cc481..ce0d003f014 100644 --- a/tests/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/tests/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -1,18 +1,18 @@ -error[E0267]: `break` inside of an `async` block +error[E0267]: `break` inside `async` block --> $DIR/async-block-control-flow-static-semantics.rs:32:9 | LL | / async { LL | | break 0u8; - | | ^^^^^^^^^ cannot `break` inside of an `async` block + | | ^^^^^^^^^ cannot `break` inside `async` block LL | | }; | |_____- enclosing `async` block -error[E0267]: `break` inside of an `async` block +error[E0267]: `break` inside `async` block --> $DIR/async-block-control-flow-static-semantics.rs:39:13 | LL | / async { LL | | break 0u8; - | | ^^^^^^^^^ cannot `break` inside of an `async` block + | | ^^^^^^^^^ cannot `break` inside `async` block LL | | }; | |_________- enclosing `async` block diff --git a/tests/ui/attributes/nonterminal-expansion.rs b/tests/ui/attributes/nonterminal-expansion.rs index 6db7aea0745..1b2e92a3170 100644 --- a/tests/ui/attributes/nonterminal-expansion.rs +++ b/tests/ui/attributes/nonterminal-expansion.rs @@ -5,7 +5,7 @@ macro_rules! pass_nonterminal { ($n:expr) => { #[repr(align($n))] - //~^ ERROR expected unsuffixed literal or identifier, found `n!()` + //~^ ERROR expected unsuffixed literal, found `n!()` struct S; }; } diff --git a/tests/ui/attributes/nonterminal-expansion.stderr b/tests/ui/attributes/nonterminal-expansion.stderr index 78541495b32..b640575d17d 100644 --- a/tests/ui/attributes/nonterminal-expansion.stderr +++ b/tests/ui/attributes/nonterminal-expansion.stderr @@ -1,4 +1,4 @@ -error: expected unsuffixed literal or identifier, found `n!()` +error: expected unsuffixed literal, found `n!()` --> $DIR/nonterminal-expansion.rs:7:22 | LL | #[repr(align($n))] diff --git a/tests/ui/binding/match-range.rs b/tests/ui/binding/match-range.rs index a024e5e585a..097ccb34f87 100644 --- a/tests/ui/binding/match-range.rs +++ b/tests/ui/binding/match-range.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(exclusive_range_pattern)] pub fn main() { match 5_usize { diff --git a/tests/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr b/tests/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr index aacf178932e..6cd64c58cab 100644 --- a/tests/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr +++ b/tests/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:28:15 + --> $DIR/two-phase-activation-sharing-interference.rs:29:15 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -10,7 +10,7 @@ LL | *y += 1; | ------- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:36:13 + --> $DIR/two-phase-activation-sharing-interference.rs:37:13 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -32,7 +32,7 @@ LL | *y += 1; | ------- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:58:14 + --> $DIR/two-phase-activation-sharing-interference.rs:56:14 | LL | let y = &mut x; | ------ mutable borrow occurs here diff --git a/tests/ui/borrowck/two-phase-activation-sharing-interference.rs b/tests/ui/borrowck/two-phase-activation-sharing-interference.rs index beee9916fca..1b4526a13a8 100644 --- a/tests/ui/borrowck/two-phase-activation-sharing-interference.rs +++ b/tests/ui/borrowck/two-phase-activation-sharing-interference.rs @@ -1,6 +1,7 @@ //@ revisions: nll_target // The following revisions are disabled due to missing support from two-phase beyond autorefs +//@ unused-revision-names: nll_beyond //@[nll_beyond] compile-flags: -Z two-phase-beyond-autoref // This is an important corner case pointed out by Niko: one is @@ -36,8 +37,7 @@ fn not_ok() { let z = &x; //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable *y += 1; - //[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable - //[nll_beyond]~^^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + //[nll_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable read(z); } @@ -48,8 +48,6 @@ fn should_be_ok_with_nll() { //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable read(z); *y += 1; - //[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable - // (okay with (generalized) nll today) } fn should_also_eventually_be_ok_with_nll() { @@ -58,8 +56,6 @@ fn should_also_eventually_be_ok_with_nll() { let _z = &x; //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable *y += 1; - //[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable - // (okay with (generalized) nll today) } fn main() { } diff --git a/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr index 1356c80493c..b7a1de02a4f 100644 --- a/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr +++ b/tests/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `i` because it was mutably borrowed - --> $DIR/two-phase-allow-access-during-reservation.rs:26:19 + --> $DIR/two-phase-allow-access-during-reservation.rs:27:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ `i` is borrowed here @@ -11,7 +11,7 @@ LL | /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p` | ------- borrow later used here error[E0503]: cannot use `i` because it was mutably borrowed - --> $DIR/two-phase-allow-access-during-reservation.rs:31:19 + --> $DIR/two-phase-allow-access-during-reservation.rs:32:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ `i` is borrowed here diff --git a/tests/ui/borrowck/two-phase-allow-access-during-reservation.rs b/tests/ui/borrowck/two-phase-allow-access-during-reservation.rs index e6b2501c1eb..6b5a2f5e623 100644 --- a/tests/ui/borrowck/two-phase-allow-access-during-reservation.rs +++ b/tests/ui/borrowck/two-phase-allow-access-during-reservation.rs @@ -1,6 +1,7 @@ //@ revisions: nll_target // The following revisions are disabled due to missing support for two_phase_beyond_autoref +//@ unused-revision-names: nll_beyond //@[nll_beyond] compile-flags: -Z two_phase_beyond_autoref // This is the second counter-example from Niko's blog post diff --git a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr index e122977b9f2..c9d49b8756d 100644 --- a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr +++ b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:50:11 + --> $DIR/two-phase-nonrecv-autoref.rs:51:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -8,7 +8,7 @@ LL | f(f(10)); | first borrow later used by call error[E0382]: use of moved value: `f` - --> $DIR/two-phase-nonrecv-autoref.rs:57:11 + --> $DIR/two-phase-nonrecv-autoref.rs:58:11 | LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) { | - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait @@ -18,7 +18,7 @@ LL | f(f(10)); | value moved here error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:62:11 + --> $DIR/two-phase-nonrecv-autoref.rs:63:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -27,7 +27,7 @@ LL | f(f(10)); | first borrow later used by call error[E0382]: use of moved value: `f` - --> $DIR/two-phase-nonrecv-autoref.rs:69:11 + --> $DIR/two-phase-nonrecv-autoref.rs:70:11 | LL | fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) { | - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait @@ -37,7 +37,7 @@ LL | f(f(10)); | value moved here error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:107:27 + --> $DIR/two-phase-nonrecv-autoref.rs:108:27 | LL | double_access(&mut a, &a); | ------------- ------ ^^ immutable borrow occurs here @@ -46,7 +46,7 @@ LL | double_access(&mut a, &a); | mutable borrow later used by call error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:132:7 + --> $DIR/two-phase-nonrecv-autoref.rs:133:7 | LL | i[i[3]] = 4; | --^---- @@ -56,18 +56,18 @@ LL | i[i[3]] = 4; | mutable borrow occurs here | help: try adding a local storing this... - --> $DIR/two-phase-nonrecv-autoref.rs:132:8 + --> $DIR/two-phase-nonrecv-autoref.rs:133:8 | LL | i[i[3]] = 4; | ^^^ help: ...and then using that local here - --> $DIR/two-phase-nonrecv-autoref.rs:132:6 + --> $DIR/two-phase-nonrecv-autoref.rs:133:6 | LL | i[i[3]] = 4; | ^^^^^^ error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:138:7 + --> $DIR/two-phase-nonrecv-autoref.rs:139:7 | LL | i[i[3]] = i[4]; | --^---- @@ -77,12 +77,12 @@ LL | i[i[3]] = i[4]; | mutable borrow occurs here | help: try adding a local storing this... - --> $DIR/two-phase-nonrecv-autoref.rs:138:8 + --> $DIR/two-phase-nonrecv-autoref.rs:139:8 | LL | i[i[3]] = i[4]; | ^^^ help: ...and then using that local here - --> $DIR/two-phase-nonrecv-autoref.rs:138:6 + --> $DIR/two-phase-nonrecv-autoref.rs:139:6 | LL | i[i[3]] = i[4]; | ^^^^^^ diff --git a/tests/ui/borrowck/two-phase-nonrecv-autoref.rs b/tests/ui/borrowck/two-phase-nonrecv-autoref.rs index f52e9c2e3fd..3a8ab4ef3b0 100644 --- a/tests/ui/borrowck/two-phase-nonrecv-autoref.rs +++ b/tests/ui/borrowck/two-phase-nonrecv-autoref.rs @@ -1,5 +1,6 @@ //@ revisions: base +//@ unused-revision-names: g2p //@[g2p]compile-flags: -Z two-phase-beyond-autoref // the above revision is disabled until two-phase-beyond-autoref support is better diff --git a/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr b/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr index b1e4392989f..5eda4828012 100644 --- a/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr +++ b/tests/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-reservation-sharing-interference.rs:32:17 + --> $DIR/two-phase-reservation-sharing-interference.rs:33:17 | LL | let shared = &vec; | ---- immutable borrow occurs here diff --git a/tests/ui/borrowck/two-phase-reservation-sharing-interference.rs b/tests/ui/borrowck/two-phase-reservation-sharing-interference.rs index b6bcf7b6617..61446577db2 100644 --- a/tests/ui/borrowck/two-phase-reservation-sharing-interference.rs +++ b/tests/ui/borrowck/two-phase-reservation-sharing-interference.rs @@ -1,6 +1,7 @@ //@ revisions: nll_target // The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs +//@ unused-revision-names: nll_beyond //@[nll_beyond]compile-flags: -Z two-phase-beyond-autoref //@[nll_beyond]should-fail diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr index 99e81d3bba6..ae4c1605f01 100644 --- a/tests/ui/check-cfg/allow-same-level.stderr +++ b/tests/ui/check-cfg/allow-same-level.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE` LL | #[cfg(FALSE)] | ^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(FALSE)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 09a1c950267..627f03ddf55 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")] | = note: no expected values for `feature` = help: consider adding `serde` as a feature in `Cargo.toml` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: (none) @@ -17,7 +17,7 @@ LL | #[cfg(feature)] | = note: no expected values for `feature` = help: consider defining some features in `Cargo.toml` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 @@ -25,9 +25,9 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `CONFIG_NVME` --> $DIR/cargo-feature.rs:26:7 @@ -35,8 +35,8 @@ warning: unexpected `cfg` condition name: `CONFIG_NVME` LL | #[cfg(CONFIG_NVME = "m")] | ^^^^^^^^^^^^^^^^^ | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 4db9c66fc86..9cc5fb6aca0 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -6,7 +6,7 @@ LL | #[cfg(feature = "serde")] | = note: expected values for `feature` are: `bitcode` = help: consider adding `serde` as a feature in `Cargo.toml` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: (none) @@ -17,7 +17,7 @@ LL | #[cfg(feature)] | = note: expected values for `feature` are: `bitcode` = help: consider defining some features in `Cargo.toml` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `tokio_unstable` --> $DIR/cargo-feature.rs:22:7 @@ -25,9 +25,9 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(tokio_unstable)");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `m` --> $DIR/cargo-feature.rs:26:7 @@ -38,8 +38,8 @@ LL | #[cfg(CONFIG_NVME = "m")] | help: there is a expected value with a similar name: `"y"` | = note: expected values for `CONFIG_NVME` are: `y` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: 4 warnings emitted diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index f1393c55819..4975129802b 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index 3d4f430c2bb..6404556f46c 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr index 142d10076e9..bda1a601410 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `linux` LL | #[cfg(linux)] | ^^^^^ help: found config with similar value: `target_os = "linux"` | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(linux)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr index dd19f606620..079be8d08c2 100644 --- a/tests/ui/check-cfg/compact-names.stderr +++ b/tests/ui/check-cfg/compact-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture` LL | #[cfg(target(os = "linux", architecture = "arm"))] | ^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index 16417fe0105..1b7505682da 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -5,7 +5,7 @@ LL | #[cfg(featur)] | ^^^^^^ help: there is a config with a similar name: `feature` | = help: expected values for `feature` are: `foo` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `featur` @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `featur` LL | #[cfg(featur = "foo")] | ^^^^^^^^^^^^^^ | - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] @@ -27,7 +27,7 @@ LL | #[cfg(featur = "fo")] | ^^^^^^^^^^^^^ | = help: expected values for `feature` are: `foo` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration help: there is a config with a similar name and different values | LL | #[cfg(feature = "foo")] @@ -39,8 +39,8 @@ warning: unexpected `cfg` condition name: `no_value` LL | #[cfg(no_value)] | ^^^^^^^^ help: there is a config with a similar name: `no_values` | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value)");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value)");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:27:7 @@ -48,8 +48,8 @@ warning: unexpected `cfg` condition name: `no_value` LL | #[cfg(no_value = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration help: there is a config with a similar name and no value | LL | #[cfg(no_values)] @@ -64,8 +64,8 @@ LL | #[cfg(no_values = "bar")] | help: remove the value | = note: no expected value for `no_values` - = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of a `build.rs` - = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration + = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of the `build.rs` + = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration warning: 6 warnings emitted diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 91afe766c8d..755373d7b77 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default @@ -30,7 +30,7 @@ LL | #[cfg(feature = "unk")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `feature` - --> $DIR/exhaustive-names-values.rs:25:7 + --> $DIR/exhaustive-names-values.rs:24:7 | LL | #[cfg(feature = "std")] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 93b0621e224..6344739ae76 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 93b0621e224..6344739ae76 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.rs b/tests/ui/check-cfg/exhaustive-names-values.rs index a6190f15dbb..7b2d89b5781 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.rs +++ b/tests/ui/check-cfg/exhaustive-names-values.rs @@ -16,15 +16,13 @@ pub fn f() {} pub fn f() {} #[cfg(feature = "unk")] -//[empty_names_values]~^ WARNING unexpected `cfg` condition name -//[empty_cfg]~^^ WARNING unexpected `cfg` condition name -//[feature]~^^^ WARNING unexpected `cfg` condition value -//[full]~^^^^ WARNING unexpected `cfg` condition value +//[empty_cfg]~^ WARNING unexpected `cfg` condition name +//[feature]~^^ WARNING unexpected `cfg` condition value +//[full]~^^^ WARNING unexpected `cfg` condition value pub fn feat() {} #[cfg(feature = "std")] -//[empty_names_values]~^ WARNING unexpected `cfg` condition name -//[empty_cfg]~^^ WARNING unexpected `cfg` condition name +//[empty_cfg]~^ WARNING unexpected `cfg` condition name pub fn feat() {} #[cfg(windows)] diff --git a/tests/ui/check-cfg/exhaustive-names.stderr b/tests/ui/check-cfg/exhaustive-names.stderr index f4eb5a640ae..605825cd4e5 100644 --- a/tests/ui/check-cfg/exhaustive-names.stderr +++ b/tests/ui/check-cfg/exhaustive-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/invalid-arguments.any_values.stderr b/tests/ui/check-cfg/invalid-arguments.any_values.stderr index f9a9c4a6e13..65ef5155fa1 100644 --- a/tests/ui/check-cfg/invalid-arguments.any_values.stderr +++ b/tests/ui/check-cfg/invalid-arguments.any_values.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(any(),values())` (`values()` cannot be specified before the names) +error: invalid `--check-cfg` argument: `cfg(any(),values())` + | + = note: `values()` cannot be specified before the names + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr index 925664bb3fc..f3bc0b782e2 100644 --- a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr +++ b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `anything_else(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) +error: invalid `--check-cfg` argument: `anything_else(...)` + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.boolean.stderr b/tests/ui/check-cfg/invalid-arguments.boolean.stderr new file mode 100644 index 00000000000..18734de9dac --- /dev/null +++ b/tests/ui/check-cfg/invalid-arguments.boolean.stderr @@ -0,0 +1,6 @@ +error: invalid `--check-cfg` argument: `cfg(true)` + | + = note: `true` is a boolean literal + = note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details + diff --git a/tests/ui/check-cfg/invalid-arguments.cfg_none.stderr b/tests/ui/check-cfg/invalid-arguments.cfg_none.stderr index 7992dbdff00..ef464260c29 100644 --- a/tests/ui/check-cfg/invalid-arguments.cfg_none.stderr +++ b/tests/ui/check-cfg/invalid-arguments.cfg_none.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(none())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) +error: invalid `--check-cfg` argument: `cfg(none())` + | + = note: `none()` is invalid + = note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.giberich.stderr b/tests/ui/check-cfg/invalid-arguments.giberich.stderr index d427033fcc2..3e350145491 100644 --- a/tests/ui/check-cfg/invalid-arguments.giberich.stderr +++ b/tests/ui/check-cfg/invalid-arguments.giberich.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) +error: invalid `--check-cfg` argument: `cfg(...)` + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr index 90308bdcd23..cfedb7ed517 100644 --- a/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr +++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals, `none()` or `any()`) +error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` + | + = note: `bar` is invalid + = note: `values()` arguments must be string literals, `none()` or `any()` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr index 16f92a504a5..ba194862284 100644 --- a/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr +++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals, `none()` or `any()`) +error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` + | + = note: `bar` is invalid + = note: `values()` arguments must be string literals, `none()` or `any()` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr index 9239f8cce94..512ecbe9eda 100644 --- a/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` (`values()` cannot be specified before the names) +error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` + | + = note: `values()` cannot be specified before the names + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr index 4c406143d08..2d59b12097d 100644 --- a/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` (`values()` arguments cannot specify string literals and `any()` at the same time) +error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` + | + = note: `values()` arguments cannot specify string literals and `any()` at the same time + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr index 6f1db1b13c3..6eb63de4252 100644 --- a/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(any(),any())` (`any()` cannot be specified multiple times) +error: invalid `--check-cfg` argument: `cfg(any(),any())` + | + = note: `any()` cannot be specified multiple times + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr index bce305b09c3..06060078bc0 100644 --- a/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr +++ b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` (`values()` cannot be specified multiple times) +error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` + | + = note: `values()` cannot be specified multiple times + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr index 748ce231af7..72554ac3ead 100644 --- a/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` (`any()` in `values()` cannot be specified multiple times) +error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` + | + = note: `any()` is invalid + = note: `any()` in `values()` cannot be specified multiple times + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.none_not_empty.stderr b/tests/ui/check-cfg/invalid-arguments.none_not_empty.stderr index 0a6c6ffd42f..6e9d87bace2 100644 --- a/tests/ui/check-cfg/invalid-arguments.none_not_empty.stderr +++ b/tests/ui/check-cfg/invalid-arguments.none_not_empty.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(none("test")))` (`none()` must be empty) +error: invalid `--check-cfg` argument: `cfg(foo,values(none("test")))` + | + = note: `none("test")` is invalid + = note: `none()` in `values()` takes no argument + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr index daf38147fe5..35eb1949ad7 100644 --- a/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(any(foo))` (`any()` must be empty) +error: invalid `--check-cfg` argument: `cfg(any(foo))` + | + = note: `any(foo)` is invalid + = note: `any()` takes no argument + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr index 79f83e802ca..cc41d21bec6 100644 --- a/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr +++ b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` (`any()` must be empty) +error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` + | + = note: `any(bar)` is invalid + = note: `any()` in `values()` takes no argument + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.rs b/tests/ui/check-cfg/invalid-arguments.rs index c0b58ede97f..b8588ecb4ff 100644 --- a/tests/ui/check-cfg/invalid-arguments.rs +++ b/tests/ui/check-cfg/invalid-arguments.rs @@ -2,7 +2,7 @@ // //@ check-fail //@ no-auto-check-cfg -//@ revisions: anything_else +//@ revisions: anything_else boolean //@ revisions: string_for_name_1 string_for_name_2 multiple_any multiple_values //@ revisions: multiple_values_any not_empty_any not_empty_values_any //@ revisions: values_any_missing_values values_any_before_ident ident_in_values_1 @@ -11,6 +11,7 @@ //@ revisions: none_not_empty cfg_none // //@ [anything_else]compile-flags: --check-cfg=anything_else(...) +//@ [boolean]compile-flags: --check-cfg=cfg(true) //@ [string_for_name_1]compile-flags: --check-cfg=cfg("NOT_IDENT") //@ [string_for_name_2]compile-flags: --check-cfg=cfg(foo,"NOT_IDENT",bar) //@ [multiple_any]compile-flags: --check-cfg=cfg(any(),any()) diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr index c6f6834ffd3..7022b709b64 100644 --- a/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr +++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) +error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` + | + = note: `"NOT_IDENT"` is a string literal + = note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr index ab3dc86cd1a..ea96b913907 100644 --- a/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr +++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) +error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` + | + = note: `"NOT_IDENT"` is a string literal + = note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr index c04b15ec265..f82c520c62a 100644 --- a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr +++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `abc()` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) +error: invalid `--check-cfg` argument: `abc()` + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr index cee65f9887b..ee62c25b41c 100644 --- a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr +++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,test())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) +error: invalid `--check-cfg` argument: `cfg(foo,test())` + | + = note: `test()` is invalid + = note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr index a023779b35a..a8ab9cc9d30 100644 --- a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr +++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr @@ -1,2 +1,6 @@ -error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals, `none()` or `any()`) +error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` + | + = note: `test()` is invalid + = note: `values()` arguments must be string literals, `none()` or `any()` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.unterminated.stderr b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr index 80161a6aa0f..150e1d66426 100644 --- a/tests/ui/check-cfg/invalid-arguments.unterminated.stderr +++ b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) +error: invalid `--check-cfg` argument: `cfg(` + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr index fc93ec8fbdf..7013bb8e095 100644 --- a/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr +++ b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` (`values()` cannot be specified before the names) +error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` + | + = note: `values()` cannot be specified before the names + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr index f41672fcbdb..ad1af73c690 100644 --- a/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr +++ b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr @@ -1,2 +1,5 @@ -error: invalid `--check-cfg` argument: `cfg(foo,any())` (`cfg(any())` can only be provided in isolation) +error: invalid `--check-cfg` argument: `cfg(foo,any())` + | + = note: `cfg(any())` can only be provided in isolation + = note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 1ccdd10d123..54591699145 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, test)] | ^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr index a6c72b0e6bf..ab0deae428d 100644 --- a/tests/ui/check-cfg/stmt-no-ice.stderr +++ b/tests/ui/check-cfg/stmt-no-ice.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom` LL | #[cfg(crossbeam_loom)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/values-none.concat_1.stderr b/tests/ui/check-cfg/values-none.concat_1.stderr new file mode 100644 index 00000000000..b8f0b02b4c5 --- /dev/null +++ b/tests/ui/check-cfg/values-none.concat_1.stderr @@ -0,0 +1,13 @@ +warning: unexpected `cfg` condition value: `bar` + --> $DIR/values-none.rs:16:7 + | +LL | #[cfg(foo = "bar")] + | ^^^^^^^^^^^ + | + = note: expected values for `foo` are: (none), `too` + = help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/check-cfg/values-none.concat_2.stderr b/tests/ui/check-cfg/values-none.concat_2.stderr new file mode 100644 index 00000000000..b8f0b02b4c5 --- /dev/null +++ b/tests/ui/check-cfg/values-none.concat_2.stderr @@ -0,0 +1,13 @@ +warning: unexpected `cfg` condition value: `bar` + --> $DIR/values-none.rs:16:7 + | +LL | #[cfg(foo = "bar")] + | ^^^^^^^^^^^ + | + = note: expected values for `foo` are: (none), `too` + = help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/check-cfg/values-none.rs b/tests/ui/check-cfg/values-none.rs index 6856d2f33af..447fde2bfcc 100644 --- a/tests/ui/check-cfg/values-none.rs +++ b/tests/ui/check-cfg/values-none.rs @@ -1,7 +1,7 @@ //@ check-pass // //@ no-auto-check-cfg -//@ revisions: explicit implicit +//@ revisions: explicit implicit simple concat_1 concat_2 //@ [explicit]compile-flags: --check-cfg=cfg(foo,values(none())) //@ [implicit]compile-flags: --check-cfg=cfg(foo) //@ [simple] compile-flags: --check-cfg=cfg(foo,values(none(),"too")) diff --git a/tests/ui/check-cfg/values-none.simple.stderr b/tests/ui/check-cfg/values-none.simple.stderr new file mode 100644 index 00000000000..b8f0b02b4c5 --- /dev/null +++ b/tests/ui/check-cfg/values-none.simple.stderr @@ -0,0 +1,13 @@ +warning: unexpected `cfg` condition value: `bar` + --> $DIR/values-none.rs:16:7 + | +LL | #[cfg(foo = "bar")] + | ^^^^^^^^^^^ + | + = note: expected values for `foo` are: (none), `too` + = help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 2f07174b905..2ce6fe80ef2 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -18,7 +18,7 @@ warning: unexpected `cfg` condition name: `features` LL | #[cfg(features = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index b821f8092dd..d5fe7464792 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -43,6 +43,8 @@ //~^ WARN unexpected `cfg` condition value relocation_model = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value + rustfmt = "_UNEXPECTED_VALUE", + //~^ WARN unexpected `cfg` condition value sanitize = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value target_abi = "_UNEXPECTED_VALUE", @@ -115,4 +117,7 @@ fn doc() {} #[cfg(clippy)] fn clippy() {} +#[cfg_attr(rustfmt, rustfmt::skip)] +fn rustfmt() {} + fn main() {} diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index cd5cdf3df3c..db4a5fd49e6 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -97,6 +97,17 @@ LL | relocation_model = "_UNEXPECTED_VALUE", warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:46:5 | +LL | rustfmt = "_UNEXPECTED_VALUE", + | ^^^^^^^---------------------- + | | + | help: remove the value + | + = note: no expected value for `rustfmt` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + +warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` + --> $DIR/well-known-values.rs:48:5 + | LL | sanitize = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -104,7 +115,7 @@ LL | sanitize = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:48:5 + --> $DIR/well-known-values.rs:50:5 | LL | target_abi = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -113,7 +124,7 @@ LL | target_abi = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:50:5 + --> $DIR/well-known-values.rs:52:5 | LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -122,7 +133,7 @@ LL | target_arch = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:52:5 + --> $DIR/well-known-values.rs:54:5 | LL | target_endian = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -131,7 +142,7 @@ LL | target_endian = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:54:5 + --> $DIR/well-known-values.rs:56:5 | LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -140,7 +151,7 @@ LL | target_env = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:56:5 + --> $DIR/well-known-values.rs:58:5 | LL | target_family = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -149,7 +160,7 @@ LL | target_family = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:58:5 + --> $DIR/well-known-values.rs:60:5 | LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -158,7 +169,7 @@ LL | target_feature = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:60:5 + --> $DIR/well-known-values.rs:62:5 | LL | target_has_atomic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -167,7 +178,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:62:5 + --> $DIR/well-known-values.rs:64:5 | LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -176,7 +187,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:64:5 + --> $DIR/well-known-values.rs:66:5 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,7 +196,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:66:5 + --> $DIR/well-known-values.rs:68:5 | LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -194,7 +205,7 @@ LL | target_os = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:68:5 + --> $DIR/well-known-values.rs:70:5 | LL | target_pointer_width = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -203,7 +214,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:70:5 + --> $DIR/well-known-values.rs:72:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^---------------------- @@ -214,7 +225,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:72:5 + --> $DIR/well-known-values.rs:74:5 | LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +234,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:74:5 + --> $DIR/well-known-values.rs:76:5 | LL | test = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -234,7 +245,7 @@ LL | test = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:76:5 + --> $DIR/well-known-values.rs:78:5 | LL | ub_checks = "_UNEXPECTED_VALUE", | ^^^^^^^^^---------------------- @@ -245,7 +256,7 @@ LL | ub_checks = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:78:5 + --> $DIR/well-known-values.rs:80:5 | LL | unix = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -256,7 +267,7 @@ LL | unix = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:80:5 + --> $DIR/well-known-values.rs:82:5 | LL | windows = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -267,7 +278,7 @@ LL | windows = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `linuz` - --> $DIR/well-known-values.rs:86:7 + --> $DIR/well-known-values.rs:88:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | ^^^^^^^^^^^^------- @@ -277,5 +288,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration -warning: 28 warnings emitted +warning: 29 warnings emitted diff --git a/tests/ui/coercion/coerce-loop-issue-122561.rs b/tests/ui/coercion/coerce-loop-issue-122561.rs new file mode 100644 index 00000000000..e08884ad6a4 --- /dev/null +++ b/tests/ui/coercion/coerce-loop-issue-122561.rs @@ -0,0 +1,110 @@ +// Regression test for #122561 + +fn for_infinite() -> bool { + for i in 0.. { + //~^ ERROR mismatched types + return false; + } +} + +fn for_finite() -> String { + for i in 0..5 { + //~^ ERROR mismatched types + return String::from("test"); + } +} + +fn for_zero_times() -> bool { + for i in 0..0 { + //~^ ERROR mismatched types + return true; + } +} + +fn for_never_type() -> ! { + for i in 0..5 { + //~^ ERROR mismatched types + } +} + +// Entire function on a single line. +// Tests that we format the suggestion +// correctly in this case +fn for_single_line() -> bool { for i in 0.. { return false; } } +//~^ ERROR mismatched types + +// Loop in an anon const in function args +// Tests that we: +// a. deal properly with this complex case +// b. format the suggestion correctly so +// that it's readable +fn for_in_arg(a: &[(); for x in 0..2 {}]) -> bool { +//~^ ERROR `for` is not allowed in a `const` +//~| ERROR mismatched types + true +} + +fn while_inifinite() -> bool { + while true { + //~^ ERROR mismatched types + //~| WARN denote infinite loops with `loop { ... }` [while_true] + return true; + } +} + +fn while_finite() -> bool { + let mut i = 0; + while i < 3 { + //~^ ERROR mismatched types + i += 1; + return true; + } +} + +fn while_zero_times() -> bool { + while false { + //~^ ERROR mismatched types + return true; + } +} + +fn while_never_type() -> ! { + while true { + //~^ ERROR mismatched types + //~| WARN denote infinite loops with `loop { ... }` [while_true] + } +} + +// No type mismatch error in this case +fn loop_() -> bool { + loop { + return true; + } +} + +const C: i32 = { + for i in 0.. { + //~^ ERROR `for` is not allowed in a `const` + //~| ERROR mismatched types + } +}; + +fn main() { + let _ = [10; { + for i in 0..5 { + //~^ ERROR `for` is not allowed in a `const` + //~| ERROR mismatched types + } + }]; + + let _ = [10; { + while false { + //~^ ERROR mismatched types + } + }]; + + + let _ = |a: &[(); for x in 0..2 {}]| {}; + //~^ ERROR `for` is not allowed in a `const` + //~| ERROR mismatched types +} diff --git a/tests/ui/coercion/coerce-loop-issue-122561.stderr b/tests/ui/coercion/coerce-loop-issue-122561.stderr new file mode 100644 index 00000000000..0f77fd1364d --- /dev/null +++ b/tests/ui/coercion/coerce-loop-issue-122561.stderr @@ -0,0 +1,299 @@ +warning: denote infinite loops with `loop { ... }` + --> $DIR/coerce-loop-issue-122561.rs:48:5 + | +LL | while true { + | ^^^^^^^^^^ help: use `loop` + | + = note: `#[warn(while_true)]` on by default + +warning: denote infinite loops with `loop { ... }` + --> $DIR/coerce-loop-issue-122561.rs:72:5 + | +LL | while true { + | ^^^^^^^^^^ help: use `loop` + +error[E0658]: `for` is not allowed in a `const` + --> $DIR/coerce-loop-issue-122561.rs:41:24 + | +LL | fn for_in_arg(a: &[(); for x in 0..2 {}]) -> bool { + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `for` is not allowed in a `const` + --> $DIR/coerce-loop-issue-122561.rs:86:5 + | +LL | / for i in 0.. { +LL | | +LL | | +LL | | } + | |_____^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `for` is not allowed in a `const` + --> $DIR/coerce-loop-issue-122561.rs:94:9 + | +LL | / for i in 0..5 { +LL | | +LL | | +LL | | } + | |_________^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `for` is not allowed in a `const` + --> $DIR/coerce-loop-issue-122561.rs:107:23 + | +LL | let _ = |a: &[(); for x in 0..2 {}]| {}; + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information + = help: add `#![feature(const_for)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:41:24 + | +LL | fn for_in_arg(a: &[(); for x in 0..2 {}]) -> bool { + | ^^^^^^^^^^^^^^^^ expected `usize`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL | fn for_in_arg(a: &[(); for x in 0..2 {} /* `usize` value */]) -> bool { + | +++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:86:5 + | +LL | / for i in 0.. { +LL | | +LL | | +LL | | } + | |_____^ expected `i32`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `i32` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:4:5 + | +LL | fn for_infinite() -> bool { + | ---- expected `bool` because of return type +LL | / for i in 0.. { +LL | | +LL | | return false; +LL | | } + | |_____^ expected `bool`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `bool` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:11:5 + | +LL | fn for_finite() -> String { + | ------ expected `String` because of return type +LL | / for i in 0..5 { +LL | | +LL | | return String::from("test"); +LL | | } + | |_____^ expected `String`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `String` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:18:5 + | +LL | fn for_zero_times() -> bool { + | ---- expected `bool` because of return type +LL | / for i in 0..0 { +LL | | +LL | | return true; +LL | | } + | |_____^ expected `bool`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `bool` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:25:5 + | +LL | fn for_never_type() -> ! { + | - expected `!` because of return type +LL | / for i in 0..5 { +LL | | +LL | | } + | |_____^ expected `!`, found `()` + | + = note: expected type `!` + found unit type `()` + = note: `for` loops evaluate to unit type `()` +help: consider adding a diverging expression here + | +LL ~ } +LL + /* `loop {}` or `panic!("...")` */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:33:32 + | +LL | fn for_single_line() -> bool { for i in 0.. { return false; } } + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` + | | + | expected `bool` because of return type + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL | fn for_single_line() -> bool { for i in 0.. { return false; } /* `bool` value */ } + | ++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:48:5 + | +LL | fn while_inifinite() -> bool { + | ---- expected `bool` because of return type +LL | / while true { +LL | | +LL | | +LL | | return true; +LL | | } + | |_____^ expected `bool`, found `()` + | + = note: `while` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `bool` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:57:5 + | +LL | fn while_finite() -> bool { + | ---- expected `bool` because of return type +LL | let mut i = 0; +LL | / while i < 3 { +LL | | +LL | | i += 1; +LL | | return true; +LL | | } + | |_____^ expected `bool`, found `()` + | + = note: `while` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `bool` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:65:5 + | +LL | fn while_zero_times() -> bool { + | ---- expected `bool` because of return type +LL | / while false { +LL | | +LL | | return true; +LL | | } + | |_____^ expected `bool`, found `()` + | + = note: `while` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `bool` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:72:5 + | +LL | fn while_never_type() -> ! { + | - expected `!` because of return type +LL | / while true { +LL | | +LL | | +LL | | } + | |_____^ expected `!`, found `()` + | + = note: expected type `!` + found unit type `()` + = note: `while` loops evaluate to unit type `()` +help: consider adding a diverging expression here + | +LL ~ } +LL + /* `loop {}` or `panic!("...")` */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:94:9 + | +LL | / for i in 0..5 { +LL | | +LL | | +LL | | } + | |_________^ expected `usize`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `usize` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:101:9 + | +LL | / while false { +LL | | +LL | | } + | |_________^ expected `usize`, found `()` + | + = note: `while` loops evaluate to unit type `()` +help: consider returning a value here + | +LL ~ } +LL + /* `usize` value */ + | + +error[E0308]: mismatched types + --> $DIR/coerce-loop-issue-122561.rs:107:23 + | +LL | let _ = |a: &[(); for x in 0..2 {}]| {}; + | ^^^^^^^^^^^^^^^^ expected `usize`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL | let _ = |a: &[(); for x in 0..2 {} /* `usize` value */]| {}; + | +++++++++++++++++++ + +error: aborting due to 18 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs index 408eaffccf7..d8852812492 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -28,8 +28,8 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] - //~^ ERROR expected unsuffixed literal or identifier, found `concat!("nonexistent")` - //~| ERROR expected unsuffixed literal or identifier, found `concat!("nonexistent")` + //~^ ERROR expected unsuffixed literal, found `concat!("nonexistent")` + //~| ERROR expected unsuffixed literal, found `concat!("nonexistent")` struct S10; } } diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 12557ff6360..3dd0823389c 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -54,7 +54,7 @@ LL | #[cfg(a = b"hi")] | | | help: consider removing the prefix -error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` +error: expected unsuffixed literal, found `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] @@ -65,7 +65,7 @@ LL | generate_s10!(concat!("nonexistent")); | = note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` +error: expected unsuffixed literal, found `concat!("nonexistent")` --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs index 5e7845e4e82..fa3ca6928e3 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs @@ -2,7 +2,7 @@ //@ aux-build:static_cross_crate.rs //@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP" -#![feature(exclusive_range_pattern, half_open_range_patterns_in_slices)] +#![feature(half_open_range_patterns_in_slices)] #![allow(static_mut_refs)] extern crate static_cross_crate; diff --git a/tests/ui/consts/offset_from_ub.rs b/tests/ui/consts/offset_from_ub.rs index 51163e650d6..e0dd2707915 100644 --- a/tests/ui/consts/offset_from_ub.rs +++ b/tests/ui/consts/offset_from_ub.rs @@ -42,7 +42,7 @@ pub const DIFFERENT_INT: isize = { // offset_from with two different integers: l let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| 0x8[noalloc] is a dangling pointer + //~| different pointers without provenance }; const OUT_OF_BOUNDS_1: isize = { @@ -81,13 +81,13 @@ pub const DIFFERENT_ALLOC_UNSIGNED: usize = { }; pub const TOO_FAR_APART1: isize = { - let ptr1 = ptr::null::<u8>(); + let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed //~| too far ahead }; pub const TOO_FAR_APART2: isize = { - let ptr1 = ptr::null::<u8>(); + let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); unsafe { ptr_offset_from(ptr1, ptr2) } //~ERROR evaluation of constant value failed //~| too far before @@ -100,7 +100,7 @@ const WRONG_ORDER_UNSIGNED: usize = { //~| first pointer has smaller offset than second: 0 < 8 }; pub const TOO_FAR_APART_UNSIGNED: usize = { - let ptr1 = ptr::null::<u8>(); + let ptr1 = &0u8 as *const u8; let ptr2 = ptr1.wrapping_add(isize::MAX as usize + 42); // This would fit into a `usize` but we still don't allow it. unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } //~ERROR evaluation of constant value failed diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr index 4fbb2f00100..e3bac8d5e31 100644 --- a/tests/ui/consts/offset_from_ub.stderr +++ b/tests/ui/consts/offset_from_ub.stderr @@ -33,7 +33,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:44:14 | LL | unsafe { ptr_offset_from(ptr2, ptr1) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: 0x8[noalloc] is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:53:14 @@ -86,7 +86,7 @@ LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds `offset_from`: null pointer is a dangling pointer (it has no provenance) + = note: `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -99,7 +99,7 @@ LL | unsafe { ptr2.offset_from(ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds `offset_from`: null pointer is a dangling pointer (it has no provenance) + = note: `ptr_offset_from` called on different pointers without provenance (i.e., without an associated allocation) | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL diff --git a/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs b/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs new file mode 100644 index 00000000000..5d93db56722 --- /dev/null +++ b/tests/ui/coroutine/break-inside-coroutine-issue-124495.rs @@ -0,0 +1,26 @@ +//@ edition: 2024 +//@ compile-flags: -Z unstable-options + +#![feature(gen_blocks)] +#![feature(async_closure)] + +async fn async_fn() { + break; //~ ERROR `break` inside `async` function +} + +gen fn gen_fn() { + break; //~ ERROR `break` inside `gen` function +} + +async gen fn async_gen_fn() { + break; //~ ERROR `break` inside `async gen` function +} + +fn main() { + let _ = async { break; }; //~ ERROR `break` inside `async` block + let _ = async || { break; }; //~ ERROR `break` inside `async` closure + + let _ = gen { break; }; //~ ERROR `break` inside `gen` block + + let _ = async gen { break; }; //~ ERROR `break` inside `async gen` block +} diff --git a/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr b/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr new file mode 100644 index 00000000000..a7f37fad35e --- /dev/null +++ b/tests/ui/coroutine/break-inside-coroutine-issue-124495.stderr @@ -0,0 +1,69 @@ +error[E0267]: `break` inside `async` function + --> $DIR/break-inside-coroutine-issue-124495.rs:8:5 + | +LL | async fn async_fn() { + | _____________________- +LL | | break; + | | ^^^^^ cannot `break` inside `async` function +LL | | } + | |_- enclosing `async` function + +error[E0267]: `break` inside `gen` function + --> $DIR/break-inside-coroutine-issue-124495.rs:12:5 + | +LL | gen fn gen_fn() { + | _________________- +LL | | break; + | | ^^^^^ cannot `break` inside `gen` function +LL | | } + | |_- enclosing `gen` function + +error[E0267]: `break` inside `async gen` function + --> $DIR/break-inside-coroutine-issue-124495.rs:16:5 + | +LL | async gen fn async_gen_fn() { + | _____________________________- +LL | | break; + | | ^^^^^ cannot `break` inside `async gen` function +LL | | } + | |_- enclosing `async gen` function + +error[E0267]: `break` inside `async` block + --> $DIR/break-inside-coroutine-issue-124495.rs:20:21 + | +LL | let _ = async { break; }; + | --------^^^^^--- + | | | + | | cannot `break` inside `async` block + | enclosing `async` block + +error[E0267]: `break` inside `async` closure + --> $DIR/break-inside-coroutine-issue-124495.rs:21:24 + | +LL | let _ = async || { break; }; + | --^^^^^--- + | | | + | | cannot `break` inside `async` closure + | enclosing `async` closure + +error[E0267]: `break` inside `gen` block + --> $DIR/break-inside-coroutine-issue-124495.rs:23:19 + | +LL | let _ = gen { break; }; + | ------^^^^^--- + | | | + | | cannot `break` inside `gen` block + | enclosing `gen` block + +error[E0267]: `break` inside `async gen` block + --> $DIR/break-inside-coroutine-issue-124495.rs:25:25 + | +LL | let _ = async gen { break; }; + | ------------^^^^^--- + | | | + | | cannot `break` inside `async gen` block + | enclosing `async gen` block + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0267`. diff --git a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr index 078c766deed..a030da5068c 100644 --- a/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr +++ b/tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr @@ -4,7 +4,7 @@ error: expected unsuffixed literal, found `test` LL | #[deprecated(note = test)] | ^^^^ | -help: surround the identifier with quotation marks to parse it as a string +help: surround the identifier with quotation marks to make it into a string literal | LL | #[deprecated(note = "test")] | + + diff --git a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index d0b14ef94c1..e88a523ef4f 100644 --- a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -1,4 +1,4 @@ -error[E0369]: binary operation `==` cannot be applied to type `Error` +error[E0369]: binary operation `==` cannot be applied to type `&Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | LL | #[derive(PartialEq)] diff --git a/tests/ui/derives/derives-span-PartialEq-enum.stderr b/tests/ui/derives/derives-span-PartialEq-enum.stderr index f69451ac793..80b225446b4 100644 --- a/tests/ui/derives/derives-span-PartialEq-enum.stderr +++ b/tests/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,4 +1,4 @@ -error[E0369]: binary operation `==` cannot be applied to type `Error` +error[E0369]: binary operation `==` cannot be applied to type `&Error` --> $DIR/derives-span-PartialEq-enum.rs:9:6 | LL | #[derive(PartialEq)] diff --git a/tests/ui/deriving/deriving-all-codegen.rs b/tests/ui/deriving/deriving-all-codegen.rs index 498930fc0c6..6fa4f74f2a5 100644 --- a/tests/ui/deriving/deriving-all-codegen.rs +++ b/tests/ui/deriving/deriving-all-codegen.rs @@ -156,6 +156,20 @@ enum EnumGeneric<T, U> { Two(U), } +// An enum that has variant, which does't implement `Copy`. +#[derive(PartialEq)] +enum NonCopyEnum { + // The `dyn NonCopyTrait` implements `PartialEq`, but it doesn't require `Copy`. + // So we cannot generate `PartialEq` with dereference. + NonCopyField(Box<dyn NonCopyTrait>), +} +trait NonCopyTrait {} +impl PartialEq for dyn NonCopyTrait { + fn eq(&self, _other: &Self) -> bool { + true + } +} + // A union. Most builtin traits are not derivable for unions. #[derive(Clone, Copy)] pub union Union { diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout index 9f8a9f30ff6..6b69b57c516 100644 --- a/tests/ui/deriving/deriving-all-codegen.stdout +++ b/tests/ui/deriving/deriving-all-codegen.stdout @@ -876,7 +876,7 @@ impl ::core::cmp::PartialEq for Enum1 { fn eq(&self, other: &Enum1) -> bool { match (self, other) { (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, } } } @@ -1119,10 +1119,10 @@ impl ::core::cmp::PartialEq for Mixed { __self_discr == __arg1_discr && match (self, other) { (Mixed::R(__self_0), Mixed::R(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { d1: __arg1_0, d2: __arg1_1 }) => - *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1, + __self_0 == __arg1_0 && __self_1 == __arg1_1, _ => true, } } @@ -1245,11 +1245,11 @@ impl ::core::cmp::PartialEq for Fielded { __self_discr == __arg1_discr && match (self, other) { (Fielded::X(__self_0), Fielded::X(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, _ => unsafe { ::core::intrinsics::unreachable() } } } @@ -1368,9 +1368,9 @@ impl<T: ::core::cmp::PartialEq, U: ::core::cmp::PartialEq> __self_discr == __arg1_discr && match (self, other) { (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => - *__self_0 == *__arg1_0, + __self_0 == __arg1_0, _ => unsafe { ::core::intrinsics::unreachable() } } } @@ -1426,6 +1426,30 @@ impl<T: ::core::cmp::Ord, U: ::core::cmp::Ord> ::core::cmp::Ord for } } +// An enum that has variant, which does't implement `Copy`. +enum NonCopyEnum { + + // The `dyn NonCopyTrait` implements `PartialEq`, but it doesn't require `Copy`. + // So we cannot generate `PartialEq` with dereference. + NonCopyField(Box<dyn NonCopyTrait>), +} +#[automatically_derived] +impl ::core::marker::StructuralPartialEq for NonCopyEnum { } +#[automatically_derived] +impl ::core::cmp::PartialEq for NonCopyEnum { + #[inline] + fn eq(&self, other: &NonCopyEnum) -> bool { + match (self, other) { + (NonCopyEnum::NonCopyField(__self_0), + NonCopyEnum::NonCopyField(__arg1_0)) => __self_0 == __arg1_0, + } + } +} +trait NonCopyTrait {} +impl PartialEq for dyn NonCopyTrait { + fn eq(&self, _other: &Self) -> bool { true } +} + // A union. Most builtin traits are not derivable for unions. pub union Union { pub b: bool, diff --git a/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs b/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs new file mode 100644 index 00000000000..e44c7e4e850 --- /dev/null +++ b/tests/ui/diagnostic_namespace/auxiliary/bad_on_unimplemented.rs @@ -0,0 +1,26 @@ +#[diagnostic::on_unimplemented(aa = "broken")] +pub trait MissingAttr {} + +#[diagnostic::on_unimplemented(label = "a", label = "b")] +pub trait DuplicateAttr {} + +#[diagnostic::on_unimplemented = "broken"] +pub trait NotMetaList {} + +#[diagnostic::on_unimplemented] +pub trait Empty {} + +#[diagnostic::on_unimplemented {}] +pub trait WrongDelim {} + +#[diagnostic::on_unimplemented(label = "{A:.3}")] +pub trait BadFormatter<A> {} + +#[diagnostic::on_unimplemented(label = "test {}")] +pub trait NoImplicitArgs {} + +#[diagnostic::on_unimplemented(label = "{missing}")] +pub trait MissingArg {} + +#[diagnostic::on_unimplemented(label = "{_}")] +pub trait BadArg {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr new file mode 100644 index 00000000000..a4d4b7b359e --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr @@ -0,0 +1,20 @@ +error[E0277]: the trait bound `*mut (): Foo` is not satisfied + --> $DIR/simple.rs:19:17 + | +LL | needs_foo::<*mut ()>(); + | ^^^^^^^ the trait `Send` is not implemented for `*mut ()`, which is required by `*mut (): Foo` + | +note: required for `*mut ()` to implement `Foo` + --> $DIR/simple.rs:10:9 + | +LL | impl<T> Foo for T where T: Send {} + | ^^^ ^ ---- unsatisfied trait bound introduced here +note: required by a bound in `needs_foo` + --> $DIR/simple.rs:14:17 + | +LL | fn needs_foo<T: Foo>() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr new file mode 100644 index 00000000000..1341ca8175a --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `*mut (): Foo` is not satisfied + --> $DIR/simple.rs:19:17 + | +LL | needs_foo::<*mut ()>(); + | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` + | +note: required by a bound in `needs_foo` + --> $DIR/simple.rs:14:17 + | +LL | fn needs_foo<T: Foo>() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs new file mode 100644 index 00000000000..15ff80ae4d9 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +#![feature(do_not_recommend)] + +trait Foo {} + +#[do_not_recommend] +impl<T> Foo for T where T: Send {} +//[current]~^ NOTE required for `*mut ()` to implement `Foo` +//[current]~| NOTE unsatisfied trait bound introduced here + +fn needs_foo<T: Foo>() {} +//~^ NOTE required by a bound in `needs_foo` +//~| NOTE required by this bound in `needs_foo` + +fn main() { + needs_foo::<*mut ()>(); + //~^ ERROR the trait bound `*mut (): Foo` is not satisfied + //[current]~| NOTE the trait `Send` is not implemented for `*mut ()` + //[next]~| NOTE the trait `Foo` is not implemented for `*mut ()` +} diff --git a/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.rs b/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.rs new file mode 100644 index 00000000000..8b7467a17d0 --- /dev/null +++ b/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.rs @@ -0,0 +1,31 @@ +//@ edition:2021 +//@ aux-build:bad_on_unimplemented.rs + +// Do not ICE when encountering a malformed `#[diagnostic::on_unimplemented]` annotation in a +// dependency when incorrectly used (#124651). + +extern crate bad_on_unimplemented; + +use bad_on_unimplemented::*; + +fn missing_attr<T: MissingAttr>(_: T) {} +fn duplicate_attr<T: DuplicateAttr>(_: T) {} +fn not_meta_list<T: NotMetaList>(_: T) {} +fn empty<T: Empty>(_: T) {} +fn wrong_delim<T: WrongDelim>(_: T) {} +fn bad_formatter<T: BadFormatter<()>>(_: T) {} +fn no_implicit_args<T: NoImplicitArgs>(_: T) {} +fn missing_arg<T: MissingArg>(_: T) {} +fn bad_arg<T: BadArg>(_: T) {} + +fn main() { + missing_attr(()); //~ ERROR E0277 + duplicate_attr(()); //~ ERROR E0277 + not_meta_list(()); //~ ERROR E0277 + empty(()); //~ ERROR E0277 + wrong_delim(()); //~ ERROR E0277 + bad_formatter(()); //~ ERROR E0277 + no_implicit_args(()); //~ ERROR E0277 + missing_arg(()); //~ ERROR E0277 + bad_arg(()); //~ ERROR E0277 +} diff --git a/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.stderr b/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.stderr new file mode 100644 index 00000000000..c3e56550b70 --- /dev/null +++ b/tests/ui/diagnostic_namespace/malformed_foreign_on_unimplemented.stderr @@ -0,0 +1,134 @@ +error[E0277]: the trait bound `(): bad_on_unimplemented::MissingAttr` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:22:18 + | +LL | missing_attr(()); + | ------------ ^^ the trait `bad_on_unimplemented::MissingAttr` is not implemented for `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `missing_attr` + --> $DIR/malformed_foreign_on_unimplemented.rs:11:20 + | +LL | fn missing_attr<T: MissingAttr>(_: T) {} + | ^^^^^^^^^^^ required by this bound in `missing_attr` + +error[E0277]: the trait bound `(): bad_on_unimplemented::DuplicateAttr` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:23:20 + | +LL | duplicate_attr(()); + | -------------- ^^ a + | | + | required by a bound introduced by this call + | + = help: the trait `bad_on_unimplemented::DuplicateAttr` is not implemented for `()` +note: required by a bound in `duplicate_attr` + --> $DIR/malformed_foreign_on_unimplemented.rs:12:22 + | +LL | fn duplicate_attr<T: DuplicateAttr>(_: T) {} + | ^^^^^^^^^^^^^ required by this bound in `duplicate_attr` + +error[E0277]: the trait bound `(): bad_on_unimplemented::NotMetaList` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:24:19 + | +LL | not_meta_list(()); + | ------------- ^^ the trait `bad_on_unimplemented::NotMetaList` is not implemented for `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `not_meta_list` + --> $DIR/malformed_foreign_on_unimplemented.rs:13:21 + | +LL | fn not_meta_list<T: NotMetaList>(_: T) {} + | ^^^^^^^^^^^ required by this bound in `not_meta_list` + +error[E0277]: the trait bound `(): bad_on_unimplemented::Empty` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:25:11 + | +LL | empty(()); + | ----- ^^ the trait `bad_on_unimplemented::Empty` is not implemented for `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `empty` + --> $DIR/malformed_foreign_on_unimplemented.rs:14:13 + | +LL | fn empty<T: Empty>(_: T) {} + | ^^^^^ required by this bound in `empty` + +error[E0277]: the trait bound `(): bad_on_unimplemented::WrongDelim` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:26:17 + | +LL | wrong_delim(()); + | ----------- ^^ the trait `bad_on_unimplemented::WrongDelim` is not implemented for `()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `wrong_delim` + --> $DIR/malformed_foreign_on_unimplemented.rs:15:19 + | +LL | fn wrong_delim<T: WrongDelim>(_: T) {} + | ^^^^^^^^^^ required by this bound in `wrong_delim` + +error[E0277]: the trait bound `(): bad_on_unimplemented::BadFormatter<()>` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:27:19 + | +LL | bad_formatter(()); + | ------------- ^^ () + | | + | required by a bound introduced by this call + | + = help: the trait `bad_on_unimplemented::BadFormatter<()>` is not implemented for `()` +note: required by a bound in `bad_formatter` + --> $DIR/malformed_foreign_on_unimplemented.rs:16:21 + | +LL | fn bad_formatter<T: BadFormatter<()>>(_: T) {} + | ^^^^^^^^^^^^^^^^ required by this bound in `bad_formatter` + +error[E0277]: the trait bound `(): bad_on_unimplemented::NoImplicitArgs` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:28:22 + | +LL | no_implicit_args(()); + | ---------------- ^^ test {} + | | + | required by a bound introduced by this call + | + = help: the trait `bad_on_unimplemented::NoImplicitArgs` is not implemented for `()` +note: required by a bound in `no_implicit_args` + --> $DIR/malformed_foreign_on_unimplemented.rs:17:24 + | +LL | fn no_implicit_args<T: NoImplicitArgs>(_: T) {} + | ^^^^^^^^^^^^^^ required by this bound in `no_implicit_args` + +error[E0277]: the trait bound `(): bad_on_unimplemented::MissingArg` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:29:17 + | +LL | missing_arg(()); + | ----------- ^^ {missing} + | | + | required by a bound introduced by this call + | + = help: the trait `bad_on_unimplemented::MissingArg` is not implemented for `()` +note: required by a bound in `missing_arg` + --> $DIR/malformed_foreign_on_unimplemented.rs:18:19 + | +LL | fn missing_arg<T: MissingArg>(_: T) {} + | ^^^^^^^^^^ required by this bound in `missing_arg` + +error[E0277]: the trait bound `(): bad_on_unimplemented::BadArg` is not satisfied + --> $DIR/malformed_foreign_on_unimplemented.rs:30:13 + | +LL | bad_arg(()); + | ------- ^^ {_} + | | + | required by a bound introduced by this call + | + = help: the trait `bad_on_unimplemented::BadArg` is not implemented for `()` +note: required by a bound in `bad_arg` + --> $DIR/malformed_foreign_on_unimplemented.rs:19:15 + | +LL | fn bad_arg<T: BadArg>(_: T) {} + | ^^^^^^ required by this bound in `bad_arg` + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/did_you_mean/compatible-variants.stderr b/tests/ui/did_you_mean/compatible-variants.stderr index f2bbd8ced8f..2c75537ca19 100644 --- a/tests/ui/did_you_mean/compatible-variants.stderr +++ b/tests/ui/did_you_mean/compatible-variants.stderr @@ -11,6 +11,7 @@ LL | | } | = note: expected enum `Option<()>` found unit type `()` + = note: `while` loops evaluate to unit type `()` help: try adding an expression at the end of the block | LL ~ } @@ -49,6 +50,7 @@ LL | | } | = note: expected enum `Option<()>` found unit type `()` + = note: `for` loops evaluate to unit type `()` help: try adding an expression at the end of the block | LL ~ } @@ -106,6 +108,7 @@ LL | while false {} | = note: expected enum `Option<()>` found unit type `()` + = note: `while` loops evaluate to unit type `()` help: try adding an expression at the end of the block | LL ~ while false {} diff --git a/tests/ui/dyn-star/param-env-region-infer.current.stderr b/tests/ui/dyn-star/param-env-region-infer.current.stderr index b50117c1efb..6e464c17014 100644 --- a/tests/ui/dyn-star/param-env-region-infer.current.stderr +++ b/tests/ui/dyn-star/param-env-region-infer.current.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/param-env-region-infer.rs:19:10 + --> $DIR/param-env-region-infer.rs:20:10 | LL | t as _ | ^ cannot infer type diff --git a/tests/ui/dyn-star/param-env-region-infer.rs b/tests/ui/dyn-star/param-env-region-infer.rs index c53861065c7..842964ad284 100644 --- a/tests/ui/dyn-star/param-env-region-infer.rs +++ b/tests/ui/dyn-star/param-env-region-infer.rs @@ -1,9 +1,10 @@ //@ revisions: current //@ incremental -// FIXME(-Znext-solver): THis currently results in unstable query results: +// FIXME(-Znext-solver): This currently results in unstable query results: // `normalizes-to(opaque, opaque)` changes from `Maybe(Ambiguous)` to `Maybe(Overflow)` // once the hidden type of the opaque is already defined to be itself. +//@ unused-revision-names: next // checks that we don't ICE if there are region inference variables in the environment // when computing `PointerLike` builtin candidates. diff --git a/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.rs b/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.rs deleted file mode 100644 index ded08b93fe8..00000000000 --- a/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub fn main() { - match 22 { - 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental - _ => {} - } -} diff --git a/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr b/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr deleted file mode 100644 index 5e3d34aa9f3..00000000000 --- a/tests/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/feature-gate-exclusive-range-pattern.rs:3:9 - | -LL | 0 .. 3 => {} - | ^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs new file mode 100644 index 00000000000..dda317aecc3 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.rs @@ -0,0 +1,99 @@ +#![allow(dead_code)] +#![deny(improper_ctypes)] +#![feature(ptr_internals)] + +use std::num; + +enum Z {} + +#[repr(transparent)] +struct TransparentStruct<T>(T, std::marker::PhantomData<Z>); + +#[repr(transparent)] +enum TransparentEnum<T> { + Variant(T, std::marker::PhantomData<Z>), +} + +struct NoField; + +extern "C" { + fn result_ref_t(x: Result<&'static u8, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_fn_t(x: Result<extern "C" fn(), ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); + //~^ ERROR `extern` block uses type `Result + fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + //~^ ERROR `extern` block uses type `Result + fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); + //~^ ERROR `extern` block uses type `Result + fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); + //~^ ERROR `extern` block uses type `Result + + fn result_ref_e(x: Result<(), &'static u8>); + //~^ ERROR `extern` block uses type `Result + fn result_fn_e(x: Result<(), extern "C" fn()>); + //~^ ERROR `extern` block uses type `Result + fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); + //~^ ERROR `extern` block uses type `Result + fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); + //~^ ERROR `extern` block uses type `Result + fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); + //~^ ERROR `extern` block uses type `Result + fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type `Result + fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type `Result + fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + //~^ ERROR `extern` block uses type `Result + fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type `Result + fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type `Result +} + +pub fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr new file mode 100644 index 00000000000..94416eb99c8 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-result_ffi_guarantees.stderr @@ -0,0 +1,349 @@ +error: `extern` block uses type `Result<&u8, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:20:24 + | +LL | fn result_ref_t(x: Result<&'static u8, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint +note: the lint level is defined here + --> $DIR/feature-gate-result_ffi_guarantees.rs:2:9 + | +LL | #![deny(improper_ctypes)] + | ^^^^^^^^^^^^^^^ + +error: `extern` block uses type `Result<extern "C" fn(), ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:22:23 + | +LL | fn result_fn_t(x: Result<extern "C" fn(), ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonNull<u8>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:24:28 + | +LL | fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<Unique<u8>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:26:27 + | +LL | fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:28:31 + | +LL | fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u16>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:30:32 + | +LL | fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u32>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:32:32 + | +LL | fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u64>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:34:32 + | +LL | fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<usize>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:36:34 + | +LL | fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<i8>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:38:31 + | +LL | fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<i16>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:40:32 + | +LL | fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<i32>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:42:32 + | +LL | fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<i64>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:44:32 + | +LL | fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<isize>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:46:34 + | +LL | fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<TransparentStruct<NonZero<u8>>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:48:39 + | +LL | fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<TransparentEnum<NonZero<u8>>, ()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:50:37 + | +LL | fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, PhantomData<()>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:52:28 + | +LL | fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, Z>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:54:47 + | +LL | fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, NoField>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:56:45 + | +LL | fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), &u8>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:59:24 + | +LL | fn result_ref_e(x: Result<(), &'static u8>); + | ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), extern "C" fn()>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:61:23 + | +LL | fn result_fn_e(x: Result<(), extern "C" fn()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonNull<u8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:63:28 + | +LL | fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), Unique<u8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:65:27 + | +LL | fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<u8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:67:31 + | +LL | fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<u16>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:69:32 + | +LL | fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<u32>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:71:32 + | +LL | fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<u64>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:73:32 + | +LL | fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<usize>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:75:34 + | +LL | fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<i8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:77:31 + | +LL | fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<i16>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:79:32 + | +LL | fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:81:32 + | +LL | fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<i64>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:83:32 + | +LL | fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), NonZero<isize>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:85:34 + | +LL | fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), TransparentStruct<NonZero<u8>>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:87:39 + | +LL | fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), TransparentEnum<NonZero<u8>>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:89:37 + | +LL | fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, PhantomData<()>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:91:28 + | +LL | fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<Z, NonZero<u8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:93:47 + | +LL | fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NoField, NonZero<u8>>`, which is not FFI-safe + --> $DIR/feature-gate-result_ffi_guarantees.rs:95:45 + | +LL | fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: aborting due to 38 previous errors + diff --git a/tests/ui/for-loop-while/break-while-condition.stderr b/tests/ui/for-loop-while/break-while-condition.stderr index 48b29f44fa1..07a57424575 100644 --- a/tests/ui/for-loop-while/break-while-condition.stderr +++ b/tests/ui/for-loop-while/break-while-condition.stderr @@ -20,6 +20,12 @@ LL | | } | = note: expected type `!` found unit type `()` + = note: `while` loops evaluate to unit type `()` +help: consider adding a diverging expression here + | +LL ~ } +LL + /* `loop {}` or `panic!("...")` */ + | error[E0308]: mismatched types --> $DIR/break-while-condition.rs:24:13 @@ -31,14 +37,12 @@ LL | | } | = note: expected type `!` found unit type `()` -note: the function expects a value to always be returned, but loops might run zero times - --> $DIR/break-while-condition.rs:24:13 + = note: `while` loops evaluate to unit type `()` +help: consider adding a diverging expression here + | +LL ~ } +LL + /* `loop {}` or `panic!("...")` */ | -LL | while false { - | ^^^^^^^^^^^ this might have zero elements to iterate on -LL | return - | ------ if the loop doesn't execute, this value would never get returned - = help: return a value for the case when the loop has zero elements to iterate on, otherwise consider changing the return type to account for that possibility error: aborting due to 3 previous errors diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.rs b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.rs index b2e9ffb5772..dd4fe7c78b7 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.rs +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.rs @@ -1,5 +1,4 @@ #![feature(half_open_range_patterns_in_slices)] -#![feature(exclusive_range_pattern)] fn main() { match [5..4, 99..105, 43..44] { diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr index 357d3a4a124..5ee31a0a23b 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/exclusive_range_pattern_syntax_collision.rs:6:13 + --> $DIR/exclusive_range_pattern_syntax_collision.rs:5:13 | LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.rs b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.rs index 20f4d8f882a..1b06181464f 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.rs +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.rs @@ -1,5 +1,4 @@ #![feature(half_open_range_patterns_in_slices)] -#![feature(exclusive_range_pattern)] fn main() { match [5..4, 99..105, 43..44] { diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr index 6f56ecd4c1c..9ad6d5363ad 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr @@ -1,11 +1,11 @@ error[E0527]: pattern requires 2 elements but array has 3 - --> $DIR/exclusive_range_pattern_syntax_collision2.rs:6:9 + --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:9 | LL | [_, 99..] => {}, | ^^^^^^^^^ expected 3 elements error[E0308]: mismatched types - --> $DIR/exclusive_range_pattern_syntax_collision2.rs:6:13 + --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:13 | LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.rs b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.rs index 14ca07d0a53..a3aca8dfac7 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.rs +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - fn main() { match [5..4, 99..105, 43..44] { [..9, 99..100, _] => {}, diff --git a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr index b9b272c4c7c..4a4a4c00b2e 100644 --- a/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr +++ b/tests/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:12 + --> $DIR/exclusive_range_pattern_syntax_collision3.rs:3:12 | LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` @@ -10,7 +10,7 @@ LL | [..9, 99..100, _] => {}, found type `{integer}` error[E0308]: mismatched types - --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:15 + --> $DIR/exclusive_range_pattern_syntax_collision3.rs:3:15 | LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` @@ -23,7 +23,7 @@ LL | [..9, 99..100, _] => {}, found type `{integer}` error[E0308]: mismatched types - --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:19 + --> $DIR/exclusive_range_pattern_syntax_collision3.rs:3:19 | LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` diff --git a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs index 99de7845d7b..a7b0ca6fe4a 100644 --- a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs +++ b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - fn main() { let xs = [13, 1, 5, 2, 3, 1, 21, 8]; let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; diff --git a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr index b011044f4dd..af11bc82d0c 100644 --- a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr +++ b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr @@ -1,5 +1,5 @@ error[E0658]: `X..` patterns in slices are experimental - --> $DIR/feature-gate-half-open-range-patterns-in-slices.rs:5:10 + --> $DIR/feature-gate-half-open-range-patterns-in-slices.rs:3:10 | LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; | ^^^^^^^ @@ -9,7 +9,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0005]: refutable pattern in local binding - --> $DIR/feature-gate-half-open-range-patterns-in-slices.rs:5:9 + --> $DIR/feature-gate-half-open-range-patterns-in-slices.rs:3:9 | LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `[i32::MIN..=2_i32, ..]` not covered diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs index 17ea2b13f69..b133e32452f 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - fn main() { let "a".. = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns let .."a" = "a"; //~ ERROR only `char` and numeric types are allowed in range patterns diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr index f7c59a19619..c14c38eca6e 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr @@ -1,17 +1,17 @@ error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/half-open-range-pats-bad-types.rs:4:9 + --> $DIR/half-open-range-pats-bad-types.rs:2:9 | LL | let "a".. = "a"; | ^^^ this is of type `&'static str` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/half-open-range-pats-bad-types.rs:5:11 + --> $DIR/half-open-range-pats-bad-types.rs:3:11 | LL | let .."a" = "a"; | ^^^ this is of type `&'static str` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/half-open-range-pats-bad-types.rs:6:12 + --> $DIR/half-open-range-pats-bad-types.rs:4:12 | LL | let ..="a" = "a"; | ^^^ this is of type `&'static str` but it should be `char` or numeric diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs index 9d067229b6d..2059c9707d2 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs @@ -1,6 +1,5 @@ // Test various non-exhaustive matches for `X..`, `..=X` and `..X` ranges. -#![feature(exclusive_range_pattern)] #![allow(non_contiguous_range_endpoints)] fn main() {} diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index bb4c2a4c523..78970f8c649 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:15:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:14:8 | LL | m!(0f32, f32::NEG_INFINITY..); | ^^^^ pattern `_` not covered @@ -11,7 +11,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:16:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:15:8 | LL | m!(0f32, ..f32::INFINITY); | ^^^^ pattern `_` not covered @@ -23,7 +23,7 @@ LL | match $s { $($t)+ => {}, _ => todo!() } | ++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:25:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:24:8 | LL | m!('a', ..core::char::MAX); | ^^^ pattern `'\u{10ffff}'` not covered @@ -35,7 +35,7 @@ LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:25:8 | LL | m!('a', ..ALMOST_MAX); | ^^^ pattern `'\u{10fffe}'..='\u{10ffff}'` not covered @@ -47,7 +47,7 @@ LL | match $s { $($t)+ => {}, '\u{10fffe}'..='\u{10ffff}' => todo!() } | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\0'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 | LL | m!('a', ALMOST_MIN..); | ^^^ pattern `'\0'` not covered @@ -59,7 +59,7 @@ LL | match $s { $($t)+ => {}, '\0' => todo!() } | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 | LL | m!('a', ..=ALMOST_MAX); | ^^^ pattern `'\u{10ffff}'` not covered @@ -71,7 +71,7 @@ LL | match $s { $($t)+ => {}, '\u{10ffff}' => todo!() } | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `'b'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 | LL | m!('a', ..=VAL | VAL_2..); | ^^^ pattern `'b'` not covered @@ -83,7 +83,7 @@ LL | match $s { $($t)+ => {}, 'b' => todo!() } | ++++++++++++++++ error[E0004]: non-exhaustive patterns: `'b'` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 | LL | m!('a', ..VAL_1 | VAL_2..); | ^^^ pattern `'b'` not covered @@ -95,7 +95,7 @@ LL | match $s { $($t)+ => {}, 'b' => todo!() } | ++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:40:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:39:12 | LL | m!(0, ..u8::MAX); | ^ pattern `u8::MAX` not covered @@ -107,7 +107,7 @@ LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `254_u8..=u8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:40:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `254_u8..=u8::MAX` not covered @@ -119,7 +119,7 @@ LL | match $s { $($t)+ => {}, 254_u8..=u8::MAX => todo!() } | +++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u8` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u8` not covered @@ -131,7 +131,7 @@ LL | match $s { $($t)+ => {}, 0_u8 => todo!() } | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u8::MAX` not covered @@ -143,7 +143,7 @@ LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u8` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u8` not covered @@ -155,7 +155,7 @@ LL | match $s { $($t)+ => {}, 43_u8 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u8` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u8` not covered @@ -167,7 +167,7 @@ LL | match $s { $($t)+ => {}, 43_u8 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:53:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:52:12 | LL | m!(0, ..u16::MAX); | ^ pattern `u16::MAX` not covered @@ -179,7 +179,7 @@ LL | match $s { $($t)+ => {}, u16::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `65534_u16..=u16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:53:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `65534_u16..=u16::MAX` not covered @@ -191,7 +191,7 @@ LL | match $s { $($t)+ => {}, 65534_u16..=u16::MAX => todo!() } | +++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u16` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u16` not covered @@ -203,7 +203,7 @@ LL | match $s { $($t)+ => {}, 0_u16 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u16::MAX` not covered @@ -215,7 +215,7 @@ LL | match $s { $($t)+ => {}, u16::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u16` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u16` not covered @@ -227,7 +227,7 @@ LL | match $s { $($t)+ => {}, 43_u16 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u16` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u16` not covered @@ -239,7 +239,7 @@ LL | match $s { $($t)+ => {}, 43_u16 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:66:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:65:12 | LL | m!(0, ..u32::MAX); | ^ pattern `u32::MAX` not covered @@ -251,7 +251,7 @@ LL | match $s { $($t)+ => {}, u32::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `4294967294_u32..=u32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:66:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `4294967294_u32..=u32::MAX` not covered @@ -263,7 +263,7 @@ LL | match $s { $($t)+ => {}, 4294967294_u32..=u32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u32` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u32` not covered @@ -275,7 +275,7 @@ LL | match $s { $($t)+ => {}, 0_u32 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u32::MAX` not covered @@ -287,7 +287,7 @@ LL | match $s { $($t)+ => {}, u32::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u32` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u32` not covered @@ -299,7 +299,7 @@ LL | match $s { $($t)+ => {}, 43_u32 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u32` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u32` not covered @@ -311,7 +311,7 @@ LL | match $s { $($t)+ => {}, 43_u32 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:79:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:78:12 | LL | m!(0, ..u64::MAX); | ^ pattern `u64::MAX` not covered @@ -323,7 +323,7 @@ LL | match $s { $($t)+ => {}, u64::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `18446744073709551614_u64..=u64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:79:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `18446744073709551614_u64..=u64::MAX` not covered @@ -335,7 +335,7 @@ LL | match $s { $($t)+ => {}, 18446744073709551614_u64..=u64::MAX => tod | ++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u64` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u64` not covered @@ -347,7 +347,7 @@ LL | match $s { $($t)+ => {}, 0_u64 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u64::MAX` not covered @@ -359,7 +359,7 @@ LL | match $s { $($t)+ => {}, u64::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u64` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u64` not covered @@ -371,7 +371,7 @@ LL | match $s { $($t)+ => {}, 43_u64 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u64` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u64` not covered @@ -383,7 +383,7 @@ LL | match $s { $($t)+ => {}, 43_u64 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:92:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:91:12 | LL | m!(0, ..u128::MAX); | ^ pattern `u128::MAX` not covered @@ -395,7 +395,7 @@ LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454_u128..` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:92:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `340282366920938463463374607431768211454_u128..` not covered @@ -407,7 +407,7 @@ LL | match $s { $($t)+ => {}, 340282366920938463463374607431768211454_u1 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u128` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `0_u128` not covered @@ -419,7 +419,7 @@ LL | match $s { $($t)+ => {}, 0_u128 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u128::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `u128::MAX` not covered @@ -431,7 +431,7 @@ LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u128` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_u128` not covered @@ -443,7 +443,7 @@ LL | match $s { $($t)+ => {}, 43_u128 => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_u128` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_u128` not covered @@ -455,7 +455,7 @@ LL | match $s { $($t)+ => {}, 43_u128 => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:108:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:107:12 | LL | m!(0, ..i8::MAX); | ^ pattern `i8::MAX` not covered @@ -467,7 +467,7 @@ LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `126_i8..=i8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:108:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `126_i8..=i8::MAX` not covered @@ -479,7 +479,7 @@ LL | match $s { $($t)+ => {}, 126_i8..=i8::MAX => todo!() } | +++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `i8::MIN` not covered @@ -491,7 +491,7 @@ LL | match $s { $($t)+ => {}, i8::MIN => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i8::MAX` not covered @@ -503,7 +503,7 @@ LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i8` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i8` not covered @@ -515,7 +515,7 @@ LL | match $s { $($t)+ => {}, 43_i8 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i8` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i8` not covered @@ -527,7 +527,7 @@ LL | match $s { $($t)+ => {}, 43_i8 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:121:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:120:12 | LL | m!(0, ..i16::MAX); | ^ pattern `i16::MAX` not covered @@ -539,7 +539,7 @@ LL | match $s { $($t)+ => {}, i16::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `32766_i16..=i16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:121:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `32766_i16..=i16::MAX` not covered @@ -551,7 +551,7 @@ LL | match $s { $($t)+ => {}, 32766_i16..=i16::MAX => todo!() } | +++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MIN` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `i16::MIN` not covered @@ -563,7 +563,7 @@ LL | match $s { $($t)+ => {}, i16::MIN => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i16::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i16::MAX` not covered @@ -575,7 +575,7 @@ LL | match $s { $($t)+ => {}, i16::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i16` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i16` not covered @@ -587,7 +587,7 @@ LL | match $s { $($t)+ => {}, 43_i16 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i16` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i16` not covered @@ -599,7 +599,7 @@ LL | match $s { $($t)+ => {}, 43_i16 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:134:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:133:12 | LL | m!(0, ..i32::MAX); | ^ pattern `i32::MAX` not covered @@ -611,7 +611,7 @@ LL | match $s { $($t)+ => {}, i32::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `2147483646_i32..=i32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:134:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `2147483646_i32..=i32::MAX` not covered @@ -623,7 +623,7 @@ LL | match $s { $($t)+ => {}, 2147483646_i32..=i32::MAX => todo!() } | ++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MIN` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `i32::MIN` not covered @@ -635,7 +635,7 @@ LL | match $s { $($t)+ => {}, i32::MIN => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i32::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i32::MAX` not covered @@ -647,7 +647,7 @@ LL | match $s { $($t)+ => {}, i32::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i32` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i32` not covered @@ -659,7 +659,7 @@ LL | match $s { $($t)+ => {}, 43_i32 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i32` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i32` not covered @@ -671,7 +671,7 @@ LL | match $s { $($t)+ => {}, 43_i32 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:147:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:146:12 | LL | m!(0, ..i64::MAX); | ^ pattern `i64::MAX` not covered @@ -683,7 +683,7 @@ LL | match $s { $($t)+ => {}, i64::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `9223372036854775806_i64..=i64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:147:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `9223372036854775806_i64..=i64::MAX` not covered @@ -695,7 +695,7 @@ LL | match $s { $($t)+ => {}, 9223372036854775806_i64..=i64::MAX => todo | +++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MIN` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `i64::MIN` not covered @@ -707,7 +707,7 @@ LL | match $s { $($t)+ => {}, i64::MIN => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i64::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i64::MAX` not covered @@ -719,7 +719,7 @@ LL | match $s { $($t)+ => {}, i64::MAX => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i64` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i64` not covered @@ -731,7 +731,7 @@ LL | match $s { $($t)+ => {}, 43_i64 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i64` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i64` not covered @@ -743,7 +743,7 @@ LL | match $s { $($t)+ => {}, 43_i64 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:160:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:159:12 | LL | m!(0, ..i128::MAX); | ^ pattern `i128::MAX` not covered @@ -755,7 +755,7 @@ LL | match $s { $($t)+ => {}, i128::MAX => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726_i128..` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:160:12 | LL | m!(0, ..ALMOST_MAX); | ^ pattern `170141183460469231731687303715884105726_i128..` not covered @@ -767,7 +767,7 @@ LL | match $s { $($t)+ => {}, 170141183460469231731687303715884105726_i1 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MIN` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 | LL | m!(0, ALMOST_MIN..); | ^ pattern `i128::MIN` not covered @@ -779,7 +779,7 @@ LL | match $s { $($t)+ => {}, i128::MIN => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i128::MAX` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 | LL | m!(0, ..=ALMOST_MAX); | ^ pattern `i128::MAX` not covered @@ -791,7 +791,7 @@ LL | match $s { $($t)+ => {}, i128::MAX => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i128` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 | LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43_i128` not covered @@ -803,7 +803,7 @@ LL | match $s { $($t)+ => {}, 43_i128 => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `43_i128` not covered - --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 + --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 | LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43_i128` not covered diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs index fe2db67013e..0d92ff90cc5 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-exhaustive-pass.rs @@ -2,8 +2,6 @@ // Test various exhaustive matches for `X..`, `..=X` and `..X` ranges. -#![feature(exclusive_range_pattern)] - fn main() {} macro_rules! m { diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs index 03ff706fe6a..3487bac5282 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs @@ -3,7 +3,6 @@ // Test half-open range patterns against their expression equivalents // via `.contains(...)` and make sure the dynamic semantics match. -#![feature(exclusive_range_pattern)] #![allow(unreachable_patterns)] macro_rules! yes { diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs index 98e8b2b0462..4e3fffbef2d 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs @@ -2,8 +2,6 @@ // Test the parsing of half-open ranges. -#![feature(exclusive_range_pattern)] - fn main() {} #[cfg(FALSE)] diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs index 158da650966..9ca8dd25ed7 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - macro_rules! m { ($s:expr, $($t:tt)+) => { match $s { $($t)+ => {} } diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr index 169e776fc20..668b5c858f0 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.stderr @@ -1,77 +1,77 @@ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:10:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:8:11 | LL | m!(0, ..u8::MIN); | ^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:12:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:10:11 | LL | m!(0, ..u16::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:12:11 | LL | m!(0, ..u32::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:16:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11 | LL | m!(0, ..u64::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:18:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:16:11 | LL | m!(0, ..u128::MIN); | ^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:21:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:19:11 | LL | m!(0, ..i8::MIN); | ^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:21:11 | LL | m!(0, ..i16::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:25:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11 | LL | m!(0, ..i32::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:25:11 | LL | m!(0, ..i64::MIN); | ^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:29:11 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11 | LL | m!(0, ..i128::MIN); | ^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:32:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:30:14 | LL | m!(0f32, ..f32::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:34:14 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:32:14 | LL | m!(0f64, ..f64::NEG_INFINITY); | ^^^^^^^^^^^^^^^^^^^ error[E0579]: lower range bound must be less than upper - --> $DIR/half-open-range-pats-thir-lower-empty.rs:37:13 + --> $DIR/half-open-range-pats-thir-lower-empty.rs:35:13 | LL | m!('a', ..'\u{0}'); | ^^^^^^^^^ diff --git a/tests/ui/half-open-range-patterns/pat-tuple-4.rs b/tests/ui/half-open-range-patterns/pat-tuple-4.rs index 95aae25ada8..325293aa486 100644 --- a/tests/ui/half-open-range-patterns/pat-tuple-4.rs +++ b/tests/ui/half-open-range-patterns/pat-tuple-4.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(exclusive_range_pattern)] - fn main() { const PAT: u8 = 1; diff --git a/tests/ui/half-open-range-patterns/pat-tuple-5.rs b/tests/ui/half-open-range-patterns/pat-tuple-5.rs index 995ef03c83e..4ed43954e02 100644 --- a/tests/ui/half-open-range-patterns/pat-tuple-5.rs +++ b/tests/ui/half-open-range-patterns/pat-tuple-5.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - fn main() { const PAT: u8 = 1; diff --git a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr index a7dd4139792..e6d33947d46 100644 --- a/tests/ui/half-open-range-patterns/pat-tuple-5.stderr +++ b/tests/ui/half-open-range-patterns/pat-tuple-5.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pat-tuple-5.rs:7:10 + --> $DIR/pat-tuple-5.rs:5:10 | LL | match (0, 1) { | ------ this expression has type `({integer}, {integer})` diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions0.rs b/tests/ui/half-open-range-patterns/range_pat_interactions0.rs index 53b6b89ed16..f943ea0271d 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions0.rs +++ b/tests/ui/half-open-range-patterns/range_pat_interactions0.rs @@ -1,6 +1,5 @@ //@ run-pass #![allow(non_contiguous_range_endpoints)] -#![feature(exclusive_range_pattern)] #![feature(inline_const_pat)] fn main() { diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions1.rs b/tests/ui/half-open-range-patterns/range_pat_interactions1.rs index 0c050c550c4..4d7c9f10261 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions1.rs +++ b/tests/ui/half-open-range-patterns/range_pat_interactions1.rs @@ -9,26 +9,19 @@ fn main() { for x in -9 + 1..=(9 - 2) { if let n @ 2..3|4 = x { //~^ error: variable `n` is not bound in all patterns - //~| exclusive range pattern syntax is experimental errors_only.push(x); } else if let 2..3 | 4 = x { - //~^ exclusive range pattern syntax is experimental if_lettable.push(x); } match x as i32 { 0..5+1 => errors_only.push(x), //~^ error: expected a pattern range bound, found an expression - //~| error: exclusive range pattern syntax is experimental 1 | -3..0 => first_or.push(x), - //~^ error: exclusive range pattern syntax is experimental y @ (0..5 | 6) => or_two.push(y), - //~^ error: exclusive range pattern syntax is experimental y @ 0..const { 5 + 1 } => assert_eq!(y, 5), - //~^ error: exclusive range pattern syntax is experimental - //~| error: inline-const in pattern position is experimental + //~^ error: inline-const in pattern position is experimental [E0658] y @ -5.. => range_from.push(y), y @ ..-7 => assert_eq!(y, -8), - //~^ error: exclusive range pattern syntax is experimental y => bottom.push(y), } } diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions1.stderr b/tests/ui/half-open-range-patterns/range_pat_interactions1.stderr index cc481f7a79e..c14021e009b 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions1.stderr +++ b/tests/ui/half-open-range-patterns/range_pat_interactions1.stderr @@ -1,5 +1,5 @@ error: expected a pattern range bound, found an expression - --> $DIR/range_pat_interactions1.rs:19:16 + --> $DIR/range_pat_interactions1.rs:17:16 | LL | 0..5+1 => errors_only.push(x), | ^^^ arbitrary expressions are not allowed in patterns @@ -13,7 +13,7 @@ LL | if let n @ 2..3|4 = x { | variable not in all patterns error[E0658]: inline-const in pattern position is experimental - --> $DIR/range_pat_interactions1.rs:26:20 + --> $DIR/range_pat_interactions1.rs:21:20 | LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), | ^^^^^ @@ -22,84 +22,7 @@ LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), = help: add `#![feature(inline_const_pat)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:10:20 - | -LL | if let n @ 2..3|4 = x { - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:14:23 - | -LL | } else if let 2..3 | 4 = x { - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:19:13 - | -LL | 0..5+1 => errors_only.push(x), - | ^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:22:17 - | -LL | 1 | -3..0 => first_or.push(x), - | ^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:24:18 - | -LL | y @ (0..5 | 6) => or_two.push(y), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:26:17 - | -LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), - | ^^^^^^^^^^^^^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions1.rs:30:17 - | -LL | y @ ..-7 => assert_eq!(y, -8), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error: aborting due to 10 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0408, E0658. For more information about an error, try `rustc --explain E0408`. diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions2.rs b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs index 068104c4b1b..0dbdb8fe7b6 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions2.rs +++ b/tests/ui/half-open-range-patterns/range_pat_interactions2.rs @@ -11,15 +11,11 @@ fn main() { //~^ error: expected a pattern range bound, found an expression //~| error: range pattern bounds cannot have parentheses 1 | -3..0 => first_or.push(x), - //~^ error: exclusive range pattern syntax is experimental y @ (0..5 | 6) => or_two.push(y), - //~^ error: exclusive range pattern syntax is experimental y @ 0..const { 5 + 1 } => assert_eq!(y, 5), //~^ error: inline-const in pattern position is experimental - //~| error: exclusive range pattern syntax is experimental y @ -5.. => range_from.push(y), y @ ..-7 => assert_eq!(y, -8), - //~^ error: exclusive range pattern syntax is experimental y => bottom.push(y), } } diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr b/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr index 8f21a6149fb..136296fa5b0 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr +++ b/tests/ui/half-open-range-patterns/range_pat_interactions2.stderr @@ -17,7 +17,7 @@ LL + 0..=5+1 => errors_only.push(x), | error[E0658]: inline-const in pattern position is experimental - --> $DIR/range_pat_interactions2.rs:17:20 + --> $DIR/range_pat_interactions2.rs:15:20 | LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), | ^^^^^ @@ -26,50 +26,6 @@ LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), = help: add `#![feature(inline_const_pat)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions2.rs:13:17 - | -LL | 1 | -3..0 => first_or.push(x), - | ^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions2.rs:15:18 - | -LL | y @ (0..5 | 6) => or_two.push(y), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions2.rs:17:17 - | -LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), - | ^^^^^^^^^^^^^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions2.rs:21:17 - | -LL | y @ ..-7 => assert_eq!(y, -8), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error: aborting due to 7 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions3.rs b/tests/ui/half-open-range-patterns/range_pat_interactions3.rs index 446ed45f9c6..2f2778095cf 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions3.rs +++ b/tests/ui/half-open-range-patterns/range_pat_interactions3.rs @@ -8,15 +8,11 @@ fn main() { match x as i32 { 8.. => bottom.push(x), 1 | -3..0 => first_or.push(x), - //~^ exclusive range pattern syntax is experimental y @ (0..5 | 6) => or_two.push(y), - //~^ exclusive range pattern syntax is experimental y @ 0..const { 5 + 1 } => assert_eq!(y, 5), //~^ inline-const in pattern position is experimental - //~| exclusive range pattern syntax is experimental y @ -5.. => range_from.push(y), y @ ..-7 => assert_eq!(y, -8), - //~^ exclusive range pattern syntax is experimental y => bottom.push(y), } } diff --git a/tests/ui/half-open-range-patterns/range_pat_interactions3.stderr b/tests/ui/half-open-range-patterns/range_pat_interactions3.stderr index 51cc22e7d56..dc7dc0efa7a 100644 --- a/tests/ui/half-open-range-patterns/range_pat_interactions3.stderr +++ b/tests/ui/half-open-range-patterns/range_pat_interactions3.stderr @@ -1,5 +1,5 @@ error[E0658]: inline-const in pattern position is experimental - --> $DIR/range_pat_interactions3.rs:14:20 + --> $DIR/range_pat_interactions3.rs:12:20 | LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), | ^^^^^ @@ -8,50 +8,6 @@ LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), = help: add `#![feature(inline_const_pat)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions3.rs:10:17 - | -LL | 1 | -3..0 => first_or.push(x), - | ^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions3.rs:12:18 - | -LL | y @ (0..5 | 6) => or_two.push(y), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions3.rs:14:17 - | -LL | y @ 0..const { 5 + 1 } => assert_eq!(y, 5), - | ^^^^^^^^^^^^^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range_pat_interactions3.rs:18:17 - | -LL | y @ ..-7 => assert_eq!(y, -8), - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error: aborting due to 5 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs index d54cbfbf4bb..aa2690f3777 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs @@ -1,5 +1,4 @@ #![feature(half_open_range_patterns_in_slices)] -#![feature(exclusive_range_pattern)] fn main() { let xs = [13, 1, 5, 2, 3, 1, 21, 8]; diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.stderr b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.stderr index eca5c330180..5bcbe21a6a9 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.stderr +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.stderr @@ -1,5 +1,5 @@ error[E0527]: pattern requires 2 elements but array has 8 - --> $DIR/slice_pattern_syntax_problem0.rs:11:9 + --> $DIR/slice_pattern_syntax_problem0.rs:10:9 | LL | let [first_three @ ..3, rest @ 2..] = xs; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 8 elements diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs index cd381544372..60b056fbcb6 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs @@ -3,7 +3,5 @@ fn main() { let xs = [13, 1, 5, 2, 3, 1, 21, 8]; let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; //~^ `X..` patterns in slices are experimental - //~| exclusive range pattern syntax is experimental - //~| exclusive range pattern syntax is experimental //~| ERROR: refutable pattern } diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr index fc549eb65c0..49515919904 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr @@ -8,28 +8,6 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; = help: add `#![feature(half_open_range_patterns_in_slices)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/slice_pattern_syntax_problem1.rs:4:23 - | -LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; - | ^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/slice_pattern_syntax_problem1.rs:4:32 - | -LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; - | ^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - error[E0005]: refutable pattern in local binding --> $DIR/slice_pattern_syntax_problem1.rs:4:9 | @@ -44,7 +22,7 @@ help: you might want to use `let else` to handle the variant that isn't matched LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs else { todo!() }; | ++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0005, E0658. For more information about an error, try `rustc --explain E0005`. diff --git a/tests/ui/impl-trait/dyn-trait-elided-two-inputs-ref-assoc.rs b/tests/ui/impl-trait/dyn-trait-elided-two-inputs-ref-assoc.rs index 2dc19b9ad68..e9706b656f2 100644 --- a/tests/ui/impl-trait/dyn-trait-elided-two-inputs-ref-assoc.rs +++ b/tests/ui/impl-trait/dyn-trait-elided-two-inputs-ref-assoc.rs @@ -2,6 +2,9 @@ // when there are multiple inputs. The `dyn Bar` should default to `+ // 'static`. This used to erroneously generate an error (cc #62517). // +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass trait Foo { diff --git a/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs b/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs index f7546a05bfd..df03150e29a 100644 --- a/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs +++ b/tests/ui/impl-trait/in-trait/placeholder-implied-bounds.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass pub fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-105826.rs b/tests/ui/impl-trait/issues/issue-105826.rs index e3488140dcc..33c5ed5fdeb 100644 --- a/tests/ui/impl-trait/issues/issue-105826.rs +++ b/tests/ui/impl-trait/issues/issue-105826.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass use std::io::Write; diff --git a/tests/ui/inline-const/const-match-pat-range.rs b/tests/ui/inline-const/const-match-pat-range.rs index 7f51815cb77..7202c0c0452 100644 --- a/tests/ui/inline-const/const-match-pat-range.rs +++ b/tests/ui/inline-const/const-match-pat-range.rs @@ -1,6 +1,6 @@ //@ build-pass -#![feature(inline_const_pat, exclusive_range_pattern)] +#![feature(inline_const_pat)] fn main() { const N: u32 = 10; diff --git a/tests/ui/instrument-coverage/coverage-options.rs b/tests/ui/instrument-coverage/coverage-options.rs index 332da32e435..2a80ce4ab2e 100644 --- a/tests/ui/instrument-coverage/coverage-options.rs +++ b/tests/ui/instrument-coverage/coverage-options.rs @@ -1,5 +1,5 @@ //@ needs-profiler-support -//@ revisions: block branch bad +//@ revisions: block branch mcdc bad //@ compile-flags -Cinstrument-coverage //@ [block] check-pass diff --git a/tests/ui/issues/issue-27042.stderr b/tests/ui/issues/issue-27042.stderr index ba39399e46e..6586e61f2f6 100644 --- a/tests/ui/issues/issue-27042.stderr +++ b/tests/ui/issues/issue-27042.stderr @@ -40,6 +40,8 @@ error[E0308]: mismatched types LL | / 'c: LL | | for _ in None { break }; // but here we cite the whole loop | |_______________________________^ expected `i32`, found `()` + | + = note: `for` loops evaluate to unit type `()` error[E0308]: mismatched types --> $DIR/issue-27042.rs:15:9 diff --git a/tests/ui/issues/issue-50585.stderr b/tests/ui/issues/issue-50585.stderr index 13181f1cf7f..e7f13e63475 100644 --- a/tests/ui/issues/issue-50585.stderr +++ b/tests/ui/issues/issue-50585.stderr @@ -13,6 +13,12 @@ error[E0308]: mismatched types | LL | |y: Vec<[(); for x in 0..2 {}]>| {}; | ^^^^^^^^^^^^^^^^ expected `usize`, found `()` + | + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here + | +LL | |y: Vec<[(); for x in 0..2 {} /* `usize` value */]>| {}; + | +++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs index c60290f8553..cb8e9e80675 100644 --- a/tests/ui/lint/lint-ctypes-enum.rs +++ b/tests/ui/lint/lint-ctypes-enum.rs @@ -2,6 +2,7 @@ #![deny(improper_ctypes)] #![feature(ptr_internals)] #![feature(transparent_unions)] +#![feature(result_ffi_guarantees)] use std::num; @@ -55,38 +56,123 @@ union TransparentUnion<T: Copy> { struct Rust<T>(T); +struct NoField; + +#[repr(transparent)] +struct Field(()); + +#[non_exhaustive] +enum NonExhaustive {} + extern "C" { - fn zf(x: Z); - fn uf(x: U); //~ ERROR `extern` block uses type `U` - fn bf(x: B); //~ ERROR `extern` block uses type `B` - fn tf(x: T); //~ ERROR `extern` block uses type `T` - fn repr_c(x: ReprC); - fn repr_u8(x: U8); - fn repr_isize(x: Isize); - fn option_ref(x: Option<&'static u8>); - fn option_fn(x: Option<extern "C" fn()>); - fn nonnull(x: Option<std::ptr::NonNull<u8>>); - fn unique(x: Option<std::ptr::Unique<u8>>); - fn nonzero_u8(x: Option<num::NonZero<u8>>); - fn nonzero_u16(x: Option<num::NonZero<u16>>); - fn nonzero_u32(x: Option<num::NonZero<u32>>); - fn nonzero_u64(x: Option<num::NonZero<u64>>); - fn nonzero_u128(x: Option<num::NonZero<u128>>); - //~^ ERROR `extern` block uses type `u128` - fn nonzero_usize(x: Option<num::NonZero<usize>>); - fn nonzero_i8(x: Option<num::NonZero<i8>>); - fn nonzero_i16(x: Option<num::NonZero<i16>>); - fn nonzero_i32(x: Option<num::NonZero<i32>>); - fn nonzero_i64(x: Option<num::NonZero<i64>>); - fn nonzero_i128(x: Option<num::NonZero<i128>>); - //~^ ERROR `extern` block uses type `i128` - fn nonzero_isize(x: Option<num::NonZero<isize>>); - fn transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>); - fn transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>); - fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); - //~^ ERROR `extern` block uses type - fn repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type - fn no_result(x: Result<(), num::NonZero<i32>>); //~ ERROR `extern` block uses type + fn zf(x: Z); + fn uf(x: U); //~ ERROR `extern` block uses type `U` + fn bf(x: B); //~ ERROR `extern` block uses type `B` + fn tf(x: T); //~ ERROR `extern` block uses type `T` + fn repr_c(x: ReprC); + fn repr_u8(x: U8); + fn repr_isize(x: Isize); + fn option_ref(x: Option<&'static u8>); + fn option_fn(x: Option<extern "C" fn()>); + fn option_nonnull(x: Option<std::ptr::NonNull<u8>>); + fn option_unique(x: Option<std::ptr::Unique<u8>>); + fn option_nonzero_u8(x: Option<num::NonZero<u8>>); + fn option_nonzero_u16(x: Option<num::NonZero<u16>>); + fn option_nonzero_u32(x: Option<num::NonZero<u32>>); + fn option_nonzero_u64(x: Option<num::NonZero<u64>>); + fn option_nonzero_u128(x: Option<num::NonZero<u128>>); + //~^ ERROR `extern` block uses type `u128` + fn option_nonzero_usize(x: Option<num::NonZero<usize>>); + fn option_nonzero_i8(x: Option<num::NonZero<i8>>); + fn option_nonzero_i16(x: Option<num::NonZero<i16>>); + fn option_nonzero_i32(x: Option<num::NonZero<i32>>); + fn option_nonzero_i64(x: Option<num::NonZero<i64>>); + fn option_nonzero_i128(x: Option<num::NonZero<i128>>); + //~^ ERROR `extern` block uses type `i128` + fn option_nonzero_isize(x: Option<num::NonZero<isize>>); + fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>); + fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>); + fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type + fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type + + fn result_ref_t(x: Result<&'static u8, ()>); + fn result_fn_t(x: Result<extern "C" fn(), ()>); + fn result_nonnull_t(x: Result<std::ptr::NonNull<u8>, ()>); + fn result_unique_t(x: Result<std::ptr::Unique<u8>, ()>); + fn result_nonzero_u8_t(x: Result<num::NonZero<u8>, ()>); + fn result_nonzero_u16_t(x: Result<num::NonZero<u16>, ()>); + fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>); + fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>); + fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); + //~^ ERROR `extern` block uses type `u128` + fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>); + fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>); + fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>); + fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>); + fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>); + fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); + //~^ ERROR `extern` block uses type `i128` + fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>); + fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>); + fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>); + fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>); + //~^ ERROR `extern` block uses type + fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); + //~^ ERROR `extern` block uses type + fn result_phantom_t(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn result_1zst_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, Z>); + fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>); + //~^ ERROR `extern` block uses type + fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>); + //~^ ERROR `extern` block uses type + fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>); + //~^ ERROR `extern` block uses type + fn result_1zst_exhaustive_no_field_t(x: Result<num::NonZero<u8>, NoField>); + fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>); + //~^ ERROR `extern` block uses type + fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); + //~^ ERROR `extern` block uses type + + fn result_ref_e(x: Result<(), &'static u8>); + fn result_fn_e(x: Result<(), extern "C" fn()>); + fn result_nonnull_e(x: Result<(), std::ptr::NonNull<u8>>); + fn result_unique_e(x: Result<(), std::ptr::Unique<u8>>); + fn result_nonzero_u8_e(x: Result<(), num::NonZero<u8>>); + fn result_nonzero_u16_e(x: Result<(), num::NonZero<u16>>); + fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>); + fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>); + fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); + //~^ ERROR `extern` block uses type `u128` + fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>); + fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>); + fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>); + fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>); + fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>); + fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); + //~^ ERROR `extern` block uses type `i128` + fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>); + fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>); + fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>); + fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type + fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type + fn result_phantom_e(x: Result<num::NonZero<u8>, std::marker::PhantomData<()>>); + fn result_1zst_exhaustive_no_variant_e(x: Result<Z, num::NonZero<u8>>); + fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type + fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type + fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type + fn result_1zst_exhaustive_no_field_e(x: Result<NoField, num::NonZero<u8>>); + fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>); + //~^ ERROR `extern` block uses type + fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); + //~^ ERROR `extern` block uses type + fn result_unit_t_e(x: Result<(), ()>); + //~^ ERROR `extern` block uses type } pub fn main() {} diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index 103fda8d402..bba5b09b69c 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -1,13 +1,13 @@ error: `extern` block uses type `U`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:60:13 + --> $DIR/lint-ctypes-enum.rs:69:14 | -LL | fn uf(x: U); - | ^ not FFI-safe +LL | fn uf(x: U); + | ^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:9:1 + --> $DIR/lint-ctypes-enum.rs:10:1 | LL | enum U { | ^^^^^^ @@ -18,75 +18,233 @@ LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ error: `extern` block uses type `B`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:61:13 + --> $DIR/lint-ctypes-enum.rs:70:14 | -LL | fn bf(x: B); - | ^ not FFI-safe +LL | fn bf(x: B); + | ^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:12:1 + --> $DIR/lint-ctypes-enum.rs:13:1 | LL | enum B { | ^^^^^^ error: `extern` block uses type `T`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:62:13 + --> $DIR/lint-ctypes-enum.rs:71:14 | -LL | fn tf(x: T); - | ^ not FFI-safe +LL | fn tf(x: T); + | ^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here - --> $DIR/lint-ctypes-enum.rs:16:1 + --> $DIR/lint-ctypes-enum.rs:17:1 | LL | enum T { | ^^^^^^ error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:74:23 + --> $DIR/lint-ctypes-enum.rs:83:31 | -LL | fn nonzero_u128(x: Option<num::NonZero<u128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe +LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:81:23 + --> $DIR/lint-ctypes-enum.rs:90:31 | -LL | fn nonzero_i128(x: Option<num::NonZero<i128>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe +LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:86:28 + --> $DIR/lint-ctypes-enum.rs:95:36 | -LL | fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe +LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:88:20 + --> $DIR/lint-ctypes-enum.rs:97:28 | -LL | fn repr_rust(x: Option<Rust<num::NonZero<u8>>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe +LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:89:20 +error: `extern` block uses type `u128`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:107:33 + | +LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = note: 128-bit integers don't currently have a known stable ABI + +error: `extern` block uses type `i128`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:114:33 + | +LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = note: 128-bit integers don't currently have a known stable ABI + +error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:119:38 + | +LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:121:30 + | +LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:125:51 + | +LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:127:53 + | +LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:129:51 + | +LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:132:49 + | +LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:134:30 + | +LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `u128`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:145:33 + | +LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = note: 128-bit integers don't currently have a known stable ABI + +error: `extern` block uses type `i128`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:152:33 + | +LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = note: 128-bit integers don't currently have a known stable ABI + +error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:157:38 + | +LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:159:30 + | +LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:163:51 + | +LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:165:53 + | +LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:167:51 + | +LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:170:49 + | +LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:172:30 + | +LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:174:27 | -LL | fn no_result(x: Result<(), num::NonZero<i32>>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe +LL | fn result_unit_t_e(x: Result<(), ()>); + | ^^^^^^^^^^^^^^ not FFI-safe | = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 8 previous errors +error: aborting due to 26 previous errors diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs index d6897ab7b14..87a682249b0 100644 --- a/tests/ui/lint/reference_casting.rs +++ b/tests/ui/lint/reference_casting.rs @@ -247,6 +247,20 @@ unsafe fn bigger_layout() { unsafe fn from_ref(this: &i32) -> &i64 { &*(this as *const i32 as *const i64) } + + // https://github.com/rust-lang/rust/issues/124685 + unsafe fn slice_index(array: &mut [u8], offset: usize) { + let a1 = &mut array[offset]; + let a2 = a1 as *mut u8; + let a3 = a2 as *mut u64; + unsafe { *a3 = 3 }; + } + + unsafe fn field_access(v: &mut Vec3<i32>) { + let r = &mut v.0; + let ptr = r as *mut i32 as *mut Vec3<i32>; + unsafe { *ptr = Vec3(0, 0, 0) } + } } const RAW_PTR: *mut u8 = 1 as *mut u8; diff --git a/tests/crashes/97006.rs b/tests/ui/macros/genercs-in-path-with-prettry-hir.rs index c8dfa52ebee..84370fcebbc 100644 --- a/tests/crashes/97006.rs +++ b/tests/ui/macros/genercs-in-path-with-prettry-hir.rs @@ -1,7 +1,6 @@ -//@ known-bug: #97006 //@ compile-flags: -Zunpretty=hir -#![allow(unused)] +// issue#97006 macro_rules! m { ($attr_path: path) => { diff --git a/tests/ui/macros/genercs-in-path-with-prettry-hir.stderr b/tests/ui/macros/genercs-in-path-with-prettry-hir.stderr new file mode 100644 index 00000000000..8fcc7c6fbff --- /dev/null +++ b/tests/ui/macros/genercs-in-path-with-prettry-hir.stderr @@ -0,0 +1,8 @@ +error: unexpected generic arguments in path + --> $DIR/genercs-in-path-with-prettry-hir.rs:12:10 + | +LL | m!(inline<u8>); + | ^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout b/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout new file mode 100644 index 00000000000..e9ee59abfae --- /dev/null +++ b/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout @@ -0,0 +1,15 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +//@ compile-flags: -Zunpretty=hir + +// issue#97006 + +macro_rules! m { ($attr_path: path) => { #[$attr_path] fn f() {} } } +#[ + +inline] +fn f() { } + +fn main() { } diff --git a/tests/ui/macros/macro-expand-within-generics-in-path.rs b/tests/ui/macros/macro-expand-within-generics-in-path.rs new file mode 100644 index 00000000000..017d5152221 --- /dev/null +++ b/tests/ui/macros/macro-expand-within-generics-in-path.rs @@ -0,0 +1,19 @@ +// issue#123911 +// issue#123912 + +macro_rules! m { + ($p: path) => { + #[$p] + struct S; + }; +} + +macro_rules! p { + () => {}; +} + +m!(generic<p!()>); +//~^ ERROR: unexpected generic arguments in path +//~| ERROR: cannot find attribute `generic` in this scope + +fn main() {} diff --git a/tests/ui/macros/macro-expand-within-generics-in-path.stderr b/tests/ui/macros/macro-expand-within-generics-in-path.stderr new file mode 100644 index 00000000000..72026c41050 --- /dev/null +++ b/tests/ui/macros/macro-expand-within-generics-in-path.stderr @@ -0,0 +1,14 @@ +error: unexpected generic arguments in path + --> $DIR/macro-expand-within-generics-in-path.rs:15:11 + | +LL | m!(generic<p!()>); + | ^^^^^^ + +error: cannot find attribute `generic` in this scope + --> $DIR/macro-expand-within-generics-in-path.rs:15:4 + | +LL | m!(generic<p!()>); + | ^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/match/match-range-fail-2.rs b/tests/ui/match/match-range-fail-2.rs index 4489cf1ab1f..524e84323e7 100644 --- a/tests/ui/match/match-range-fail-2.rs +++ b/tests/ui/match/match-range-fail-2.rs @@ -1,5 +1,3 @@ -#![feature(exclusive_range_pattern)] - fn main() { match 5 { 6 ..= 1 => { } diff --git a/tests/ui/match/match-range-fail-2.stderr b/tests/ui/match/match-range-fail-2.stderr index 089fa851f97..8bad2e6e147 100644 --- a/tests/ui/match/match-range-fail-2.stderr +++ b/tests/ui/match/match-range-fail-2.stderr @@ -1,17 +1,17 @@ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:5:9 + --> $DIR/match-range-fail-2.rs:3:9 | LL | 6 ..= 1 => { } | ^^^^^^^ lower bound larger than upper bound error[E0579]: lower range bound must be less than upper - --> $DIR/match-range-fail-2.rs:11:9 + --> $DIR/match-range-fail-2.rs:9:9 | LL | 0 .. 0 => { } | ^^^^^^ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:17:9 + --> $DIR/match-range-fail-2.rs:15:9 | LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound diff --git a/tests/ui/match/validate-range-endpoints.rs b/tests/ui/match/validate-range-endpoints.rs index 31d5bc3b65d..46d4239886d 100644 --- a/tests/ui/match/validate-range-endpoints.rs +++ b/tests/ui/match/validate-range-endpoints.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![feature(inline_const_pat)] #![allow(overlapping_range_endpoints)] diff --git a/tests/ui/match/validate-range-endpoints.stderr b/tests/ui/match/validate-range-endpoints.stderr index b3b4066cd91..2d0538804a3 100644 --- a/tests/ui/match/validate-range-endpoints.stderr +++ b/tests/ui/match/validate-range-endpoints.stderr @@ -1,59 +1,59 @@ error: literal out of range for `u8` - --> $DIR/validate-range-endpoints.rs:8:12 + --> $DIR/validate-range-endpoints.rs:7:12 | LL | 1..257 => {} | ^^^ this value does not fit into the type `u8` whose range is `0..=255` error: literal out of range for `u8` - --> $DIR/validate-range-endpoints.rs:10:13 + --> $DIR/validate-range-endpoints.rs:9:13 | LL | 1..=256 => {} | ^^^ this value does not fit into the type `u8` whose range is `0..=255` error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/validate-range-endpoints.rs:19:9 + --> $DIR/validate-range-endpoints.rs:18:9 | LL | 1..=TOO_BIG => {} | ^^^^^^^^^^^ lower bound larger than upper bound error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/validate-range-endpoints.rs:21:9 + --> $DIR/validate-range-endpoints.rs:20:9 | LL | 1..=const { 256 } => {} | ^^^^^^^^^^^^^^^^^ lower bound larger than upper bound error: literal out of range for `u64` - --> $DIR/validate-range-endpoints.rs:27:32 + --> $DIR/validate-range-endpoints.rs:26:32 | LL | 10000000000000000000..=99999999999999999999 => {} | ^^^^^^^^^^^^^^^^^^^^ this value does not fit into the type `u64` whose range is `0..=18446744073709551615` error: literal out of range for `i8` - --> $DIR/validate-range-endpoints.rs:33:12 + --> $DIR/validate-range-endpoints.rs:32:12 | LL | 0..129 => {} | ^^^ this value does not fit into the type `i8` whose range is `-128..=127` error: literal out of range for `i8` - --> $DIR/validate-range-endpoints.rs:35:13 + --> $DIR/validate-range-endpoints.rs:34:13 | LL | 0..=128 => {} | ^^^ this value does not fit into the type `i8` whose range is `-128..=127` error: literal out of range for `i8` - --> $DIR/validate-range-endpoints.rs:37:9 + --> $DIR/validate-range-endpoints.rs:36:9 | LL | -129..0 => {} | ^^^^ this value does not fit into the type `i8` whose range is `-128..=127` error: literal out of range for `i8` - --> $DIR/validate-range-endpoints.rs:39:9 + --> $DIR/validate-range-endpoints.rs:38:9 | LL | -10000..=-20 => {} | ^^^^^^ this value does not fit into the type `i8` whose range is `-128..=127` error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered - --> $DIR/validate-range-endpoints.rs:50:11 + --> $DIR/validate-range-endpoints.rs:49:11 | LL | match 0i8 { | ^^^ patterns `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered @@ -66,7 +66,7 @@ LL + i8::MIN..=-17_i8 | 1_i8..=i8::MAX => todo!() | error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` not covered - --> $DIR/validate-range-endpoints.rs:54:11 + --> $DIR/validate-range-endpoints.rs:53:11 | LL | match 0i8 { | ^^^ pattern `i8::MIN..=-17_i8` not covered diff --git a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr index 4221dd04cfa..a489040f32d 100644 --- a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr +++ b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/meta-expected-error-wrong-rev.rs:13:18 + --> $DIR/meta-expected-error-wrong-rev.rs:14:18 | LL | let x: u32 = 22_usize; | --- ^^^^^^^^ expected `u32`, found `usize` diff --git a/tests/ui/meta/meta-expected-error-wrong-rev.rs b/tests/ui/meta/meta-expected-error-wrong-rev.rs index de276299482..1c3a3fc4923 100644 --- a/tests/ui/meta/meta-expected-error-wrong-rev.rs +++ b/tests/ui/meta/meta-expected-error-wrong-rev.rs @@ -1,6 +1,7 @@ //@ ignore-compare-mode-polonius //@ revisions: a +//@ unused-revision-names: b //@ should-fail // This is a "meta-test" of the compilertest framework itself. In diff --git a/tests/ui/methods/method-lookup-order.rs b/tests/ui/methods/method-lookup-order.rs index f794e5a7241..ad56da96686 100644 --- a/tests/ui/methods/method-lookup-order.rs +++ b/tests/ui/methods/method-lookup-order.rs @@ -17,6 +17,7 @@ // {mutbar_for_foo, valbar_for_etmut_foo} (which are lower precedent than the inherent `&mut self` method on `Foo`; e.g. b10101 *is* included. //@ revisions: b00001 b00010 b00011 b00100 b00101 b00110 b00111 b01000 b01001 b01100 b01101 b10000 b10001 b10010 b10011 b10101 b10111 b11000 b11001 b11101 +//@ unused-revision-names: b01010 b01011 b01110 b01111 b10100 b10110 b11010 b11011 b11100 b11110 b11111 //@ compile-flags: --check-cfg=cfg(inherent_mut,bar_for_foo,mutbar_for_foo) //@ compile-flags: --check-cfg=cfg(valbar_for_et_foo,valbar_for_etmut_foo) diff --git a/tests/ui/mir/mir_match_test.rs b/tests/ui/mir/mir_match_test.rs index 0da8522f218..ad54a91646a 100644 --- a/tests/ui/mir/mir_match_test.rs +++ b/tests/ui/mir/mir_match_test.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![allow(overlapping_range_endpoints)] #![allow(non_contiguous_range_endpoints)] diff --git a/tests/ui/mismatched_types/non_zero_assigned_something.rs b/tests/ui/mismatched_types/non_zero_assigned_something.rs index d2adbe01c18..e94d5249d6a 100644 --- a/tests/ui/mismatched_types/non_zero_assigned_something.rs +++ b/tests/ui/mismatched_types/non_zero_assigned_something.rs @@ -1,9 +1,9 @@ fn main() { - let _: std::num::NonZeroU64 = 1; + let _: std::num::NonZero<u64> = 1; //~^ ERROR mismatched types - //~| HELP consider calling `NonZeroU64::new` + //~| HELP consider calling `NonZero::new` - let _: Option<std::num::NonZeroU64> = 1; + let _: Option<std::num::NonZero<u64>> = 1; //~^ ERROR mismatched types - //~| HELP consider calling `NonZeroU64::new` + //~| HELP consider calling `NonZero::new` } diff --git a/tests/ui/mismatched_types/non_zero_assigned_something.stderr b/tests/ui/mismatched_types/non_zero_assigned_something.stderr index f8e86905ab9..aa015bd2efc 100644 --- a/tests/ui/mismatched_types/non_zero_assigned_something.stderr +++ b/tests/ui/mismatched_types/non_zero_assigned_something.stderr @@ -1,32 +1,32 @@ error[E0308]: mismatched types - --> $DIR/non_zero_assigned_something.rs:2:35 + --> $DIR/non_zero_assigned_something.rs:2:37 | -LL | let _: std::num::NonZeroU64 = 1; - | -------------------- ^ expected `NonZero<u64>`, found integer +LL | let _: std::num::NonZero<u64> = 1; + | ---------------------- ^ expected `NonZero<u64>`, found integer | | | expected due to this | = note: expected struct `NonZero<u64>` found type `{integer}` -help: consider calling `NonZeroU64::new` +help: consider calling `NonZero::new` | -LL | let _: std::num::NonZeroU64 = NonZeroU64::new(1).unwrap(); - | ++++++++++++++++ ++++++++++ +LL | let _: std::num::NonZero<u64> = NonZero::new(1).unwrap(); + | +++++++++++++ ++++++++++ error[E0308]: mismatched types - --> $DIR/non_zero_assigned_something.rs:6:43 + --> $DIR/non_zero_assigned_something.rs:6:45 | -LL | let _: Option<std::num::NonZeroU64> = 1; - | ---------------------------- ^ expected `Option<NonZero<u64>>`, found integer +LL | let _: Option<std::num::NonZero<u64>> = 1; + | ------------------------------ ^ expected `Option<NonZero<u64>>`, found integer | | | expected due to this | = note: expected enum `Option<NonZero<u64>>` found type `{integer}` -help: consider calling `NonZeroU64::new` +help: consider calling `NonZero::new` | -LL | let _: Option<std::num::NonZeroU64> = NonZeroU64::new(1); - | ++++++++++++++++ + +LL | let _: Option<std::num::NonZero<u64>> = NonZero::new(1); + | +++++++++++++ + error: aborting due to 2 previous errors diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.rs b/tests/ui/parser/attribute/attr-bad-meta-4.rs index cedbd1d6686..2a69ae5ac06 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.rs +++ b/tests/ui/parser/attribute/attr-bad-meta-4.rs @@ -1,12 +1,17 @@ macro_rules! mac { ($attr_item: meta) => { #[cfg($attr_item)] - //~^ ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)` - //~| ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)` + //~^ ERROR expected unsuffixed literal, found `an(arbitrary token stream)` + //~| ERROR expected unsuffixed literal, found `an(arbitrary token stream)` struct S; } } mac!(an(arbitrary token stream)); +#[cfg(feature = -1)] +//~^ ERROR expected unsuffixed literal, found `-` +//~| ERROR expected unsuffixed literal, found `-` +fn handler() {} + fn main() {} diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr index a543bcb692e..192be28db3f 100644 --- a/tests/ui/parser/attribute/attr-bad-meta-4.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr @@ -1,4 +1,10 @@ -error: expected unsuffixed literal or identifier, found `an(arbitrary token stream)` +error: expected unsuffixed literal, found `-` + --> $DIR/attr-bad-meta-4.rs:12:17 + | +LL | #[cfg(feature = -1)] + | ^ + +error: expected unsuffixed literal, found `an(arbitrary token stream)` --> $DIR/attr-bad-meta-4.rs:3:15 | LL | #[cfg($attr_item)] @@ -9,7 +15,7 @@ LL | mac!(an(arbitrary token stream)); | = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected unsuffixed literal or identifier, found `an(arbitrary token stream)` +error: expected unsuffixed literal, found `an(arbitrary token stream)` --> $DIR/attr-bad-meta-4.rs:3:15 | LL | #[cfg($attr_item)] @@ -21,5 +27,13 @@ LL | mac!(an(arbitrary token stream)); = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: expected unsuffixed literal, found `-` + --> $DIR/attr-bad-meta-4.rs:12:17 + | +LL | #[cfg(feature = -1)] + | ^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.fixed b/tests/ui/parser/attribute/attr-unquoted-ident.fixed deleted file mode 100644 index bc861ef69fb..00000000000 --- a/tests/ui/parser/attribute/attr-unquoted-ident.fixed +++ /dev/null @@ -1,17 +0,0 @@ -//@ compile-flags: -Zdeduplicate-diagnostics=yes -//@ run-rustfix - -#![allow(unexpected_cfgs)] - -fn main() { - #[cfg(key="foo")] - //~^ ERROR expected unsuffixed literal, found `foo` - //~| HELP surround the identifier with quotation marks to parse it as a string - println!(); - #[cfg(key="bar")] - println!(); - #[cfg(key="foo bar baz")] - //~^ ERROR expected unsuffixed literal, found `foo` - //~| HELP surround the identifier with quotation marks to parse it as a string - println!(); -} diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.rs b/tests/ui/parser/attribute/attr-unquoted-ident.rs index 8bdb8605ebb..5b15b8d69fc 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.rs +++ b/tests/ui/parser/attribute/attr-unquoted-ident.rs @@ -1,17 +1,25 @@ //@ compile-flags: -Zdeduplicate-diagnostics=yes -//@ run-rustfix #![allow(unexpected_cfgs)] fn main() { #[cfg(key=foo)] //~^ ERROR expected unsuffixed literal, found `foo` - //~| HELP surround the identifier with quotation marks to parse it as a string + //~| HELP surround the identifier with quotation marks to make it into a string literal println!(); #[cfg(key="bar")] println!(); #[cfg(key=foo bar baz)] //~^ ERROR expected unsuffixed literal, found `foo` - //~| HELP surround the identifier with quotation marks to parse it as a string + //~| HELP surround the identifier with quotation marks to make it into a string literal println!(); } + +// Don't suggest surrounding `$name` or `nickname` with quotes: + +macro_rules! make { + ($name:ident) => { #[doc(alias = $name)] pub struct S; } + //~^ ERROR expected unsuffixed literal, found `nickname` +} + +make!(nickname); //~ NOTE in this expansion diff --git a/tests/ui/parser/attribute/attr-unquoted-ident.stderr b/tests/ui/parser/attribute/attr-unquoted-ident.stderr index 99484a51110..e0f99459c44 100644 --- a/tests/ui/parser/attribute/attr-unquoted-ident.stderr +++ b/tests/ui/parser/attribute/attr-unquoted-ident.stderr @@ -1,24 +1,35 @@ error: expected unsuffixed literal, found `foo` - --> $DIR/attr-unquoted-ident.rs:7:15 + --> $DIR/attr-unquoted-ident.rs:6:15 | LL | #[cfg(key=foo)] | ^^^ | -help: surround the identifier with quotation marks to parse it as a string +help: surround the identifier with quotation marks to make it into a string literal | LL | #[cfg(key="foo")] | + + error: expected unsuffixed literal, found `foo` - --> $DIR/attr-unquoted-ident.rs:13:15 + --> $DIR/attr-unquoted-ident.rs:12:15 | LL | #[cfg(key=foo bar baz)] | ^^^ | -help: surround the identifier with quotation marks to parse it as a string +help: surround the identifier with quotation marks to make it into a string literal | LL | #[cfg(key="foo bar baz")] | + + -error: aborting due to 2 previous errors +error: expected unsuffixed literal, found `nickname` + --> $DIR/attr-unquoted-ident.rs:21:38 + | +LL | ($name:ident) => { #[doc(alias = $name)] pub struct S; } + | ^^^^^ +... +LL | make!(nickname); + | --------------- in this macro invocation + | + = note: this error originates in the macro `make` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-63115-range-pat-interpolated.rs b/tests/ui/parser/issues/issue-63115-range-pat-interpolated.rs index d1a5f32b954..9a6bd4442e5 100644 --- a/tests/ui/parser/issues/issue-63115-range-pat-interpolated.rs +++ b/tests/ui/parser/issues/issue-63115-range-pat-interpolated.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(exclusive_range_pattern)] - #![allow(ellipsis_inclusive_range_patterns)] fn main() { diff --git a/tests/ui/parser/recover/recover-range-pats.rs b/tests/ui/parser/recover/recover-range-pats.rs index 3dc525cd6e1..42cd69fd959 100644 --- a/tests/ui/parser/recover/recover-range-pats.rs +++ b/tests/ui/parser/recover/recover-range-pats.rs @@ -3,7 +3,6 @@ // 1. Things parse as they should. // 2. Or at least we have parser recovery if they don't. -#![feature(exclusive_range_pattern)] #![deny(ellipsis_inclusive_range_patterns)] fn main() {} diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index 2c0baf7e5f8..e0ea8ec24dc 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -1,47 +1,47 @@ error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:21:12 + --> $DIR/recover-range-pats.rs:20:12 | LL | if let .0..Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:23:16 + --> $DIR/recover-range-pats.rs:22:16 | LL | if let X.. .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:34:12 + --> $DIR/recover-range-pats.rs:33:12 | LL | if let .0..=Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:36:16 + --> $DIR/recover-range-pats.rs:35:16 | LL | if let X..=.0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:59:12 + --> $DIR/recover-range-pats.rs:58:12 | LL | if let .0...Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:63:17 + --> $DIR/recover-range-pats.rs:62:17 | LL | if let X... .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:74:12 + --> $DIR/recover-range-pats.rs:73:12 | LL | if let .0.. = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:80:13 + --> $DIR/recover-range-pats.rs:79:13 | LL | if let 0..= = 0 {} | ^^^ help: use `..` instead @@ -49,7 +49,7 @@ LL | if let 0..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:81:13 + --> $DIR/recover-range-pats.rs:80:13 | LL | if let X..= = 0 {} | ^^^ help: use `..` instead @@ -57,7 +57,7 @@ LL | if let X..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:82:16 + --> $DIR/recover-range-pats.rs:81:16 | LL | if let true..= = 0 {} | ^^^ help: use `..` instead @@ -65,13 +65,13 @@ LL | if let true..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:84:12 + --> $DIR/recover-range-pats.rs:83:12 | LL | if let .0..= = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:84:14 + --> $DIR/recover-range-pats.rs:83:14 | LL | if let .0..= = 0 {} | ^^^ help: use `..` instead @@ -79,7 +79,7 @@ LL | if let .0..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:90:13 + --> $DIR/recover-range-pats.rs:89:13 | LL | if let 0... = 0 {} | ^^^ help: use `..` instead @@ -87,7 +87,7 @@ LL | if let 0... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:91:13 + --> $DIR/recover-range-pats.rs:90:13 | LL | if let X... = 0 {} | ^^^ help: use `..` instead @@ -95,7 +95,7 @@ LL | if let X... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:92:16 + --> $DIR/recover-range-pats.rs:91:16 | LL | if let true... = 0 {} | ^^^ help: use `..` instead @@ -103,13 +103,13 @@ LL | if let true... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:94:12 + --> $DIR/recover-range-pats.rs:93:12 | LL | if let .0... = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:94:14 + --> $DIR/recover-range-pats.rs:93:14 | LL | if let .0... = 0 {} | ^^^ help: use `..` instead @@ -117,49 +117,49 @@ LL | if let .0... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:104:15 + --> $DIR/recover-range-pats.rs:103:15 | LL | if let .. .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:114:15 + --> $DIR/recover-range-pats.rs:113:15 | LL | if let ..=.0 = 0 {} | ^^ help: must have an integer part: `0.0` error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:120:12 + --> $DIR/recover-range-pats.rs:119:12 | LL | if let ...3 = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:122:12 + --> $DIR/recover-range-pats.rs:121:12 | LL | if let ...Y = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:124:12 + --> $DIR/recover-range-pats.rs:123:12 | LL | if let ...true = 0 {} | ^^^ help: use `..=` instead error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:127:15 + --> $DIR/recover-range-pats.rs:126:15 | LL | if let ....3 = 0 {} | ^^ help: must have an integer part: `0.3` error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:127:12 + --> $DIR/recover-range-pats.rs:126:12 | LL | if let ....3 = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:153:17 + --> $DIR/recover-range-pats.rs:152:17 | LL | let ...$e; | ^^^ help: use `..=` instead @@ -170,7 +170,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:160:19 + --> $DIR/recover-range-pats.rs:159:19 | LL | let $e...; | ^^^ help: use `..` instead @@ -182,7 +182,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:162:19 + --> $DIR/recover-range-pats.rs:161:19 | LL | let $e..=; | ^^^ help: use `..` instead @@ -194,7 +194,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:41:13 + --> $DIR/recover-range-pats.rs:40:13 | LL | if let 0...3 = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -202,13 +202,13 @@ LL | if let 0...3 = 0 {} = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> note: the lint level is defined here - --> $DIR/recover-range-pats.rs:7:9 + --> $DIR/recover-range-pats.rs:6:9 | LL | #![deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:44:13 + --> $DIR/recover-range-pats.rs:43:13 | LL | if let 0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -217,7 +217,7 @@ LL | if let 0...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:47:13 + --> $DIR/recover-range-pats.rs:46:13 | LL | if let X...3 = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -226,7 +226,7 @@ LL | if let X...3 = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:50:13 + --> $DIR/recover-range-pats.rs:49:13 | LL | if let X...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -235,7 +235,7 @@ LL | if let X...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:53:16 + --> $DIR/recover-range-pats.rs:52:16 | LL | if let true...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -244,7 +244,7 @@ LL | if let true...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:56:13 + --> $DIR/recover-range-pats.rs:55:13 | LL | if let X...true = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -253,7 +253,7 @@ LL | if let X...true = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:59:14 + --> $DIR/recover-range-pats.rs:58:14 | LL | if let .0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -262,7 +262,7 @@ LL | if let .0...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:63:13 + --> $DIR/recover-range-pats.rs:62:13 | LL | if let X... .0 = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -271,7 +271,7 @@ LL | if let X... .0 = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:138:20 + --> $DIR/recover-range-pats.rs:137:20 | LL | let $e1...$e2; | ^^^ help: use `..=` for an inclusive range @@ -284,7 +284,7 @@ LL | mac2!(0, 1); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:19:12 + --> $DIR/recover-range-pats.rs:18:12 | LL | if let true..Y = 0 {} | ^^^^ - this is of type `u8` @@ -292,7 +292,7 @@ LL | if let true..Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:20:15 + --> $DIR/recover-range-pats.rs:19:15 | LL | if let X..true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -300,7 +300,7 @@ LL | if let X..true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:21:12 + --> $DIR/recover-range-pats.rs:20:12 | LL | if let .0..Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -309,7 +309,7 @@ LL | if let .0..Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:23:16 + --> $DIR/recover-range-pats.rs:22:16 | LL | if let X.. .0 = 0 {} | - ^^ - this expression has type `u8` @@ -321,7 +321,7 @@ LL | if let X.. .0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:32:12 + --> $DIR/recover-range-pats.rs:31:12 | LL | if let true..=Y = 0 {} | ^^^^ - this is of type `u8` @@ -329,7 +329,7 @@ LL | if let true..=Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:33:16 + --> $DIR/recover-range-pats.rs:32:16 | LL | if let X..=true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -337,7 +337,7 @@ LL | if let X..=true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:34:12 + --> $DIR/recover-range-pats.rs:33:12 | LL | if let .0..=Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -346,7 +346,7 @@ LL | if let .0..=Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:36:16 + --> $DIR/recover-range-pats.rs:35:16 | LL | if let X..=.0 = 0 {} | - ^^ - this expression has type `u8` @@ -358,7 +358,7 @@ LL | if let X..=.0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:53:12 + --> $DIR/recover-range-pats.rs:52:12 | LL | if let true...Y = 0 {} | ^^^^ - this is of type `u8` @@ -366,7 +366,7 @@ LL | if let true...Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:56:16 + --> $DIR/recover-range-pats.rs:55:16 | LL | if let X...true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -374,7 +374,7 @@ LL | if let X...true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:59:12 + --> $DIR/recover-range-pats.rs:58:12 | LL | if let .0...Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -383,7 +383,7 @@ LL | if let .0...Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:63:17 + --> $DIR/recover-range-pats.rs:62:17 | LL | if let X... .0 = 0 {} | - ^^ - this expression has type `u8` @@ -395,13 +395,13 @@ LL | if let X... .0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:72:12 + --> $DIR/recover-range-pats.rs:71:12 | LL | if let true.. = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:74:12 + --> $DIR/recover-range-pats.rs:73:12 | LL | if let .0.. = 0 {} | ^^ - this expression has type `{integer}` @@ -409,13 +409,13 @@ LL | if let .0.. = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:82:12 + --> $DIR/recover-range-pats.rs:81:12 | LL | if let true..= = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:84:12 + --> $DIR/recover-range-pats.rs:83:12 | LL | if let .0..= = 0 {} | ^^ - this expression has type `{integer}` @@ -423,13 +423,13 @@ LL | if let .0..= = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:92:12 + --> $DIR/recover-range-pats.rs:91:12 | LL | if let true... = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:94:12 + --> $DIR/recover-range-pats.rs:93:12 | LL | if let .0... = 0 {} | ^^ - this expression has type `{integer}` @@ -437,13 +437,13 @@ LL | if let .0... = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:102:14 + --> $DIR/recover-range-pats.rs:101:14 | LL | if let ..true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:104:15 + --> $DIR/recover-range-pats.rs:103:15 | LL | if let .. .0 = 0 {} | ^^ - this expression has type `{integer}` @@ -451,13 +451,13 @@ LL | if let .. .0 = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:112:15 + --> $DIR/recover-range-pats.rs:111:15 | LL | if let ..=true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:114:15 + --> $DIR/recover-range-pats.rs:113:15 | LL | if let ..=.0 = 0 {} | ^^ - this expression has type `{integer}` @@ -465,13 +465,13 @@ LL | if let ..=.0 = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:124:15 + --> $DIR/recover-range-pats.rs:123:15 | LL | if let ...true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:127:15 + --> $DIR/recover-range-pats.rs:126:15 | LL | if let ....3 = 0 {} | ^^ - this expression has type `{integer}` @@ -479,7 +479,7 @@ LL | if let ....3 = 0 {} | expected integer, found floating-point number error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:136:17 + --> $DIR/recover-range-pats.rs:135:17 | LL | let $e1..$e2; | ^^^^^^^^ patterns `i32::MIN..=-1_i32` and `1_i32..=i32::MAX` not covered @@ -493,7 +493,7 @@ LL | mac2!(0, 1); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:138:17 + --> $DIR/recover-range-pats.rs:137:17 | LL | let $e1...$e2; | ^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `2_i32..=i32::MAX` not covered @@ -507,7 +507,7 @@ LL | mac2!(0, 1); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:142:17 + --> $DIR/recover-range-pats.rs:141:17 | LL | let $e1..=$e2; | ^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `2_i32..=i32::MAX` not covered @@ -521,7 +521,7 @@ LL | mac2!(0, 1); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:151:17 + --> $DIR/recover-range-pats.rs:150:17 | LL | let ..$e; | ^^^^ pattern `0_i32..=i32::MAX` not covered @@ -535,7 +535,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:153:17 + --> $DIR/recover-range-pats.rs:152:17 | LL | let ...$e; | ^^^^^ pattern `1_i32..=i32::MAX` not covered @@ -549,7 +549,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:156:17 + --> $DIR/recover-range-pats.rs:155:17 | LL | let ..=$e; | ^^^^^ pattern `1_i32..=i32::MAX` not covered @@ -563,7 +563,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:158:17 + --> $DIR/recover-range-pats.rs:157:17 | LL | let $e..; | ^^^^ pattern `i32::MIN..=-1_i32` not covered @@ -577,7 +577,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:160:17 + --> $DIR/recover-range-pats.rs:159:17 | LL | let $e...; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered @@ -591,7 +591,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0005]: refutable pattern in local binding - --> $DIR/recover-range-pats.rs:162:17 + --> $DIR/recover-range-pats.rs:161:17 | LL | let $e..=; | ^^^^^ pattern `i32::MIN..=-1_i32` not covered diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.rs b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.rs new file mode 100644 index 00000000000..32125211a91 --- /dev/null +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.rs @@ -0,0 +1,6 @@ +fn foo() { + let x = Tr<A, A:>; + //~^ ERROR expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` +} + +fn main() {} diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr new file mode 100644 index 00000000000..551b2e3ff09 --- /dev/null +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -0,0 +1,14 @@ +error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` + --> $DIR/turbofish-arg-with-stray-colon.rs:2:17 + | +LL | let x = Tr<A, A:>; + | ^ expected one of 8 possible tokens + | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: maybe write a path separator here + | +LL | let x = Tr<A, A::>; + | ~~ + +error: aborting due to 1 previous error + diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs index 1eba7aeb4d6..fe7655c2c4e 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs @@ -11,7 +11,6 @@ fn main() { [_, ..tail] => println!("{tail}"), //~^ ERROR cannot find value `tail` in this scope //~| ERROR cannot find value `tail` in this scope - //~| ERROR exclusive range pattern syntax is experimental } match &[7, 8, 9][..] { [] => {} diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr index 3a19517c85b..37c02eb6ada 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr @@ -1,5 +1,5 @@ error: range-to patterns with `...` are not allowed - --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:18:13 + --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:13 | LL | [_, ...tail] => println!("{tail}"), | ^^^ help: use `..=` instead @@ -39,7 +39,7 @@ LL | [_, ..tail] => println!("{tail}"), | ^^^^ not found in this scope error[E0425]: cannot find value `tail` in this scope - --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:18:16 + --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:16 | LL | [_, ...tail] => println!("{tail}"), | ^^^^ not found in this scope @@ -50,7 +50,7 @@ LL | [_, tail @ ..] => println!("{tail}"), | ~~~~~~~~~ error[E0425]: cannot find value `tail` in this scope - --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:18:36 + --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:36 | LL | [_, ...tail] => println!("{tail}"), | ^^^^ not found in this scope @@ -65,18 +65,7 @@ LL | [1, rest..] => println!("{rest}"), = help: add `#![feature(half_open_range_patterns_in_slices)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: exclusive range pattern syntax is experimental - --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:11:13 - | -LL | [_, ..tail] => println!("{tail}"), - | ^^^^^^ - | - = note: see issue #37854 <https://github.com/rust-lang/rust/issues/37854> for more information - = help: add `#![feature(exclusive_range_pattern)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: use an inclusive range pattern, like N..=M - -error: aborting due to 9 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0425, E0658. For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/pattern/usefulness/floats.rs b/tests/ui/pattern/usefulness/floats.rs index 63ce26adab2..b3d49ba8e15 100644 --- a/tests/ui/pattern/usefulness/floats.rs +++ b/tests/ui/pattern/usefulness/floats.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![deny(unreachable_patterns)] fn main() { diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index d99f05f5284..04f2fe3cd94 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/floats.rs:10:11 + --> $DIR/floats.rs:9:11 | LL | match 0.0 { | ^^^ pattern `_` not covered @@ -12,49 +12,49 @@ LL + _ => todo!() | error: unreachable pattern - --> $DIR/floats.rs:18:9 + --> $DIR/floats.rs:17:9 | LL | 0.01f64 => {} | ^^^^^^^ | note: the lint level is defined here - --> $DIR/floats.rs:2:9 + --> $DIR/floats.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:19:9 + --> $DIR/floats.rs:18:9 | LL | 0.02f64 => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:20:9 + --> $DIR/floats.rs:19:9 | LL | 6.5f64 => {} | ^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:22:9 + --> $DIR/floats.rs:21:9 | LL | 1.0f64..=4.0f64 => {} | ^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:34:9 + --> $DIR/floats.rs:33:9 | LL | 0.01f32 => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:35:9 + --> $DIR/floats.rs:34:9 | LL | 0.02f32 => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/floats.rs:36:9 + --> $DIR/floats.rs:35:9 | LL | 6.5f32 => {} | ^^^^^^ diff --git a/tests/ui/pattern/usefulness/guards.rs b/tests/ui/pattern/usefulness/guards.rs index b15440cf608..94ee8ee14ad 100644 --- a/tests/ui/pattern/usefulness/guards.rs +++ b/tests/ui/pattern/usefulness/guards.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![deny(unreachable_patterns)] enum Q { R(Option<usize>) } diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index ad9046fe248..82ed2a93c55 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `128_u8..=u8::MAX` not covered - --> $DIR/guards.rs:12:11 + --> $DIR/guards.rs:11:11 | LL | match 0u8 { | ^^^ pattern `128_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs index 07156d9a08a..026175e3abf 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![allow(overlapping_range_endpoints)] #![allow(non_contiguous_range_endpoints)] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index 68976c1b057..cc250b79274 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered - --> $DIR/exhaustiveness.rs:48:8 + --> $DIR/exhaustiveness.rs:47:8 | LL | m!(0u8, 0..255); | ^^^ pattern `u8::MAX` not covered @@ -11,7 +11,7 @@ LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `u8::MAX` not covered - --> $DIR/exhaustiveness.rs:49:8 + --> $DIR/exhaustiveness.rs:48:8 | LL | m!(0u8, 0..=254); | ^^^ pattern `u8::MAX` not covered @@ -23,7 +23,7 @@ LL | match $s { $($t)+ => {}, u8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u8` not covered - --> $DIR/exhaustiveness.rs:50:8 + --> $DIR/exhaustiveness.rs:49:8 | LL | m!(0u8, 1..=255); | ^^^ pattern `0_u8` not covered @@ -35,7 +35,7 @@ LL | match $s { $($t)+ => {}, 0_u8 => todo!() } | +++++++++++++++++ error[E0004]: non-exhaustive patterns: `42_u8` not covered - --> $DIR/exhaustiveness.rs:51:8 + --> $DIR/exhaustiveness.rs:50:8 | LL | m!(0u8, 0..42 | 43..=255); | ^^^ pattern `42_u8` not covered @@ -47,7 +47,7 @@ LL | match $s { $($t)+ => {}, 42_u8 => todo!() } | ++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered - --> $DIR/exhaustiveness.rs:52:8 + --> $DIR/exhaustiveness.rs:51:8 | LL | m!(0i8, -128..127); | ^^^ pattern `i8::MAX` not covered @@ -59,7 +59,7 @@ LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MAX` not covered - --> $DIR/exhaustiveness.rs:53:8 + --> $DIR/exhaustiveness.rs:52:8 | LL | m!(0i8, -128..=126); | ^^^ pattern `i8::MAX` not covered @@ -71,7 +71,7 @@ LL | match $s { $($t)+ => {}, i8::MAX => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `i8::MIN` not covered - --> $DIR/exhaustiveness.rs:54:8 + --> $DIR/exhaustiveness.rs:53:8 | LL | m!(0i8, -127..=127); | ^^^ pattern `i8::MIN` not covered @@ -83,7 +83,7 @@ LL | match $s { $($t)+ => {}, i8::MIN => todo!() } | ++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_i8` not covered - --> $DIR/exhaustiveness.rs:55:11 + --> $DIR/exhaustiveness.rs:54:11 | LL | match 0i8 { | ^^^ pattern `0_i8` not covered @@ -96,7 +96,7 @@ LL + 0_i8 => todo!() | error[E0004]: non-exhaustive patterns: `u128::MAX` not covered - --> $DIR/exhaustiveness.rs:60:8 + --> $DIR/exhaustiveness.rs:59:8 | LL | m!(0u128, 0..=ALMOST_MAX); | ^^^^^ pattern `u128::MAX` not covered @@ -108,7 +108,7 @@ LL | match $s { $($t)+ => {}, u128::MAX => todo!() } | ++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `5_u128..` not covered - --> $DIR/exhaustiveness.rs:61:8 + --> $DIR/exhaustiveness.rs:60:8 | LL | m!(0u128, 0..=4); | ^^^^^ pattern `5_u128..` not covered @@ -120,7 +120,7 @@ LL | match $s { $($t)+ => {}, 5_u128.. => todo!() } | +++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `0_u128` not covered - --> $DIR/exhaustiveness.rs:62:8 + --> $DIR/exhaustiveness.rs:61:8 | LL | m!(0u128, 1..=u128::MAX); | ^^^^^ pattern `0_u128` not covered @@ -132,7 +132,7 @@ LL | match $s { $($t)+ => {}, 0_u128 => todo!() } | +++++++++++++++++++ error[E0004]: non-exhaustive patterns: `(126_u8..=127_u8, false)` not covered - --> $DIR/exhaustiveness.rs:70:11 + --> $DIR/exhaustiveness.rs:69:11 | LL | match (0u8, true) { | ^^^^^^^^^^^ pattern `(126_u8..=127_u8, false)` not covered diff --git a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.rs b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.rs index 78849d7e143..2e2519d1b6d 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![deny(non_contiguous_range_endpoints)] macro_rules! m { diff --git a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr index e5c2d788ba4..8a029073f05 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/gap_between_ranges.stderr @@ -1,5 +1,5 @@ error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:16:9 + --> $DIR/gap_between_ranges.rs:15:9 | LL | 20..30 => {} | ^^^^^^ @@ -10,13 +10,13 @@ LL | 31..=40 => {} | ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them | note: the lint level is defined here - --> $DIR/gap_between_ranges.rs:2:9 + --> $DIR/gap_between_ranges.rs:1:9 | LL | #![deny(non_contiguous_range_endpoints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:21:9 + --> $DIR/gap_between_ranges.rs:20:9 | LL | 20..30 => {} | ^^^^^^ @@ -27,7 +27,7 @@ LL | 31 => {} | -- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:26:13 + --> $DIR/gap_between_ranges.rs:25:13 | LL | m!(0u8, 20..30, 31..=40); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them @@ -36,7 +36,7 @@ LL | m!(0u8, 20..30, 31..=40); | help: use an inclusive range instead: `20_u8..=30_u8` error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:27:22 + --> $DIR/gap_between_ranges.rs:26:22 | LL | m!(0u8, 31..=40, 20..30); | ------- ^^^^^^ @@ -46,7 +46,7 @@ LL | m!(0u8, 31..=40, 20..30); | this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them warning: multiple patterns overlap on their endpoints - --> $DIR/gap_between_ranges.rs:28:21 + --> $DIR/gap_between_ranges.rs:27:21 | LL | m!(0u8, 20..30, 29..=40); | ------ ^^^^^^^ ... with this range @@ -57,7 +57,7 @@ LL | m!(0u8, 20..30, 29..=40); = note: `#[warn(overlapping_range_endpoints)]` on by default error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:30:13 + --> $DIR/gap_between_ranges.rs:29:13 | LL | m!(0u8, 20..30, 31..=40); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them @@ -66,7 +66,7 @@ LL | m!(0u8, 20..30, 31..=40); | help: use an inclusive range instead: `20_u8..=30_u8` error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:32:13 + --> $DIR/gap_between_ranges.rs:31:13 | LL | m!(0u8, 20..30, 31..=32); | ^^^^^^ ------- this could appear to continue range `20_u8..30_u8`, but `30_u8` isn't matched by either of them @@ -75,7 +75,7 @@ LL | m!(0u8, 20..30, 31..=32); | help: use an inclusive range instead: `20_u8..=30_u8` error: exclusive range missing `u8::MAX` - --> $DIR/gap_between_ranges.rs:42:9 + --> $DIR/gap_between_ranges.rs:41:9 | LL | 0..255 => {} | ^^^^^^ @@ -84,7 +84,7 @@ LL | 0..255 => {} | help: use an inclusive range instead: `0_u8..=u8::MAX` error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:71:9 + --> $DIR/gap_between_ranges.rs:70:9 | LL | 0..10 => {} | ^^^^^ @@ -97,7 +97,7 @@ LL | 11..30 => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:77:9 + --> $DIR/gap_between_ranges.rs:76:9 | LL | 0..10 => {} | ^^^^^ @@ -108,7 +108,7 @@ LL | 11..20 => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:78:9 + --> $DIR/gap_between_ranges.rs:77:9 | LL | 11..20 => {} | ^^^^^^ @@ -119,7 +119,7 @@ LL | 21..30 => {} | ------ this could appear to continue range `11_u8..20_u8`, but `20_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:83:9 + --> $DIR/gap_between_ranges.rs:82:9 | LL | 00..20 => {} | ^^^^^^ @@ -133,7 +133,7 @@ LL | 21..40 => {} | ------ this could appear to continue range `0_u8..20_u8`, but `20_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:84:9 + --> $DIR/gap_between_ranges.rs:83:9 | LL | 10..20 => {} | ^^^^^^ @@ -146,7 +146,7 @@ LL | 21..40 => {} | ------ this could appear to continue range `10_u8..20_u8`, but `20_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:92:10 + --> $DIR/gap_between_ranges.rs:91:10 | LL | (0..10, true) => {} | ^^^^^ @@ -157,7 +157,7 @@ LL | (11..20, true) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:97:16 + --> $DIR/gap_between_ranges.rs:96:16 | LL | (true, 0..10) => {} | ^^^^^ @@ -168,7 +168,7 @@ LL | (true, 11..20) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:103:10 + --> $DIR/gap_between_ranges.rs:102:10 | LL | (0..10, true) => {} | ^^^^^ @@ -179,7 +179,7 @@ LL | (11..20, false) => {} | ------ this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them error: multiple ranges are one apart - --> $DIR/gap_between_ranges.rs:113:14 + --> $DIR/gap_between_ranges.rs:112:14 | LL | Some(0..10) => {} | ^^^^^ diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs index 7e56880a87f..a5b7a901616 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![deny(overlapping_range_endpoints)] macro_rules! m { diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr index aa37bd9bc9c..6634532d5ed 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr @@ -1,5 +1,5 @@ error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:15:22 + --> $DIR/overlapping_range_endpoints.rs:14:22 | LL | m!(0u8, 20..=30, 30..=40); | ------- ^^^^^^^ ... with this range @@ -8,13 +8,13 @@ LL | m!(0u8, 20..=30, 30..=40); | = note: you likely meant to write mutually exclusive ranges note: the lint level is defined here - --> $DIR/overlapping_range_endpoints.rs:2:9 + --> $DIR/overlapping_range_endpoints.rs:1:9 | LL | #![deny(overlapping_range_endpoints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:16:22 + --> $DIR/overlapping_range_endpoints.rs:15:22 | LL | m!(0u8, 30..=40, 20..=30); | ------- ^^^^^^^ ... with this range @@ -24,7 +24,7 @@ LL | m!(0u8, 30..=40, 20..=30); = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:19:21 + --> $DIR/overlapping_range_endpoints.rs:18:21 | LL | m!(0u8, 20..30, 29..=40); | ------ ^^^^^^^ ... with this range @@ -34,7 +34,7 @@ LL | m!(0u8, 20..30, 29..=40); = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:23:22 + --> $DIR/overlapping_range_endpoints.rs:22:22 | LL | m!(0u8, 20..=30, 30..=31); | ------- ^^^^^^^ ... with this range @@ -44,7 +44,7 @@ LL | m!(0u8, 20..=30, 30..=31); = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:27:22 + --> $DIR/overlapping_range_endpoints.rs:26:22 | LL | m!(0u8, 20..=30, 19..=20); | ------- ^^^^^^^ ... with this range @@ -54,7 +54,7 @@ LL | m!(0u8, 20..=30, 19..=20); = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:39:9 + --> $DIR/overlapping_range_endpoints.rs:38:9 | LL | 0..=10 => {} | ------ this range overlaps on `10_u8`... @@ -65,7 +65,7 @@ LL | 10..=20 => {} = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:39:9 + --> $DIR/overlapping_range_endpoints.rs:38:9 | LL | 20..=30 => {} | ------- this range overlaps on `20_u8`... @@ -75,7 +75,7 @@ LL | 10..=20 => {} = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:46:10 + --> $DIR/overlapping_range_endpoints.rs:45:10 | LL | (0..=10, true) => {} | ------ this range overlaps on `10_u8`... @@ -85,7 +85,7 @@ LL | (10..20, true) => {} = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:52:16 + --> $DIR/overlapping_range_endpoints.rs:51:16 | LL | (true, 0..=10) => {} | ------ this range overlaps on `10_u8`... @@ -95,7 +95,7 @@ LL | (true, 10..20) => {} = note: you likely meant to write mutually exclusive ranges error: multiple patterns overlap on their endpoints - --> $DIR/overlapping_range_endpoints.rs:58:14 + --> $DIR/overlapping_range_endpoints.rs:57:14 | LL | Some(0..=10) => {} | ------ this range overlaps on `10_u8`... diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index 416523213c0..914c6ed60c8 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:13:11 + --> $DIR/pointer-sized-int.rs:12:11 | LL | match 0usize { | ^^^^^^ pattern `usize::MAX..` not covered @@ -13,7 +13,7 @@ LL + usize::MAX.. => todo!() | error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:18:11 + --> $DIR/pointer-sized-int.rs:17:11 | LL | match 0isize { | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered @@ -27,7 +27,7 @@ LL + ..isize::MIN | isize::MAX.. => todo!() | error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:23:8 + --> $DIR/pointer-sized-int.rs:22:8 | LL | m!(0usize, 0..=usize::MAX); | ^^^^^^ pattern `usize::MAX..` not covered @@ -40,7 +40,7 @@ LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() } | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:25:8 + --> $DIR/pointer-sized-int.rs:24:8 | LL | m!(0usize, 0..5 | 5..=usize::MAX); | ^^^^^^ pattern `usize::MAX..` not covered @@ -53,7 +53,7 @@ LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() } | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:27:8 + --> $DIR/pointer-sized-int.rs:26:8 | LL | m!(0usize, 0..usize::MAX | usize::MAX); | ^^^^^^ pattern `usize::MAX..` not covered @@ -66,7 +66,7 @@ LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() } | +++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered - --> $DIR/pointer-sized-int.rs:29:8 + --> $DIR/pointer-sized-int.rs:28:8 | LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false)); | ^^^^^^^^^^^^^^ pattern `(usize::MAX.., _)` not covered @@ -79,7 +79,7 @@ LL | match $s { $($t)+ => {}, (usize::MAX.., _) => todo!() } | ++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:38:8 + --> $DIR/pointer-sized-int.rs:37:8 | LL | m!(0isize, isize::MIN..=isize::MAX); | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered @@ -92,7 +92,7 @@ LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() } | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:40:8 + --> $DIR/pointer-sized-int.rs:39:8 | LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX); | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered @@ -105,7 +105,7 @@ LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() } | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:42:8 + --> $DIR/pointer-sized-int.rs:41:8 | LL | m!(0isize, isize::MIN..=-1 | 0 | 1..=isize::MAX); | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered @@ -118,7 +118,7 @@ LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() } | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered - --> $DIR/pointer-sized-int.rs:44:8 + --> $DIR/pointer-sized-int.rs:43:8 | LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX); | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered @@ -131,7 +131,7 @@ LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() } | ++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered - --> $DIR/pointer-sized-int.rs:47:9 + --> $DIR/pointer-sized-int.rs:46:9 | LL | (0isize, true), | ^^^^^^^^^^^^^^ patterns `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered @@ -144,7 +144,7 @@ LL | match $s { $($t)+ => {}, (..isize::MIN, _) | (isize::MAX.., _) => t | ++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0004]: non-exhaustive patterns: type `usize` is non-empty - --> $DIR/pointer-sized-int.rs:58:11 + --> $DIR/pointer-sized-int.rs:57:11 | LL | match 7usize {} | ^^^^^^ diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs index 40f086dcc71..0d6056e228f 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs @@ -1,5 +1,4 @@ //@ revisions: deny -#![feature(exclusive_range_pattern)] #![allow(overlapping_range_endpoints)] macro_rules! m { diff --git a/tests/ui/pattern/usefulness/integer-ranges/reachability.rs b/tests/ui/pattern/usefulness/integer-ranges/reachability.rs index 13b84e2c44b..a72588b623c 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/reachability.rs +++ b/tests/ui/pattern/usefulness/integer-ranges/reachability.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![allow(overlapping_range_endpoints)] #![allow(non_contiguous_range_endpoints)] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr index 0f52dfd83b9..c5b028d2038 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr @@ -1,137 +1,137 @@ error: unreachable pattern - --> $DIR/reachability.rs:19:17 + --> $DIR/reachability.rs:18:17 | LL | m!(0u8, 42, 42); | ^^ | note: the lint level is defined here - --> $DIR/reachability.rs:4:9 + --> $DIR/reachability.rs:3:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:23:22 + --> $DIR/reachability.rs:22:22 | LL | m!(0u8, 20..=30, 20); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:24:22 + --> $DIR/reachability.rs:23:22 | LL | m!(0u8, 20..=30, 21); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:25:22 + --> $DIR/reachability.rs:24:22 | LL | m!(0u8, 20..=30, 25); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:26:22 + --> $DIR/reachability.rs:25:22 | LL | m!(0u8, 20..=30, 29); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:27:22 + --> $DIR/reachability.rs:26:22 | LL | m!(0u8, 20..=30, 30); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:30:21 + --> $DIR/reachability.rs:29:21 | LL | m!(0u8, 20..30, 20); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:31:21 + --> $DIR/reachability.rs:30:21 | LL | m!(0u8, 20..30, 21); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:32:21 + --> $DIR/reachability.rs:31:21 | LL | m!(0u8, 20..30, 25); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:33:21 + --> $DIR/reachability.rs:32:21 | LL | m!(0u8, 20..30, 29); | ^^ error: unreachable pattern - --> $DIR/reachability.rs:37:22 + --> $DIR/reachability.rs:36:22 | LL | m!(0u8, 20..=30, 20..=30); | ^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:38:22 + --> $DIR/reachability.rs:37:22 | LL | m!(0u8, 20.. 30, 20.. 30); | ^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:39:22 + --> $DIR/reachability.rs:38:22 | LL | m!(0u8, 20..=30, 20.. 30); | ^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:41:22 + --> $DIR/reachability.rs:40:22 | LL | m!(0u8, 20..=30, 21..=30); | ^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:42:22 + --> $DIR/reachability.rs:41:22 | LL | m!(0u8, 20..=30, 20..=29); | ^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:44:24 + --> $DIR/reachability.rs:43:24 | LL | m!('a', 'A'..='z', 'a'..='z'); | ^^^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:51:9 + --> $DIR/reachability.rs:50:9 | LL | 5..=8 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:57:9 + --> $DIR/reachability.rs:56:9 | LL | 5..15 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:64:9 + --> $DIR/reachability.rs:63:9 | LL | 5..25 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:72:9 + --> $DIR/reachability.rs:71:9 | LL | 5..25 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:78:9 + --> $DIR/reachability.rs:77:9 | LL | 5..15 => {}, | ^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:85:9 + --> $DIR/reachability.rs:84:9 | LL | _ => {}, | - matches any value @@ -139,19 +139,19 @@ LL | '\u{D7FF}'..='\u{E000}' => {}, | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern error: unreachable pattern - --> $DIR/reachability.rs:90:9 + --> $DIR/reachability.rs:89:9 | LL | '\u{D7FF}'..='\u{E000}' => {}, | ^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/reachability.rs:106:9 + --> $DIR/reachability.rs:105:9 | LL | &FOO => {} | ^^^^ error: unreachable pattern - --> $DIR/reachability.rs:107:9 + --> $DIR/reachability.rs:106:9 | LL | BAR => {} | ^^^ diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs index 206f05d0d3c..50203d3cf4f 100644 --- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs +++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.rs @@ -1,4 +1,3 @@ -#![feature(exclusive_range_pattern)] #![allow(unreachable_patterns)] fn main() { match 0u8 { diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr index 21f1fdba886..38ce1a8a240 100644 --- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr +++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr @@ -1,11 +1,11 @@ error: literal out of range for `u8` - --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14 + --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:4:14 | LL | 251..257 => {} | ^^^ this value does not fit into the type `u8` whose range is `0..=255` error: literal out of range for `u8` - --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:7:15 + --> $DIR/range-pattern-out-of-bounds-issue-68972.rs:6:15 | LL | 251..=256 => {} | ^^^ this value does not fit into the type `u8` whose range is `0..=255` diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index 25e98b4746b..e5eacd741fb 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -6,6 +6,10 @@ LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | help: consider importing one of these items | +LL + use std::f128::consts::LOG10_2; + | +LL + use std::f16::consts::LOG10_2; + | LL + use std::f32::consts::LOG10_2; | LL + use std::f64::consts::LOG10_2; diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 622de9b39bd..c5e245d884b 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -107,6 +107,10 @@ LL | (E::TupleWithFields(/* fields */)).foo(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: consider importing one of these items instead | +LL + use std::f128::consts::E; + | +LL + use std::f16::consts::E; + | LL + use std::f32::consts::E; | LL + use std::f64::consts::E; diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index b10eded015f..01c8a38d2a4 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -84,6 +84,10 @@ LL | let _: E = m::f; | ~ help: consider importing one of these items instead | +LL + use std::f128::consts::E; + | +LL + use std::f16::consts::E; + | LL + use std::f32::consts::E; | LL + use std::f64::consts::E; @@ -121,6 +125,10 @@ LL | let _: E = (E::Fn(/* fields */)); | ~~~~~~~~~~~~~~~~~~~~~ help: consider importing one of these items instead | +LL + use std::f128::consts::E; + | +LL + use std::f16::consts::E; + | LL + use std::f32::consts::E; | LL + use std::f64::consts::E; diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/check.rs b/tests/ui/rfcs/rfc-0000-never_patterns/check.rs index 0831477e749..dc13dd05fa6 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/check.rs +++ b/tests/ui/rfcs/rfc-0000-never_patterns/check.rs @@ -1,3 +1,4 @@ +// Check that never patterns can't have bodies or guards. #![feature(never_patterns)] #![allow(incomplete_features)] diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr index 25f7343a8a8..fbf7aa02ac2 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/check.stderr @@ -1,5 +1,5 @@ error: a never pattern is always unreachable - --> $DIR/check.rs:14:20 + --> $DIR/check.rs:15:20 | LL | Some(!) => {} | ^^ @@ -8,13 +8,13 @@ LL | Some(!) => {} | help: remove this expression error: a guard on a never pattern will never be run - --> $DIR/check.rs:19:20 + --> $DIR/check.rs:20:20 | LL | Some(!) if true, | ^^^^ help: remove this guard error: a never pattern is always unreachable - --> $DIR/check.rs:24:28 + --> $DIR/check.rs:25:28 | LL | Some(!) if true => {} | ^^ @@ -23,7 +23,7 @@ LL | Some(!) if true => {} | help: remove this expression error: a never pattern is always unreachable - --> $DIR/check.rs:29:27 + --> $DIR/check.rs:30:27 | LL | Some(never!()) => {} | ^^ @@ -32,7 +32,7 @@ LL | Some(never!()) => {} | help: remove this expression error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/check.rs:18:11 + --> $DIR/check.rs:19:11 | LL | match None::<Void> { | ^^^^^^^^^^^^ pattern `Some(!)` not covered @@ -50,7 +50,7 @@ LL + Some(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/check.rs:23:11 + --> $DIR/check.rs:24:11 | LL | match None::<Void> { | ^^^^^^^^^^^^ pattern `Some(!)` not covered diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.rs b/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.rs new file mode 100644 index 00000000000..f8f9d7a9aa6 --- /dev/null +++ b/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.rs @@ -0,0 +1,12 @@ +#![feature(never_patterns)] +#![allow(incomplete_features)] + +enum Void {} + +fn main() {} + +fn anything<T>() -> T { + let x: Void; + match x { ! } + //~^ ERROR used binding `x` isn't initialized +} diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.stderr new file mode 100644 index 00000000000..1a6c4127085 --- /dev/null +++ b/tests/ui/rfcs/rfc-0000-never_patterns/check_place_is_initialized.stderr @@ -0,0 +1,16 @@ +error[E0381]: used binding `x` isn't initialized + --> $DIR/check_place_is_initialized.rs:10:15 + | +LL | let x: Void; + | - binding declared here but left uninitialized +LL | match x { ! } + | ^ `x` used here but it isn't initialized + | +help: consider assigning a value + | +LL | let x: Void = /* value */; + | +++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs index e8bfa9245f5..8300f953dc1 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs +++ b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs @@ -123,3 +123,15 @@ fn never_pattern_typeck_pass(void: Void) { Some(!), } } + +struct Unsized { + void: Void, + slice: [u8], +} + +#[cfg(pass)] +fn not_sized(x: &Unsized) { + match *x { + !, + } +} diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/use-bindings.rs b/tests/ui/rfcs/rfc-0000-never_patterns/use-bindings.rs new file mode 100644 index 00000000000..33da6f02ce2 --- /dev/null +++ b/tests/ui/rfcs/rfc-0000-never_patterns/use-bindings.rs @@ -0,0 +1,29 @@ +//@ check-pass +#![feature(never_patterns)] +#![allow(incomplete_features)] + +#[derive(Copy, Clone)] +enum Void {} + +fn main() { + let res_void: Result<bool, Void> = Ok(true); + + let (Ok(x) | Err(!)) = res_void; + println!("{x}"); + let (Ok(x) | Err(!)) = &res_void; + println!("{x}"); + let (Err(!) | Ok(x)) = res_void; + println!("{x}"); + + match res_void { + Ok(x) | Err(!) => println!("{x}"), + } + match res_void { + Err(!) | Ok(x) => println!("{x}"), + } + + let res_res_void: Result<Result<bool, Void>, Void> = Ok(Ok(true)); + match res_res_void { + Ok(Ok(x) | Err(!)) | Err(!) => println!("{x}"), + } +} diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.rs index d43db576b38..6d6a336e688 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.rs +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.rs @@ -1,5 +1,4 @@ // Matching against NaN should result in an error -#![feature(exclusive_range_pattern)] #![allow(unused)] const NAN: f64 = f64::NAN; diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.stderr index 167ada783c2..baca1d75048 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.stderr +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-6804-nan-match.stderr @@ -1,5 +1,5 @@ error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:15:9 + --> $DIR/issue-6804-nan-match.rs:14:9 | LL | NAN => {}, | ^^^ @@ -8,7 +8,7 @@ LL | NAN => {}, = help: try using the `is_nan` method instead error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:20:10 + --> $DIR/issue-6804-nan-match.rs:19:10 | LL | [NAN, _] => {}, | ^^^ @@ -17,7 +17,7 @@ LL | [NAN, _] => {}, = help: try using the `is_nan` method instead error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:25:9 + --> $DIR/issue-6804-nan-match.rs:24:9 | LL | C => {}, | ^ @@ -26,7 +26,7 @@ LL | C => {}, = help: try using the `is_nan` method instead error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:31:9 + --> $DIR/issue-6804-nan-match.rs:30:9 | LL | NAN..=1.0 => {}, | ^^^ @@ -35,13 +35,13 @@ LL | NAN..=1.0 => {}, = help: try using the `is_nan` method instead error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/issue-6804-nan-match.rs:31:9 + --> $DIR/issue-6804-nan-match.rs:30:9 | LL | NAN..=1.0 => {}, | ^^^^^^^^^ lower bound larger than upper bound error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:33:16 + --> $DIR/issue-6804-nan-match.rs:32:16 | LL | -1.0..=NAN => {}, | ^^^ @@ -50,13 +50,13 @@ LL | -1.0..=NAN => {}, = help: try using the `is_nan` method instead error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/issue-6804-nan-match.rs:33:9 + --> $DIR/issue-6804-nan-match.rs:32:9 | LL | -1.0..=NAN => {}, | ^^^^^^^^^^ lower bound larger than upper bound error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:35:9 + --> $DIR/issue-6804-nan-match.rs:34:9 | LL | NAN.. => {}, | ^^^ @@ -65,13 +65,13 @@ LL | NAN.. => {}, = help: try using the `is_nan` method instead error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/issue-6804-nan-match.rs:35:9 + --> $DIR/issue-6804-nan-match.rs:34:9 | LL | NAN.. => {}, | ^^^^^ lower bound larger than upper bound error: cannot use NaN in patterns - --> $DIR/issue-6804-nan-match.rs:37:11 + --> $DIR/issue-6804-nan-match.rs:36:11 | LL | ..NAN => {}, | ^^^ @@ -80,7 +80,7 @@ LL | ..NAN => {}, = help: try using the `is_nan` method instead error[E0579]: lower range bound must be less than upper - --> $DIR/issue-6804-nan-match.rs:37:9 + --> $DIR/issue-6804-nan-match.rs:36:9 | LL | ..NAN => {}, | ^^^^^ diff --git a/tests/ui/rust-2018/async-ident.fixed b/tests/ui/rust-2018/async-ident.fixed index 4e31f674435..639a8a245fb 100644 --- a/tests/ui/rust-2018/async-ident.fixed +++ b/tests/ui/rust-2018/async-ident.fixed @@ -9,16 +9,14 @@ fn r#async() {} //~ ERROR async macro_rules! foo { ($foo:ident) => {}; - ($r#async:expr, r#async) => {}; + ($async:expr, r#async) => {}; //~^ ERROR async - //~| ERROR async - //~| WARN this is accepted in the current edition //~| WARN this is accepted in the current edition } foo!(r#async); - //~^ ERROR async - //~| WARN this is accepted in the current edition +//~^ ERROR async +//~| WARN this is accepted in the current edition mod dont_lint_raw { fn r#async() {} diff --git a/tests/ui/rust-2018/async-ident.rs b/tests/ui/rust-2018/async-ident.rs index 4c5134a2923..7921f05f481 100644 --- a/tests/ui/rust-2018/async-ident.rs +++ b/tests/ui/rust-2018/async-ident.rs @@ -11,14 +11,12 @@ macro_rules! foo { ($foo:ident) => {}; ($async:expr, async) => {}; //~^ ERROR async - //~| ERROR async - //~| WARN this is accepted in the current edition //~| WARN this is accepted in the current edition } foo!(async); - //~^ ERROR async - //~| WARN this is accepted in the current edition +//~^ ERROR async +//~| WARN this is accepted in the current edition mod dont_lint_raw { fn r#async() {} diff --git a/tests/ui/rust-2018/async-ident.stderr b/tests/ui/rust-2018/async-ident.stderr index 5b8d8184f4f..4ab061dd6f5 100644 --- a/tests/ui/rust-2018/async-ident.stderr +++ b/tests/ui/rust-2018/async-ident.stderr @@ -14,15 +14,6 @@ LL | #![deny(keyword_idents)] = note: `#[deny(keyword_idents_2018)]` implied by `#[deny(keyword_idents)]` error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:12:7 - | -LL | ($async:expr, async) => {}; - | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> - -error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:12:19 | LL | ($async:expr, async) => {}; @@ -32,7 +23,7 @@ LL | ($async:expr, async) => {}; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:19:6 + --> $DIR/async-ident.rs:17:6 | LL | foo!(async); | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -41,7 +32,7 @@ LL | foo!(async); = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:28:11 + --> $DIR/async-ident.rs:26:11 | LL | trait async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -50,7 +41,7 @@ LL | trait async {} = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:32:10 + --> $DIR/async-ident.rs:30:10 | LL | impl async for MyStruct {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -59,7 +50,7 @@ LL | impl async for MyStruct {} = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:38:12 + --> $DIR/async-ident.rs:36:12 | LL | static async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -68,7 +59,7 @@ LL | static async: u32 = 0; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:44:11 + --> $DIR/async-ident.rs:42:11 | LL | const async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -77,7 +68,7 @@ LL | const async: u32 = 0; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:50:15 + --> $DIR/async-ident.rs:48:15 | LL | impl Foo { fn async() {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -86,7 +77,7 @@ LL | impl Foo { fn async() {} } = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:55:12 + --> $DIR/async-ident.rs:53:12 | LL | struct async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -95,7 +86,7 @@ LL | struct async {} = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:58:9 + --> $DIR/async-ident.rs:56:9 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -104,7 +95,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:58:16 + --> $DIR/async-ident.rs:56:16 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -113,7 +104,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:58:24 + --> $DIR/async-ident.rs:56:24 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -122,7 +113,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:69:19 + --> $DIR/async-ident.rs:67:19 | LL | () => (pub fn async() {}) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -131,7 +122,7 @@ LL | () => (pub fn async() {}) = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:76:6 + --> $DIR/async-ident.rs:74:6 | LL | (async) => (1) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -139,5 +130,5 @@ LL | (async) => (1) = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> -error: aborting due to 15 previous errors +error: aborting due to 14 previous errors diff --git a/tests/ui/rust-2024/gen-kw-in-macro.rs b/tests/ui/rust-2024/gen-kw-in-macro.rs new file mode 100644 index 00000000000..3ccbe05b226 --- /dev/null +++ b/tests/ui/rust-2024/gen-kw-in-macro.rs @@ -0,0 +1,13 @@ +//@ check-pass + +#![deny(keyword_idents_2024)] + +macro_rules! foo { + ($gen:expr) => { + $gen + }; +} + +fn main() { + foo!(println!("hello, world")); +} diff --git a/tests/ui/rust-2024/gen-kw.e2015.stderr b/tests/ui/rust-2024/gen-kw.e2015.stderr index b12363184b7..b1074f77e00 100644 --- a/tests/ui/rust-2024/gen-kw.e2015.stderr +++ b/tests/ui/rust-2024/gen-kw.e2015.stderr @@ -22,5 +22,14 @@ LL | let gen = r#gen; = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> -error: aborting due to 2 previous errors +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:19:27 + | +LL | () => { mod test { fn gen() {} } } + | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2024/gen-kw.e2018.stderr b/tests/ui/rust-2024/gen-kw.e2018.stderr index e10fc4c4512..b902cff7fdb 100644 --- a/tests/ui/rust-2024/gen-kw.e2018.stderr +++ b/tests/ui/rust-2024/gen-kw.e2018.stderr @@ -22,5 +22,14 @@ LL | let gen = r#gen; = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> -error: aborting due to 2 previous errors +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:19:27 + | +LL | () => { mod test { fn gen() {} } } + | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2024/gen-kw.rs b/tests/ui/rust-2024/gen-kw.rs index 3d2a3f95165..04251cbcac4 100644 --- a/tests/ui/rust-2024/gen-kw.rs +++ b/tests/ui/rust-2024/gen-kw.rs @@ -14,3 +14,12 @@ fn main() { //[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! } + +macro_rules! t { + () => { mod test { fn gen() {} } } + //~^ ERROR `gen` is a keyword in the 2024 edition + //[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! +} + +t!(); diff --git a/tests/ui/span/macro-ty-params.rs b/tests/ui/span/macro-ty-params.rs index cf28b0255d1..c7ce9b9faed 100644 --- a/tests/ui/span/macro-ty-params.rs +++ b/tests/ui/span/macro-ty-params.rs @@ -11,5 +11,4 @@ fn main() { foo::<>!(); //~ ERROR generic arguments in macro path m!(Default<>); //~^ ERROR unexpected generic arguments in path - //~^^ ERROR generic arguments in macro path } diff --git a/tests/ui/span/macro-ty-params.stderr b/tests/ui/span/macro-ty-params.stderr index 7023ef8cd1c..138cd2598a1 100644 --- a/tests/ui/span/macro-ty-params.stderr +++ b/tests/ui/span/macro-ty-params.stderr @@ -16,11 +16,5 @@ error: unexpected generic arguments in path LL | m!(Default<>); | ^^ -error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:12:15 - | -LL | m!(Default<>); - | ^^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/std/slice-from-array-issue-113238.rs b/tests/ui/std/slice-from-array-issue-113238.rs deleted file mode 100644 index 44f2d7a9478..00000000000 --- a/tests/ui/std/slice-from-array-issue-113238.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass - -// This intends to use the unsizing coercion from array to slice, but it only -// works if we resolve `<&[u8]>::from` as the reflexive `From<T> for T`. In -// #113238, we found that gimli had added its own `From<EndianSlice> for &[u8]` -// that affected all `std/backtrace` users. -fn main() { - let _ = <&[u8]>::from(&[]); -} diff --git a/tests/ui/stdlib-unit-tests/builtin-clone.rs b/tests/ui/stdlib-unit-tests/builtin-clone.rs deleted file mode 100644 index 47c00ede0e9..00000000000 --- a/tests/ui/stdlib-unit-tests/builtin-clone.rs +++ /dev/null @@ -1,45 +0,0 @@ -//@ run-pass -// Test that `Clone` is correctly implemented for builtin types. -// Also test that cloning an array or a tuple is done right, i.e. -// each component is cloned. - -fn test_clone<T: Clone>(arg: T) { - let _ = arg.clone(); -} - -fn foo() { } - -#[derive(Debug, PartialEq, Eq)] -struct S(i32); - -impl Clone for S { - fn clone(&self) -> Self { - S(self.0 + 1) - } -} - -fn main() { - test_clone(foo); - test_clone([1; 56]); - test_clone((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)); - - let a = [S(0), S(1), S(2)]; - let b = [S(1), S(2), S(3)]; - assert_eq!(b, a.clone()); - - let a = ( - (S(1), S(0)), - ( - (S(0), S(0), S(1)), - S(0) - ) - ); - let b = ( - (S(2), S(1)), - ( - (S(1), S(1), S(2)), - S(1) - ) - ); - assert_eq!(b, a.clone()); -} diff --git a/tests/ui/stdlib-unit-tests/eq-multidispatch.rs b/tests/ui/stdlib-unit-tests/eq-multidispatch.rs deleted file mode 100644 index 4a991624e34..00000000000 --- a/tests/ui/stdlib-unit-tests/eq-multidispatch.rs +++ /dev/null @@ -1,30 +0,0 @@ -//@ run-pass - -#[derive(PartialEq, Debug)] -struct Bar; -#[derive(Debug)] -struct Baz; -#[derive(Debug)] -struct Foo; -#[derive(Debug)] -struct Fu; - -impl PartialEq for Baz { fn eq(&self, _: &Baz) -> bool { true } } - -impl PartialEq<Fu> for Foo { fn eq(&self, _: &Fu) -> bool { true } } -impl PartialEq<Foo> for Fu { fn eq(&self, _: &Foo) -> bool { true } } - -impl PartialEq<Bar> for Foo { fn eq(&self, _: &Bar) -> bool { false } } -impl PartialEq<Foo> for Bar { fn eq(&self, _: &Foo) -> bool { false } } - -fn main() { - assert!(Bar != Foo); - assert!(Foo != Bar); - - assert_eq!(Bar, Bar); - - assert_eq!(Baz, Baz); - - assert_eq!(Foo, Fu); - assert_eq!(Fu, Foo); -} diff --git a/tests/ui/stdlib-unit-tests/issue-21058.rs b/tests/ui/stdlib-unit-tests/issue-21058.rs deleted file mode 100644 index 0e04f1e21b8..00000000000 --- a/tests/ui/stdlib-unit-tests/issue-21058.rs +++ /dev/null @@ -1,64 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -use std::fmt::Debug; - -struct NT(str); -struct DST { a: u32, b: str } - -macro_rules! check { - (val: $ty_of:expr, $expected:expr) => { - assert_eq!(type_name_of_val($ty_of), $expected); - }; - ($ty:ty, $expected:expr) => { - assert_eq!(std::any::type_name::<$ty>(), $expected); - }; -} - -fn main() { - // type_name should support unsized types - check!([u8], "[u8]"); - check!(str, "str"); - check!(dyn Send, "dyn core::marker::Send"); - check!(NT, "issue_21058::NT"); - check!(DST, "issue_21058::DST"); - check!(&i32, "&i32"); - check!(&'static i32, "&i32"); - check!((i32, u32), "(i32, u32)"); - check!(val: foo(), "issue_21058::Foo"); - check!(val: Foo::new, "issue_21058::Foo::new"); - check!(val: - <Foo as Debug>::fmt, - "<issue_21058::Foo as core::fmt::Debug>::fmt" - ); - check!(val: || {}, "issue_21058::main::{{closure}}"); - bar::<i32>(); -} - -trait Trait { - type Assoc; -} - -impl Trait for i32 { - type Assoc = String; -} - -fn bar<T: Trait>() { - check!(T::Assoc, "alloc::string::String"); - check!(T, "i32"); -} - -fn type_name_of_val<T>(_: T) -> &'static str { - std::any::type_name::<T>() -} - -#[derive(Debug)] -struct Foo; - -impl Foo { - fn new() -> Self { Foo } -} - -fn foo() -> impl Debug { - Foo -} diff --git a/tests/ui/stdlib-unit-tests/istr.rs b/tests/ui/stdlib-unit-tests/istr.rs deleted file mode 100644 index f6298919425..00000000000 --- a/tests/ui/stdlib-unit-tests/istr.rs +++ /dev/null @@ -1,51 +0,0 @@ -//@ run-pass - -fn test_stack_assign() { - let s: String = "a".to_string(); - println!("{}", s.clone()); - let t: String = "a".to_string(); - assert_eq!(s, t); - let u: String = "b".to_string(); - assert!((s != u)); -} - -fn test_heap_lit() { "a big string".to_string(); } - -fn test_heap_assign() { - let s: String = "a big ol' string".to_string(); - let t: String = "a big ol' string".to_string(); - assert_eq!(s, t); - let u: String = "a bad ol' string".to_string(); - assert!((s != u)); -} - -fn test_heap_log() { - let s = "a big ol' string".to_string(); - println!("{}", s); -} - -fn test_append() { - let mut s = String::new(); - s.push_str("a"); - assert_eq!(s, "a"); - - let mut s = String::from("a"); - s.push_str("b"); - println!("{}", s.clone()); - assert_eq!(s, "ab"); - - let mut s = String::from("c"); - s.push_str("offee"); - assert_eq!(s, "coffee"); - - s.push_str("&tea"); - assert_eq!(s, "coffee&tea"); -} - -pub fn main() { - test_stack_assign(); - test_heap_lit(); - test_heap_assign(); - test_heap_log(); - test_append(); -} diff --git a/tests/ui/stdlib-unit-tests/log-knows-the-names-of-variants-in-std.rs b/tests/ui/stdlib-unit-tests/log-knows-the-names-of-variants-in-std.rs deleted file mode 100644 index 8f351b2b40b..00000000000 --- a/tests/ui/stdlib-unit-tests/log-knows-the-names-of-variants-in-std.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ run-pass - -#![allow(non_camel_case_types)] -#![allow(dead_code)] -#[derive(Clone, Debug)] -enum foo { - a(usize), - b(String), -} - -fn check_log<T: std::fmt::Debug>(exp: String, v: T) { - assert_eq!(exp, format!("{:?}", v)); -} - -pub fn main() { - let mut x = Some(foo::a(22)); - let exp = "Some(a(22))".to_string(); - let act = format!("{:?}", x); - assert_eq!(act, exp); - check_log(exp, x); - - x = None; - let exp = "None".to_string(); - let act = format!("{:?}", x); - assert_eq!(act, exp); - check_log(exp, x); -} diff --git a/tests/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs b/tests/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs deleted file mode 100644 index bf42347df0b..00000000000 --- a/tests/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs +++ /dev/null @@ -1,64 +0,0 @@ -//@ run-pass - -use std::fmt::Debug; -use std::cmp::{self, Ordering}; - -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -struct Foo { - n: u8, - name: &'static str -} - -impl PartialOrd for Foo { - fn partial_cmp(&self, other: &Foo) -> Option<Ordering> { - Some(self.cmp(other)) - } -} - -impl Ord for Foo { - fn cmp(&self, other: &Foo) -> Ordering { - self.n.cmp(&other.n) - } -} - -fn main() { - let a = Foo { n: 4, name: "a" }; - let b = Foo { n: 4, name: "b" }; - let c = Foo { n: 8, name: "c" }; - let d = Foo { n: 8, name: "d" }; - let e = Foo { n: 22, name: "e" }; - let f = Foo { n: 22, name: "f" }; - - let data = [a, b, c, d, e, f]; - - // `min` should return the left when the values are equal - assert_eq!(data.iter().min(), Some(&a)); - assert_eq!(data.iter().min_by_key(|a| a.n), Some(&a)); - assert_eq!(cmp::min(a, b), a); - assert_eq!(cmp::min(b, a), b); - - // `max` should return the right when the values are equal - assert_eq!(data.iter().max(), Some(&f)); - assert_eq!(data.iter().max_by_key(|a| a.n), Some(&f)); - assert_eq!(cmp::max(e, f), f); - assert_eq!(cmp::max(f, e), e); - - let mut presorted = data.to_vec(); - presorted.sort(); - assert_stable(&presorted); - - let mut presorted = data.to_vec(); - presorted.sort_by(|a, b| a.cmp(b)); - assert_stable(&presorted); - - // Assert that sorted and min/max are the same - fn assert_stable<T: Ord + Debug>(presorted: &[T]) { - for slice in presorted.windows(2) { - let a = &slice[0]; - let b = &slice[1]; - - assert_eq!(a, cmp::min(a, b)); - assert_eq!(b, cmp::max(a, b)); - } - } -} diff --git a/tests/ui/stdlib-unit-tests/seq-compare.rs b/tests/ui/stdlib-unit-tests/seq-compare.rs deleted file mode 100644 index 1be0569e17c..00000000000 --- a/tests/ui/stdlib-unit-tests/seq-compare.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ run-pass - -pub fn main() { - assert!(("hello".to_string() < "hellr".to_string())); - assert!(("hello ".to_string() > "hello".to_string())); - assert!(("hello".to_string() != "there".to_string())); - assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); - assert!((vec![1, 2, 3] < vec![1, 2, 3, 4])); - assert!((vec![1, 2, 4, 4] > vec![1, 2, 3, 4])); - assert!((vec![1, 2, 3, 4] < vec![1, 2, 4, 4])); - assert!((vec![1, 2, 3] <= vec![1, 2, 3])); - assert!((vec![1, 2, 3] <= vec![1, 2, 3, 3])); - assert!((vec![1, 2, 3, 4] > vec![1, 2, 3])); - assert_eq!(vec![1, 2, 3], vec![1, 2, 3]); - assert!((vec![1, 2, 3] != vec![1, 1, 3])); -} diff --git a/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs b/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs deleted file mode 100644 index ef227a9134d..00000000000 --- a/tests/ui/stdlib-unit-tests/volatile-fat-ptr.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ run-pass - -#![allow(stable_features)] -#![feature(volatile)] -use std::ptr::{read_volatile, write_volatile}; - -fn main() { - let mut x: &'static str = "test"; - unsafe { - let a = read_volatile(&x); - assert_eq!(a, "test"); - write_volatile(&mut x, "foo"); - assert_eq!(x, "foo"); - } -} diff --git a/tests/crashes/113272.rs b/tests/ui/structs/ice-struct-tail-normalization-113272.rs index d161575c657..85d3d1b4886 100644 --- a/tests/crashes/113272.rs +++ b/tests/ui/structs/ice-struct-tail-normalization-113272.rs @@ -1,9 +1,10 @@ -//@ known-bug: #113272 trait Trait { type RefTarget; } impl Trait for () where Missing: Trait {} +//~^ ERROR cannot find type `Missing` in this scope +//~| ERROR not all trait items implemented, missing: `RefTarget` struct Other { data: <() as Trait>::RefTarget, diff --git a/tests/ui/structs/ice-struct-tail-normalization-113272.stderr b/tests/ui/structs/ice-struct-tail-normalization-113272.stderr new file mode 100644 index 00000000000..a205eb80f5c --- /dev/null +++ b/tests/ui/structs/ice-struct-tail-normalization-113272.stderr @@ -0,0 +1,19 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/ice-struct-tail-normalization-113272.rs:5:25 + | +LL | impl Trait for () where Missing: Trait {} + | ^^^^^^^ not found in this scope + +error[E0046]: not all trait items implemented, missing: `RefTarget` + --> $DIR/ice-struct-tail-normalization-113272.rs:5:1 + | +LL | type RefTarget; + | -------------- `RefTarget` from trait +... +LL | impl Trait for () where Missing: Trait {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0046, E0412. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/suggestions/unused-imports.fixed b/tests/ui/suggestions/unused-imports.fixed new file mode 100644 index 00000000000..57dd091c043 --- /dev/null +++ b/tests/ui/suggestions/unused-imports.fixed @@ -0,0 +1,35 @@ +//@ run-rustfix +//@ check-pass + +#![warn(unused_imports)] + +pub mod nested { + pub struct A; + pub struct B; + pub struct C; + pub struct D; + pub mod even_more { + pub struct E; + pub struct F; + pub struct G; + } + pub mod another { + pub struct H; + pub struct I; + } +} + +use nested::B; +//~^ WARN unused import + +use nested::even_more::F; +//~^^^^^^^ WARN unused import + +// Note that the following fix should result in `::{self}`, not `::self`. The latter is invalid +// Rust syntax, so the braces should not be removed. +use nested::another::{self}; +//~^ WARN unused import + +fn main() { + let _ = (B, F, another::I); +} diff --git a/tests/ui/suggestions/unused-imports.rs b/tests/ui/suggestions/unused-imports.rs new file mode 100644 index 00000000000..5f9dd243bdd --- /dev/null +++ b/tests/ui/suggestions/unused-imports.rs @@ -0,0 +1,42 @@ +//@ run-rustfix +//@ check-pass + +#![warn(unused_imports)] + +pub mod nested { + pub struct A; + pub struct B; + pub struct C; + pub struct D; + pub mod even_more { + pub struct E; + pub struct F; + pub struct G; + } + pub mod another { + pub struct H; + pub struct I; + } +} + +use nested::{A, B, C}; +//~^ WARN unused import + +use nested::{ + D, + even_more::{ + E, + F, + G, + }, + }; +//~^^^^^^^ WARN unused import + +// Note that the following fix should result in `::{self}`, not `::self`. The latter is invalid +// Rust syntax, so the braces should not be removed. +use nested::another::{self, I}; +//~^ WARN unused import + +fn main() { + let _ = (B, F, another::I); +} diff --git a/tests/ui/suggestions/unused-imports.stderr b/tests/ui/suggestions/unused-imports.stderr new file mode 100644 index 00000000000..bf112608da7 --- /dev/null +++ b/tests/ui/suggestions/unused-imports.stderr @@ -0,0 +1,32 @@ +warning: unused imports: `A`, `C` + --> $DIR/unused-imports.rs:22:14 + | +LL | use nested::{A, B, C}; + | ^ ^ + | +note: the lint level is defined here + --> $DIR/unused-imports.rs:4:9 + | +LL | #![warn(unused_imports)] + | ^^^^^^^^^^^^^^ + +warning: unused imports: `D`, `E`, `G` + --> $DIR/unused-imports.rs:26:5 + | +LL | D, + | ^ +LL | even_more::{ +LL | E, + | ^ +LL | F, +LL | G, + | ^ + +warning: unused import: `I` + --> $DIR/unused-imports.rs:37:29 + | +LL | use nested::another::{self, I}; + | ^ + +warning: 3 warnings emitted + diff --git a/tests/ui/target-feature/tied-features-cli.rs b/tests/ui/target-feature/tied-features-cli.rs index 1168245461f..17c13826ce9 100644 --- a/tests/ui/target-feature/tied-features-cli.rs +++ b/tests/ui/target-feature/tied-features-cli.rs @@ -1,4 +1,4 @@ -//@ revisions: one two three +//@ revisions: one two three four //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 // diff --git a/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.rs b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.rs new file mode 100644 index 00000000000..26d63fdde99 --- /dev/null +++ b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.rs @@ -0,0 +1,9 @@ +//@ compile-flags: -Znext-solver + +#[derive(Debug)] +struct X<const FN: fn() = { || {} }>; +//~^ ERROR using function pointers as const generic parameters is forbidden +//~| ERROR using function pointers as const generic parameters is forbidden +//~| ERROR type annotations needed + +fn main() {} diff --git a/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr new file mode 100644 index 00000000000..044c24fd2b2 --- /dev/null +++ b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr @@ -0,0 +1,26 @@ +error[E0282]: type annotations needed + --> $DIR/const-region-infer-to-static-in-binder.rs:4:10 + | +LL | struct X<const FN: fn() = { || {} }>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the constant `{ || {} }` + +error: using function pointers as const generic parameters is forbidden + --> $DIR/const-region-infer-to-static-in-binder.rs:4:20 + | +LL | struct X<const FN: fn() = { || {} }>; + | ^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error: using function pointers as const generic parameters is forbidden + --> $DIR/const-region-infer-to-static-in-binder.rs:4:20 + | +LL | struct X<const FN: fn() = { || {} }>; + | ^^^^ + | + = note: the only supported types are integers, `bool` and `char` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/next-solver/canonicalize-effect-var.rs b/tests/ui/traits/next-solver/canonical/effect-var.rs index 6d0f09bb9be..6d0f09bb9be 100644 --- a/tests/ui/traits/next-solver/canonicalize-effect-var.rs +++ b/tests/ui/traits/next-solver/canonical/effect-var.rs diff --git a/tests/ui/traits/next-solver/canonical-int-var-eq-in-response.rs b/tests/ui/traits/next-solver/canonical/int-var-eq-in-response.rs index 6c07817ff03..6c07817ff03 100644 --- a/tests/ui/traits/next-solver/canonical-int-var-eq-in-response.rs +++ b/tests/ui/traits/next-solver/canonical/int-var-eq-in-response.rs diff --git a/tests/ui/traits/next-solver/canonical-ty-var-eq-in-response.rs b/tests/ui/traits/next-solver/canonical/ty-var-eq-in-response.rs index 2f9e919da2e..2f9e919da2e 100644 --- a/tests/ui/traits/next-solver/canonical-ty-var-eq-in-response.rs +++ b/tests/ui/traits/next-solver/canonical/ty-var-eq-in-response.rs diff --git a/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-1.rs b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-1.rs new file mode 100644 index 00000000000..151c3b226c1 --- /dev/null +++ b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-1.rs @@ -0,0 +1,43 @@ +//@ compile-flags: -Znext-solver=coherence +//@ check-pass + +// A regression test for #124791. Computing ambiguity causes +// for the overlap of the `ToString` impls caused an ICE. +#![crate_type = "lib"] +#![feature(min_specialization)] +trait Display {} + +trait ToOwned { + type Owned; +} + +impl<T> ToOwned for T { + type Owned = T; +} + +struct Cow<B: ?Sized>(B); + +impl<B: ?Sized> Display for Cow<B> +where + B: ToOwned, + B::Owned: Display, +{ +} + +impl Display for () {} + +trait ToString { + fn to_string(); +} + +impl<T: Display + ?Sized> ToString for T { + default fn to_string() {} +} + +impl ToString for Cow<str> { + fn to_string() {} +} + +impl ToOwned for str { + type Owned = (); +} diff --git a/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.rs b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.rs new file mode 100644 index 00000000000..b472499cb0b --- /dev/null +++ b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.rs @@ -0,0 +1,19 @@ +//@ compile-flags: -Znext-solver=coherence + +// A regression test for #124791. Computing ambiguity causes +// for the overlap of the `ToString` impls caused an ICE. +#![crate_type = "lib"] +trait ToOwned { + type Owned; +} +impl<T> ToOwned for T { + type Owned = u8; +} +impl ToOwned for str { + type Owned = i8; +} + +trait Overlap {} +impl<T: ToOwned<Owned = i8> + ?Sized> Overlap for T {} +impl Overlap for str {} +//~^ ERROR conflicting implementations of trait `Overlap` diff --git a/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.stderr b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.stderr new file mode 100644 index 00000000000..469f7a909b1 --- /dev/null +++ b/tests/ui/traits/next-solver/coherence/ambiguity-causes-canonical-state-ice-2.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Overlap` for type `str` + --> $DIR/ambiguity-causes-canonical-state-ice-2.rs:18:1 + | +LL | impl<T: ToOwned<Owned = i8> + ?Sized> Overlap for T {} + | --------------------------------------------------- first implementation here +LL | impl Overlap for str {} + | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `str` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs index bc9bb6ce2d7..7eea81ce03c 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.rs @@ -61,7 +61,7 @@ where // entering the cycle from `A` fails, but would work if we were to use the cache // result of `B<X>`. impls_trait::<A<X>, _, _, _>(); - //~^ ERROR the trait bound `X: IncompleteGuidance<_, _>` is not satisfied + //~^ ERROR the trait bound `A<X>: Trait<_, _, _>` is not satisfied } fn main() { diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr index 78116ebba82..ffa3f29e4bd 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.stderr @@ -1,21 +1,20 @@ -error[E0277]: the trait bound `X: IncompleteGuidance<_, _>` is not satisfied +error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied --> $DIR/incompleteness-unstable-result.rs:63:19 | LL | impls_trait::<A<X>, _, _, _>(); - | ^^^^ the trait `IncompleteGuidance<_, _>` is not implemented for `X`, which is required by `A<X>: Trait<_, _, _>` + | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>`, which is required by `A<X>: Trait<_, _, _>` | - = help: the following other types implement trait `IncompleteGuidance<T, V>`: - <T as IncompleteGuidance<U, i16>> - <T as IncompleteGuidance<U, i8>> - <T as IncompleteGuidance<U, u8>> -note: required for `A<X>` to implement `Trait<_, _, u8>` + = help: the trait `Trait<U, V, D>` is implemented for `A<T>` +note: required for `A<X>` to implement `Trait<_, _, _>` --> $DIR/incompleteness-unstable-result.rs:32:50 | LL | impl<T: ?Sized, U: ?Sized, V: ?Sized, D: ?Sized> Trait<U, V, D> for A<T> | ^^^^^^^^^^^^^^ ^^^^ -LL | where -LL | T: IncompleteGuidance<U, V>, - | ------------------------ unsatisfied trait bound introduced here +... +LL | A<T>: Trait<U, D, V>, + | -------------- unsatisfied trait bound introduced here + = note: 8 redundant requirements hidden + = note: required for `A<X>` to implement `Trait<_, _, _>` note: required by a bound in `impls_trait` --> $DIR/incompleteness-unstable-result.rs:51:28 | diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs new file mode 100644 index 00000000000..840a4eb648c --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs @@ -0,0 +1,24 @@ +//@ compile-flags: -Znext-solver + +trait Foo {} +trait Bar {} +trait Constrain { + type Output; +} + +impl<T, U> Foo for T +where + T: Constrain<Output = U>, + U: Bar, +{ +} + +impl Constrain for () { + type Output = (); +} + +fn needs_foo<T: Foo>() {} +fn main() { + needs_foo::<()>(); + //~^ the trait bound `(): Foo` is not satisfied +} diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr new file mode 100644 index 00000000000..6bf4e3cb534 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr @@ -0,0 +1,23 @@ +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/point-at-failing-nested.rs:22:17 + | +LL | needs_foo::<()>(); + | ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo` + | +note: required for `()` to implement `Foo` + --> $DIR/point-at-failing-nested.rs:9:12 + | +LL | impl<T, U> Foo for T + | ^^^ ^ +... +LL | U: Bar, + | --- unsatisfied trait bound introduced here +note: required by a bound in `needs_foo` + --> $DIR/point-at-failing-nested.rs:20:17 + | +LL | fn needs_foo<T: Foo>() {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.rs b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.rs new file mode 100644 index 00000000000..4737546e404 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.rs @@ -0,0 +1,22 @@ +trait Foo {} +trait Bar {} + +impl<T> Foo for T where T: Bar {} +fn needs_foo(_: impl Foo) {} + +trait Mirror { + type Mirror; +} +impl<T> Mirror for T { + type Mirror = T; +} + +// Make sure the `Alias: Foo` bound doesn't "shadow" the impl, since the +// impl is really the only candidate we care about here for the purpose +// of error reporting. +fn hello<T>() where <T as Mirror>::Mirror: Foo { + needs_foo(()); + //~^ ERROR the trait bound `(): Foo` is not satisfied +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr new file mode 100644 index 00000000000..77a0cc49754 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr @@ -0,0 +1,22 @@ +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/where-clause-doesnt-apply.rs:18:15 + | +LL | needs_foo(()); + | --------- ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo` + | | + | required by a bound introduced by this call + | +note: required for `()` to implement `Foo` + --> $DIR/where-clause-doesnt-apply.rs:4:9 + | +LL | impl<T> Foo for T where T: Bar {} + | ^^^ ^ --- unsatisfied trait bound introduced here +note: required by a bound in `needs_foo` + --> $DIR/where-clause-doesnt-apply.rs:5:22 + | +LL | fn needs_foo(_: impl Foo) {} + | ^^^ required by this bound in `needs_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-1.rs b/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-1.rs new file mode 100644 index 00000000000..3be118a5b39 --- /dev/null +++ b/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-1.rs @@ -0,0 +1,36 @@ +//@ revisions: old next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ check-pass + +// Generalizing an alias referencing escaping bound variables +// is hard. We previously didn't replace this alias with inference +// variables but did replace nested alias which do not reference +// any bound variables. This caused us to stall with the following +// goal, which cannot make any progress: +// +// <<T as Id>::Refl as HigherRanked>::Output<'a> +// alias-relate +// <?unconstrained as HigherRanked>::Output<'a> +// +// +// cc trait-system-refactor-initiative#110 + +#![allow(unused)] +trait HigherRanked { + type Output<'a>; +} +trait Id { + type Refl: HigherRanked; +} + +fn foo<T: Id>() -> for<'a> fn(<<T as Id>::Refl as HigherRanked>::Output<'a>) { + todo!() +} + +fn bar<T: Id>() { + // we generalize here + let x = foo::<T>(); +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-2.rs b/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-2.rs new file mode 100644 index 00000000000..560eb34a977 --- /dev/null +++ b/tests/ui/traits/next-solver/generalize/hr-alias-non-hr-alias-self-ty-2.rs @@ -0,0 +1,32 @@ +//@ revisions: old next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ check-pass + +// A minimization of an ambiguity error in `icu_provider`. +// +// cc trait-system-refactor-initiative#110 + +trait Yokeable<'a> { + type Output; +} +trait Id { + type Refl; +} + +fn into_deserialized<M: Id>() -> M +where + M::Refl: for<'a> Yokeable<'a>, +{ + try_map_project::<M, _>(|_| todo!()) +} + +fn try_map_project<M: Id, F>(_f: F) -> M +where + M::Refl: for<'a> Yokeable<'a>, + F: for<'a> FnOnce(&'a ()) -> <<M as Id>::Refl as Yokeable<'a>>::Output, +{ + todo!() +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/generalize/hr-alias-universe-lowering-ambiguity.rs b/tests/ui/traits/next-solver/generalize/hr-alias-universe-lowering-ambiguity.rs new file mode 100644 index 00000000000..1e2ba81129d --- /dev/null +++ b/tests/ui/traits/next-solver/generalize/hr-alias-universe-lowering-ambiguity.rs @@ -0,0 +1,51 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// A regression test for a fairly subtle issue with how we +// generalize aliases referencing higher-ranked regions +// which previously caused unexpected ambiguity errors. +// +// The explanations in the test may end up being out of date +// in the future as we may refine our approach to generalization +// going forward. +// +// cc trait-system-refactor-initiative#108 +trait Trait<'a> { + type Assoc; +} + +impl<'a> Trait<'a> for () { + type Assoc = (); +} + +fn foo<T: for<'a> Trait<'a>>(x: T) -> for<'a> fn(<T as Trait<'a>>::Assoc) { + |_| () +} + +fn unconstrained<T>() -> T { + todo!() +} + +fn main() { + // create `?x.0` in the root universe + let mut x = unconstrained(); + + // bump the current universe of the inference context + let bump: for<'a, 'b> fn(&'a (), &'b ()) = |_, _| (); + let _: for<'a> fn(&'a (), &'a ()) = bump; + + // create `?y.1` in a higher universe + let mut y = Default::default(); + + // relate `?x.0` with `for<'a> fn(<?y.1 as Trait<'a>>::Assoc)` + // -> instantiate `?x.0` with `for<'a> fn(<?y_new.0 as Trait<'a>>::Assoc)` + x = foo(y); + + // Constrain `?y.1` to `()` + let _: () = y; + + // `AliasRelate(<?y_new.0 as Trait<'a>>::Assoc, <() as Trait<'a>>::Assoc)` + // remains ambiguous unless we somehow constrain `?y_new.0` during + // generalization to be equal to `?y.1`, which is exactly what we + // did to fix this issue. +} diff --git a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs index 536e7e97c40..00dc7a9d337 100644 --- a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs +++ b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs @@ -1,5 +1,6 @@ //@ revisions: old next //@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass // case 3 of https://github.com/rust-lang/trait-system-refactor-initiative/issues/8. diff --git a/tests/ui/traits/next-solver/select-alias-bound-as-param.rs b/tests/ui/traits/next-solver/select-alias-bound-as-param.rs new file mode 100644 index 00000000000..fd40ef1f872 --- /dev/null +++ b/tests/ui/traits/next-solver/select-alias-bound-as-param.rs @@ -0,0 +1,13 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +pub(crate) fn y() -> impl FnMut() { + || {} +} + +pub(crate) fn x(a: (), b: ()) { + let x = (); + y()() +} + +fn main() {} diff --git a/tests/ui/traits/normalize-supertrait.rs b/tests/ui/traits/normalize-supertrait.rs index 1ab2b8ecfc1..3ba4a8b8bab 100644 --- a/tests/ui/traits/normalize-supertrait.rs +++ b/tests/ui/traits/normalize-supertrait.rs @@ -4,6 +4,9 @@ // comparing the supertrait `Derived<()>` to the expected trait. //@ build-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver trait Proj { type S; diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.next.stderr b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.next.stderr deleted file mode 100644 index 3c2bc0b9190..00000000000 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.next.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: internal compiler error: error performing operation: query type op - --> $DIR/illegal-upcast-from-impl-opaque.rs:25:1 - | -LL | fn illegal(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: - --> $DIR/illegal-upcast-from-impl-opaque.rs:25:1 - | -LL | fn illegal(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -query stack during panic: -end of query stack diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.rs deleted file mode 100644 index f344474054a..00000000000 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.rs +++ /dev/null @@ -1,29 +0,0 @@ -//@ revisions: current next -//@[next] compile-flags: -Znext-solver -//@[next] failure-status: 101 -//@[next] known-bug: unknown -//@[next] normalize-stderr-test "note: .*\n\n" -> "" -//@[next] normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> "" -//@[next] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@[next] normalize-stderr-test "delayed at .*" -> "" -//@[next] rustc-env:RUST_BACKTRACE=0 - -#![feature(trait_upcasting, type_alias_impl_trait)] - -trait Super { - type Assoc; -} - -trait Sub: Super {} - -impl<T: ?Sized> Super for T { - type Assoc = i32; -} - -type Foo = impl Sized; - -fn illegal(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { - x //[current]~ mismatched types -} - -fn main() {} diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.current.stderr b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.current.stderr index c54a1c42bad..a259abb28ae 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl-opaque.current.stderr +++ b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.current.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/illegal-upcast-from-impl-opaque.rs:26:5 + --> $DIR/upcast-defining-opaque.rs:21:5 | LL | type Foo = impl Sized; | ---------- the found opaque type LL | -LL | fn illegal(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { - | ----------------------- expected `&dyn Super<Assoc = i32>` because of return type +LL | fn upcast(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { + | ----------------------- expected `&dyn Super<Assoc = i32>` because of return type LL | x | ^ expected trait `Super`, found trait `Sub` | diff --git a/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs new file mode 100644 index 00000000000..cb1501a94a2 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs @@ -0,0 +1,24 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] check-pass + +#![feature(trait_upcasting, type_alias_impl_trait)] + +trait Super { + type Assoc; +} + +trait Sub: Super {} + +impl<T: ?Sized> Super for T { + type Assoc = i32; +} + +type Foo = impl Sized; + +fn upcast(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> { + x //[current]~ mismatched types +} + +fn main() {} diff --git a/tests/ui/transmutability/primitives/bool-mut.rs b/tests/ui/transmutability/primitives/bool-mut.rs index 5f3f4f3a8c5..09b6d582d87 100644 --- a/tests/ui/transmutability/primitives/bool-mut.rs +++ b/tests/ui/transmutability/primitives/bool-mut.rs @@ -1,5 +1,4 @@ //@ check-fail -//@[next] compile-flags: -Znext-solver #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/primitives/bool-mut.stderr b/tests/ui/transmutability/primitives/bool-mut.stderr index 464c2755e11..a6cf146659e 100644 --- a/tests/ui/transmutability/primitives/bool-mut.stderr +++ b/tests/ui/transmutability/primitives/bool-mut.stderr @@ -1,11 +1,11 @@ error[E0277]: `u8` cannot be safely transmuted into `bool` - --> $DIR/bool-mut.rs:15:50 + --> $DIR/bool-mut.rs:14:50 | LL | assert::is_transmutable::<&'static mut bool, &'static mut u8>() | ^^^^^^^^^^^^^^^ at least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` - --> $DIR/bool-mut.rs:10:14 + --> $DIR/bool-mut.rs:9:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function diff --git a/tests/ui/type/pattern_types/range_patterns_usage.rs b/tests/ui/type/pattern_types/range_patterns_usage.rs index 7fe50423c51..2a9f736ae61 100644 --- a/tests/ui/type/pattern_types/range_patterns_usage.rs +++ b/tests/ui/type/pattern_types/range_patterns_usage.rs @@ -8,7 +8,7 @@ use std::pat::pattern_type; -type X = std::num::NonZeroU32; +type X = std::num::NonZero<u32>; type Y = pattern_type!(u32 is 1..); type Z = Option<pattern_type!(u32 is 1..)>; struct NonZeroU32New(pattern_type!(u32 is 1..)); diff --git a/tests/ui/typeck/issue-100285.rs b/tests/ui/typeck/issue-100285.rs index 460e0457105..bea4b2bc2bb 100644 --- a/tests/ui/typeck/issue-100285.rs +++ b/tests/ui/typeck/issue-100285.rs @@ -1,4 +1,4 @@ -fn foo(n: i32) -> i32 { //~ HELP otherwise consider changing the return type to account for that possibility +fn foo(n: i32) -> i32 { for i in 0..0 { //~ ERROR mismatched types [E0308] if n < 0 { return i; @@ -14,7 +14,7 @@ fn foo(n: i32) -> i32 { //~ HELP otherwise consider changing the return type to return 5; } - } //~ HELP return a value for the case when the loop has zero elements to iterate on + } //~ HELP consider returning a value here } fn main() {} diff --git a/tests/ui/typeck/issue-100285.stderr b/tests/ui/typeck/issue-100285.stderr index c0deb63af59..6f86fd18e0f 100644 --- a/tests/ui/typeck/issue-100285.stderr +++ b/tests/ui/typeck/issue-100285.stderr @@ -12,47 +12,12 @@ LL | | LL | | } | |_____^ expected `i32`, found `()` | -note: the function expects a value to always be returned, but loops might run zero times - --> $DIR/issue-100285.rs:2:5 - | -LL | for i in 0..0 { - | ^^^^^^^^^^^^^ this might have zero elements to iterate on -LL | if n < 0 { -LL | return i; - | -------- if the loop doesn't execute, this value would never get returned -LL | } else if n < 10 { -LL | return 1; - | -------- if the loop doesn't execute, this value would never get returned -LL | } else if n < 20 { -LL | return 2; - | -------- if the loop doesn't execute, this value would never get returned - = note: if the loop doesn't execute, 3 other values would never get returned -help: return a value for the case when the loop has zero elements to iterate on + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here | LL ~ } LL ~ /* `i32` value */ | -help: otherwise consider changing the return type to account for that possibility - | -LL ~ fn foo(n: i32) -> Option<i32> { -LL | for i in 0..0 { -LL | if n < 0 { -LL ~ return Some(i); -LL | } else if n < 10 { -LL ~ return Some(1); -LL | } else if n < 20 { -LL ~ return Some(2); -LL | } else if n < 30 { -LL ~ return Some(3); -LL | } else if n < 40 { -LL ~ return Some(4); -LL | } else { -LL ~ return Some(5); -LL | } -LL | -LL ~ } -LL ~ None - | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-98982.rs b/tests/ui/typeck/issue-98982.rs index f875d20fa4c..3eff9fbe360 100644 --- a/tests/ui/typeck/issue-98982.rs +++ b/tests/ui/typeck/issue-98982.rs @@ -1,7 +1,7 @@ -fn foo() -> i32 { //~ HELP otherwise consider changing the return type to account for that possibility +fn foo() -> i32 { for i in 0..0 { //~ ERROR mismatched types [E0308] return i; - } //~ HELP return a value for the case when the loop has zero elements to iterate on + } //~ HELP consider returning a value here } fn main() {} diff --git a/tests/ui/typeck/issue-98982.stderr b/tests/ui/typeck/issue-98982.stderr index d8d5a86b157..3d40ff4d5af 100644 --- a/tests/ui/typeck/issue-98982.stderr +++ b/tests/ui/typeck/issue-98982.stderr @@ -8,26 +8,12 @@ LL | | return i; LL | | } | |_____^ expected `i32`, found `()` | -note: the function expects a value to always be returned, but loops might run zero times - --> $DIR/issue-98982.rs:2:5 - | -LL | for i in 0..0 { - | ^^^^^^^^^^^^^ this might have zero elements to iterate on -LL | return i; - | -------- if the loop doesn't execute, this value would never get returned -help: return a value for the case when the loop has zero elements to iterate on + = note: `for` loops evaluate to unit type `()` +help: consider returning a value here | LL ~ } LL ~ /* `i32` value */ | -help: otherwise consider changing the return type to account for that possibility - | -LL ~ fn foo() -> Option<i32> { -LL | for i in 0..0 { -LL ~ return Some(i); -LL ~ } -LL ~ None - | error: aborting due to 1 previous error diff --git a/tests/ui/version/version-info-flags.rs b/tests/ui/version/version-info-flags.rs index 612113452c4..96be9c5385b 100644 --- a/tests/ui/version/version-info-flags.rs +++ b/tests/ui/version/version-info-flags.rs @@ -4,6 +4,6 @@ //@ check-pass //@[version] compile-flags: -V //@[verbose-version] compile-flags: -vV -//@[long-verbose-verison] compile-flags: --version --verbose +//@[long-verbose-version] compile-flags: --version --verbose fn main() {} diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs new file mode 100644 index 00000000000..2995f26af4a --- /dev/null +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs @@ -0,0 +1,21 @@ +// Regression test for ICE #122989 +trait Foo<const N: Bar<2>> { +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! +//~| ERROR cycle detected when computing type of `Foo::N` +//~| ERROR cycle detected when computing type of `Foo::N` +//~| ERROR the trait `Foo` cannot be made into an object +//~| ERROR the trait `Foo` cannot be made into an object +//~| ERROR the trait `Foo` cannot be made into an object +//~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter + fn func() { + } +} + +trait Bar<const M: Foo<2>> {} +//~^ WARN trait objects without an explicit `dyn` are deprecated +//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! +//~| ERROR the trait `Foo` cannot be made into an object +//~| ERROR `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter + +fn main() {} diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr new file mode 100644 index 00000000000..e6fdc440873 --- /dev/null +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr @@ -0,0 +1,179 @@ +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:20 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default +help: if this is an object-safe trait, use `dyn` + | +LL | trait Foo<const N: dyn Bar<2>> { + | +++ + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +help: if this is an object-safe trait, use `dyn` + | +LL | trait Bar<const M: dyn Foo<2>> {} + | +++ + +error[E0391]: cycle detected when computing type of `Foo::N` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^ + | +note: ...which requires computing type of `Bar::M`... + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^^^^^^^^^^ + = note: ...which again requires computing type of `Foo::N`, completing the cycle +note: cycle used when computing explicit predicates of trait `Foo` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error[E0391]: cycle detected when computing type of `Foo::N` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^ + | +note: ...which requires computing type of `Bar::M`... + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^^^^^^^^^^ + = note: ...which again requires computing type of `Foo::N`, completing the cycle +note: cycle used when computing explicit predicates of trait `Foo` + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:24 + | +LL | trait Foo<const N: Bar<2>> { + | ^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 + | +LL | trait Foo<const N: Bar<2>> { + | --- this trait cannot be made into an object... +... +LL | fn func() { + | ^^^^ ...because associated function `func` has no `self` parameter +help: consider turning `func` into a method by giving it a `&self` argument + | +LL | fn func(&self) { + | +++++ +help: alternatively, consider constraining `func` so it does not apply to trait objects + | +LL | fn func() where Self: Sized { + | +++++++++++++++++ + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 + | +LL | trait Foo<const N: Bar<2>> { + | --- this trait cannot be made into an object... +... +LL | fn func() { + | ^^^^ ...because associated function `func` has no `self` parameter +help: consider turning `func` into a method by giving it a `&self` argument + | +LL | fn func(&self) { + | +++++ +help: alternatively, consider constraining `func` so it does not apply to trait objects + | +LL | fn func() where Self: Sized { + | +++++++++++++++++ + +error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:20 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 + | +LL | trait Foo<const N: Bar<2>> { + | --- this trait cannot be made into an object... +... +LL | fn func() { + | ^^^^ ...because associated function `func` has no `self` parameter +help: consider turning `func` into a method by giving it a `&self` argument + | +LL | fn func(&self) { + | +++++ +help: alternatively, consider constraining `func` so it does not apply to trait objects + | +LL | fn func() where Self: Sized { + | +++++++++++++++++ + +error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20 + | +LL | trait Bar<const M: Foo<2>> {} + | ^^^^^^ + | + = note: the only supported types are integers, `bool` and `char` + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11 + | +LL | trait Foo<const N: Bar<2>> { + | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8 + | +LL | trait Foo<const N: Bar<2>> { + | --- this trait cannot be made into an object... +... +LL | fn func() { + | ^^^^ ...because associated function `func` has no `self` parameter + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider turning `func` into a method by giving it a `&self` argument + | +LL | fn func(&self) { + | +++++ +help: alternatively, consider constraining `func` so it does not apply to trait objects + | +LL | fn func() where Self: Sized { + | +++++++++++++++++ + +error: aborting due to 8 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0038, E0391. +For more information about an error, try `rustc --explain E0038`. |
