diff options
Diffstat (limited to 'tests')
315 files changed, 2924 insertions, 3436 deletions
diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs index f15ca30b7e3..be4af9b7962 100644 --- a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs @@ -18,6 +18,13 @@ extern { #[repr(transparent)] pub struct Type3(i32); +#[cfi_encoding = "i"] +pub struct Type4(i32); + +#[cfi_encoding = "j"] +#[repr(transparent)] +pub struct Type5(u32); + pub fn foo0(_: Type1) { } // CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo1(_: Type1, _: Type1) { } @@ -36,6 +43,18 @@ pub fn foo7(_: *mut Type3, _: *mut Type3) { } // CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) { } // CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: Type4) { } +// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: Type4, _: Type4) { } +// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: Type4, _: Type4, _: Type4) { } +// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo12(_: Type5) { } +// CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo13(_: Type5, _: Type5) { } +// CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo14(_: Type5, _: Type5, _: Type5) { } +// CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFv3FooE"} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFv3FooS_E"} @@ -46,3 +65,9 @@ pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) { } // CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvP3BazE"} // CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvP3BazS0_E"} // CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvP3BazS0_S0_E"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFviE"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFviiE"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFviiiE"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvjE"} +// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFvjjE"} +// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFvjjjE"} diff --git a/tests/codegen/sse42-implies-crc32.rs b/tests/codegen/sse42-implies-crc32.rs index c627be5c30e..94fcd77bc88 100644 --- a/tests/codegen/sse42-implies-crc32.rs +++ b/tests/codegen/sse42-implies-crc32.rs @@ -12,4 +12,4 @@ pub unsafe fn crc32sse(v: u8) -> u32 { _mm_crc32_u8(out, v) } -// CHECK: attributes #0 {{.*"target-features"="\+sse4.2,\+crc32"}} +// CHECK: attributes #0 {{.*"target-features"=".*\+sse4.2,\+crc32"}} diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir index 89572177b1d..fd8eb370ca9 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir @@ -19,7 +19,7 @@ fn test_complex() -> () { bb0: { StorageLive(_1); StorageLive(_2); - _2 = E::f() -> [return: bb1, unwind: bb37]; + _2 = E::f() -> [return: bb1, unwind: bb38]; } bb1: { @@ -34,7 +34,7 @@ fn test_complex() -> () { } bb3: { - goto -> bb22; + goto -> bb23; } bb4: { @@ -51,7 +51,7 @@ fn test_complex() -> () { bb7: { StorageLive(_4); - _4 = always_true() -> [return: bb8, unwind: bb37]; + _4 = always_true() -> [return: bb8, unwind: bb38]; } bb8: { @@ -73,7 +73,7 @@ fn test_complex() -> () { } bb11: { - drop(_7) -> [return: bb13, unwind: bb37]; + drop(_7) -> [return: bb13, unwind: bb38]; } bb12: { @@ -83,11 +83,11 @@ fn test_complex() -> () { bb13: { StorageDead(_7); StorageDead(_6); - goto -> bb19; + goto -> bb20; } bb14: { - drop(_7) -> [return: bb15, unwind: bb37]; + drop(_7) -> [return: bb15, unwind: bb38]; } bb15: { @@ -107,106 +107,110 @@ fn test_complex() -> () { } bb17: { - drop(_10) -> [return: bb19, unwind: bb37]; + drop(_10) -> [return: bb19, unwind: bb38]; } bb18: { - goto -> bb20; + goto -> bb21; } bb19: { StorageDead(_10); StorageDead(_9); - _1 = const (); - goto -> bb23; + goto -> bb20; } bb20: { - drop(_10) -> [return: bb21, unwind: bb37]; + _1 = const (); + goto -> bb24; } bb21: { - StorageDead(_10); - StorageDead(_9); - goto -> bb22; + drop(_10) -> [return: bb22, unwind: bb38]; } bb22: { - _1 = const (); + StorageDead(_10); + StorageDead(_9); goto -> bb23; } bb23: { + _1 = const (); + goto -> bb24; + } + + bb24: { StorageDead(_8); StorageDead(_5); StorageDead(_4); StorageDead(_2); StorageDead(_1); StorageLive(_11); - _11 = always_true() -> [return: bb24, unwind: bb37]; - } - - bb24: { - switchInt(move _11) -> [0: bb26, otherwise: bb25]; + _11 = always_true() -> [return: bb25, unwind: bb38]; } bb25: { - goto -> bb35; + switchInt(move _11) -> [0: bb27, otherwise: bb26]; } bb26: { - goto -> bb27; + goto -> bb36; } bb27: { - StorageLive(_12); - _12 = E::f() -> [return: bb28, unwind: bb37]; + goto -> bb28; } bb28: { - PlaceMention(_12); - _13 = discriminant(_12); - switchInt(move _13) -> [1: bb32, otherwise: bb30]; + StorageLive(_12); + _12 = E::f() -> [return: bb29, unwind: bb38]; } bb29: { - FakeRead(ForMatchedPlace(None), _12); - unreachable; + PlaceMention(_12); + _13 = discriminant(_12); + switchInt(move _13) -> [1: bb33, otherwise: bb31]; } bb30: { - goto -> bb35; + FakeRead(ForMatchedPlace(None), _12); + unreachable; } bb31: { - goto -> bb29; + goto -> bb36; } bb32: { - falseEdge -> [real: bb34, imaginary: bb30]; + goto -> bb30; } bb33: { - goto -> bb30; + falseEdge -> [real: bb35, imaginary: bb31]; } bb34: { - _0 = const (); - goto -> bb36; + goto -> bb31; } bb35: { _0 = const (); - goto -> bb36; + goto -> bb37; } bb36: { + _0 = const (); + goto -> bb37; + } + + bb37: { StorageDead(_11); StorageDead(_12); return; } - bb37 (cleanup): { + bb38 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir index b84c17c2188..3e7c116016c 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir @@ -20,7 +20,7 @@ fn test_or() -> () { } bb1: { - drop(_3) -> [return: bb3, unwind: bb12]; + drop(_3) -> [return: bb3, unwind: bb13]; } bb2: { @@ -30,11 +30,11 @@ fn test_or() -> () { bb3: { StorageDead(_3); StorageDead(_2); - goto -> bb8; + goto -> bb9; } bb4: { - drop(_3) -> [return: bb5, unwind: bb12]; + drop(_3) -> [return: bb5, unwind: bb13]; } bb5: { @@ -50,38 +50,42 @@ fn test_or() -> () { } bb6: { - drop(_6) -> [return: bb8, unwind: bb12]; + drop(_6) -> [return: bb8, unwind: bb13]; } bb7: { - goto -> bb9; + goto -> bb10; } bb8: { StorageDead(_6); StorageDead(_5); - _0 = const (); - goto -> bb11; + goto -> bb9; } bb9: { - drop(_6) -> [return: bb10, unwind: bb12]; + _0 = const (); + goto -> bb12; } bb10: { + drop(_6) -> [return: bb11, unwind: bb13]; + } + + bb11: { StorageDead(_6); StorageDead(_5); _0 = const (); - goto -> bb11; + goto -> bb12; } - bb11: { + bb12: { StorageDead(_4); StorageDead(_1); return; } - bb12 (cleanup): { + bb13 (cleanup): { resume; } } diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index 4c71a4358e7..5c586fbc2fc 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -69,7 +69,7 @@ bb2: { - _1 = move ((_2 as Some).0: std::alloc::Layout); -+ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; ++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; StorageDead(_10); StorageDead(_2); StorageLive(_3); @@ -83,8 +83,8 @@ StorageLive(_8); - _8 = _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb3, unwind unreachable]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb3, unwind unreachable]; ++ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; ++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff index 44de4f8e98a..bfb2319dac1 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff @@ -73,7 +73,7 @@ bb3: { - _1 = move ((_2 as Some).0: std::alloc::Layout); -+ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; ++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; StorageDead(_10); StorageDead(_2); StorageLive(_3); @@ -87,8 +87,8 @@ StorageLive(_8); - _8 = _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind continue]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind continue]; ++ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; ++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index e27a96a4018..ce55a8265e5 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -69,7 +69,7 @@ bb2: { - _1 = move ((_2 as Some).0: std::alloc::Layout); -+ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; ++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; StorageDead(_10); StorageDead(_2); StorageLive(_3); @@ -83,8 +83,8 @@ StorageLive(_8); - _8 = _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb3, unwind unreachable]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb3, unwind unreachable]; ++ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; ++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff index 6145f92a075..ddf4223bb49 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff @@ -73,7 +73,7 @@ bb3: { - _1 = move ((_2 as Some).0: std::alloc::Layout); -+ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; ++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; StorageDead(_10); StorageDead(_2); StorageLive(_3); @@ -87,8 +87,8 @@ StorageLive(_8); - _8 = _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind continue]; -+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}; -+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind continue]; ++ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; ++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/Makefile b/tests/run-make/CURRENT_RUSTC_VERSION/Makefile deleted file mode 100644 index 7940dae207b..00000000000 --- a/tests/run-make/CURRENT_RUSTC_VERSION/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --emit=metadata --crate-type lib stable.rs - $(RUSTC) --emit=metadata --extern stable=$(TMPDIR)/libstable.rmeta main.rs 2>&1 >/dev/null \ - | $(CGREP) -e "stable since $$(cat $(S)/src/version)(-[a-zA-Z]+)?" diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs new file mode 100644 index 00000000000..586f4e4095f --- /dev/null +++ b/tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs @@ -0,0 +1,27 @@ +// ignore-tidy-linelength + +extern crate run_make_support; + +use std::path::PathBuf; + +use run_make_support::{aux_build, rustc}; + +fn main() { + aux_build() + .arg("--emit=metadata") + .arg("stable.rs") + .run(); + let mut stable_path = PathBuf::from(env!("TMPDIR")); + stable_path.push("libstable.rmeta"); + let output = rustc() + .arg("--emit=metadata") + .arg("--extern") + .arg(&format!("stable={}", &stable_path.to_string_lossy())) + .arg("main.rs") + .run(); + + let stderr = String::from_utf8_lossy(&output.stderr); + let version = include_str!(concat!(env!("S"), "/src/version")); + let expected_string = format!("stable since {}", version.trim()); + assert!(stderr.contains(&expected_string)); +} diff --git a/tests/run-make/a-b-a-linker-guard/Makefile b/tests/run-make/a-b-a-linker-guard/Makefile deleted file mode 100644 index 43282eae09c..00000000000 --- a/tests/run-make/a-b-a-linker-guard/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Test that if we build `b` against a version of `a` that has one set -# of types, it will not run with a dylib that has a different set of -# types. - -# NOTE(eddyb) this test only works with the `legacy` mangling, -# and will probably get removed once `legacy` is gone. - -all: - $(RUSTC) a.rs --cfg x -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(RUSTC) b.rs -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call RUN,b) - $(RUSTC) a.rs --cfg y -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call FAIL,b) diff --git a/tests/run-make/a-b-a-linker-guard/rmake.rs b/tests/run-make/a-b-a-linker-guard/rmake.rs new file mode 100644 index 00000000000..ef4813e1214 --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/rmake.rs @@ -0,0 +1,45 @@ +// ignore-tidy-linelength + +extern crate run_make_support; + +use run_make_support::{run, run_fail, rustc}; + +fn main() { + rustc() + .arg("a.rs") + .arg("--cfg") + .arg("x") + .arg("-C") + .arg("prefer-dynamic") + .arg("-Z") + .arg("unstable-options") + .arg("-C") + .arg("symbol-mangling-version=legacy") + .run(); + + rustc() + .arg("b.rs") + .arg("-C") + .arg("prefer-dynamic") + .arg("-Z") + .arg("unstable-options") + .arg("-C") + .arg("symbol-mangling-version=legacy") + .run(); + + run("b"); + + rustc() + .arg("a.rs") + .arg("--cfg") + .arg("y") + .arg("-C") + .arg("prefer-dynamic") + .arg("-Z") + .arg("unstable-options") + .arg("-C") + .arg("symbol-mangling-version=legacy") + .run(); + + run_fail("b"); +} diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile index 9e05c8dc179..54eca5c58d7 100644 --- a/tests/run-make/split-debuginfo/Makefile +++ b/tests/run-make/split-debuginfo/Makefile @@ -234,28 +234,28 @@ unpacked-single: ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/$(call BIN,foo) -unpacked-lto: packed-lto-split packed-lto-single +unpacked-lto: unpacked-lto-split unpacked-lto-single # - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created +# - `.o` present (bitcode) # - `.dwo` never created # - `.dwp` never created unpacked-lto-split: $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.o ls $(TMPDIR)/*.dwo && exit 1 || exit 0 ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/libbaz.rlib # - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created +# - `.o` present (bitcode) # - `.dwo` never created # - `.dwp` never created unpacked-lto-single: $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.o ls $(TMPDIR)/*.dwo && exit 1 || exit 0 ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/libbaz.rlib diff --git a/tests/rustdoc-js-std/osstring-to-string.js b/tests/rustdoc-js-std/osstring-to-string.js index 17bb602a502..3fdc0b9f24a 100644 --- a/tests/rustdoc-js-std/osstring-to-string.js +++ b/tests/rustdoc-js-std/osstring-to-string.js @@ -4,6 +4,6 @@ const EXPECTED = { 'query': 'OsString -> String', 'others': [ - { 'path': 'std::ffi::OsString', 'name': 'into_string' }, + { 'path': 'std::ffi::os_str::OsString', 'name': 'into_string' }, ] }; diff --git a/tests/rustdoc-ui/doc-include-suggestion.rs b/tests/rustdoc-ui/doc-include-suggestion.rs index 5c8d1efa76f..aff0a24ace8 100644 --- a/tests/rustdoc-ui/doc-include-suggestion.rs +++ b/tests/rustdoc-ui/doc-include-suggestion.rs @@ -1,10 +1,6 @@ -//@ check-pass - #[doc(include = "external-cross-doc.md")] -//~^ WARNING unknown `doc` attribute `include` +//~^ ERROR unknown `doc` attribute `include` //~| HELP use `doc = include_str!` instead // FIXME(#85497): make this a deny instead so it's more clear what's happening //~| NOTE on by default -//~| WARNING previously accepted -//~| NOTE see issue #82730 pub struct NeedMoreDocs; diff --git a/tests/rustdoc-ui/doc-include-suggestion.stderr b/tests/rustdoc-ui/doc-include-suggestion.stderr index fcc93d0532a..1b4b78a8f26 100644 --- a/tests/rustdoc-ui/doc-include-suggestion.stderr +++ b/tests/rustdoc-ui/doc-include-suggestion.stderr @@ -1,12 +1,10 @@ -warning: unknown `doc` attribute `include` - --> $DIR/doc-include-suggestion.rs:3:7 +error: unknown `doc` attribute `include` + --> $DIR/doc-include-suggestion.rs:1:7 | LL | #[doc(include = "external-cross-doc.md")] | ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- help: use `doc = include_str!` instead: `#[doc = include_str!("external-cross-doc.md")]` | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - = note: `#[warn(invalid_doc_attributes)]` on by default + = note: `#[deny(invalid_doc_attributes)]` on by default -warning: 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/doctest/doc-test-attr.rs b/tests/rustdoc-ui/doctest/doc-test-attr.rs index 46178ad865a..8570252c449 100644 --- a/tests/rustdoc-ui/doctest/doc-test-attr.rs +++ b/tests/rustdoc-ui/doctest/doc-test-attr.rs @@ -1,14 +1,10 @@ #![crate_type = "lib"] -#![deny(invalid_doc_attributes)] #![doc(test)] //~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler #![doc(test = "hello")] //~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler #![doc(test(a))] //~^ ERROR unknown `doc(test)` attribute `a` -//~^^ WARN this was previously accepted by the compiler pub fn foo() {} diff --git a/tests/rustdoc-ui/doctest/doc-test-attr.stderr b/tests/rustdoc-ui/doctest/doc-test-attr.stderr index 5e6014954a4..415251cc5e9 100644 --- a/tests/rustdoc-ui/doctest/doc-test-attr.stderr +++ b/tests/rustdoc-ui/doctest/doc-test-attr.stderr @@ -1,34 +1,22 @@ error: `#[doc(test(...)]` takes a list of attributes - --> $DIR/doc-test-attr.rs:4:8 + --> $DIR/doc-test-attr.rs:3:8 | LL | #![doc(test)] | ^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> -note: the lint level is defined here - --> $DIR/doc-test-attr.rs:2:9 - | -LL | #![deny(invalid_doc_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[deny(invalid_doc_attributes)]` on by default error: `#[doc(test(...)]` takes a list of attributes - --> $DIR/doc-test-attr.rs:7:8 + --> $DIR/doc-test-attr.rs:5:8 | LL | #![doc(test = "hello")] | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc(test)` attribute `a` - --> $DIR/doc-test-attr.rs:10:13 + --> $DIR/doc-test-attr.rs:7:13 | LL | #![doc(test(a))] | ^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: aborting due to 3 previous errors diff --git a/tests/rustdoc-ui/lints/doc-attr.rs b/tests/rustdoc-ui/lints/doc-attr.rs index 980d1c0e207..666aeb55cbe 100644 --- a/tests/rustdoc-ui/lints/doc-attr.rs +++ b/tests/rustdoc-ui/lints/doc-attr.rs @@ -1,25 +1,17 @@ #![crate_type = "lib"] -#![deny(warnings)] #![doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~^^ WARN #[doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~^^ WARN pub fn foo() {} #[doc(123)] //~^ ERROR invalid `doc` attribute -//~| WARN #[doc("hello", "bar")] //~^ ERROR invalid `doc` attribute -//~| WARN //~| ERROR invalid `doc` attribute -//~| WARN #[doc(foo::bar, crate::bar::baz = "bye")] //~^ ERROR unknown `doc` attribute -//~| WARN //~| ERROR unknown `doc` attribute -//~| WARN fn bar() {} diff --git a/tests/rustdoc-ui/lints/doc-attr.stderr b/tests/rustdoc-ui/lints/doc-attr.stderr index 68df2771fd7..091ffc20d46 100644 --- a/tests/rustdoc-ui/lints/doc-attr.stderr +++ b/tests/rustdoc-ui/lints/doc-attr.stderr @@ -1,71 +1,46 @@ error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:7:7 + --> $DIR/doc-attr.rs:5:7 | LL | #[doc(as_ptr)] | ^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> -note: the lint level is defined here - --> $DIR/doc-attr.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default error: invalid `doc` attribute - --> $DIR/doc-attr.rs:12:7 + --> $DIR/doc-attr.rs:9:7 | LL | #[doc(123)] | ^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:7 + --> $DIR/doc-attr.rs:11:7 | LL | #[doc("hello", "bar")] | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:16 + --> $DIR/doc-attr.rs:11:16 | LL | #[doc("hello", "bar")] | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `foo::bar` - --> $DIR/doc-attr.rs:20:7 + --> $DIR/doc-attr.rs:14:7 | LL | #[doc(foo::bar, crate::bar::baz = "bye")] | ^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `crate::bar::baz` - --> $DIR/doc-attr.rs:20:17 + --> $DIR/doc-attr.rs:14:17 | LL | #[doc(foo::bar, crate::bar::baz = "bye")] | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:3:8 + --> $DIR/doc-attr.rs:2:8 | LL | #![doc(as_ptr)] | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: aborting due to 7 previous errors diff --git a/tests/rustdoc-ui/lints/doc-spotlight.fixed b/tests/rustdoc-ui/lints/doc-spotlight.fixed index 6de95a33589..0f8f11a9430 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.fixed +++ b/tests/rustdoc-ui/lints/doc-spotlight.fixed @@ -1,8 +1,6 @@ //@ run-rustfix -#![deny(warnings)] #![feature(doc_notable_trait)] #[doc(notable_trait)] //~^ ERROR unknown `doc` attribute `spotlight` -//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! trait MyTrait {} diff --git a/tests/rustdoc-ui/lints/doc-spotlight.rs b/tests/rustdoc-ui/lints/doc-spotlight.rs index 9823ea90522..c1f90dd442b 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.rs +++ b/tests/rustdoc-ui/lints/doc-spotlight.rs @@ -1,8 +1,6 @@ //@ run-rustfix -#![deny(warnings)] #![feature(doc_notable_trait)] #[doc(spotlight)] //~^ ERROR unknown `doc` attribute `spotlight` -//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! trait MyTrait {} diff --git a/tests/rustdoc-ui/lints/doc-spotlight.stderr b/tests/rustdoc-ui/lints/doc-spotlight.stderr index 5d93b4132fc..9682a3c0c8b 100644 --- a/tests/rustdoc-ui/lints/doc-spotlight.stderr +++ b/tests/rustdoc-ui/lints/doc-spotlight.stderr @@ -1,19 +1,12 @@ error: unknown `doc` attribute `spotlight` - --> $DIR/doc-spotlight.rs:5:7 + --> $DIR/doc-spotlight.rs:4:7 | LL | #[doc(spotlight)] | ^^^^^^^^^ help: use `notable_trait` instead | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: `doc(spotlight)` was renamed to `doc(notable_trait)` = note: `doc(spotlight)` is now a no-op -note: the lint level is defined here - --> $DIR/doc-spotlight.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/lints/doc_cfg_hide.rs b/tests/rustdoc-ui/lints/doc_cfg_hide.rs index 5d8791748a0..9a8bce2a92a 100644 --- a/tests/rustdoc-ui/lints/doc_cfg_hide.rs +++ b/tests/rustdoc-ui/lints/doc_cfg_hide.rs @@ -1,11 +1,7 @@ #![feature(doc_cfg_hide)] -#![deny(warnings)] #![doc(cfg_hide = "test")] //~ ERROR -//~^ WARN #![doc(cfg_hide)] //~ ERROR -//~^ WARN #[doc(cfg_hide(doc))] //~ ERROR -//~^ WARN pub fn foo() {} diff --git a/tests/rustdoc-ui/lints/doc_cfg_hide.stderr b/tests/rustdoc-ui/lints/doc_cfg_hide.stderr index b7e8870fdf5..0c9d0879b0a 100644 --- a/tests/rustdoc-ui/lints/doc_cfg_hide.stderr +++ b/tests/rustdoc-ui/lints/doc_cfg_hide.stderr @@ -1,40 +1,27 @@ error: this attribute can only be applied at the crate level - --> $DIR/doc_cfg_hide.rs:9:7 + --> $DIR/doc_cfg_hide.rs:6:7 | LL | #[doc(cfg_hide(doc))] | ^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information -note: the lint level is defined here - --> $DIR/doc_cfg_hide.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default help: to apply to the crate, use an inner attribute | LL | #![doc(cfg_hide(doc))] | + -error: `#[doc(cfg_hide(...)]` takes a list of attributes - --> $DIR/doc_cfg_hide.rs:4:8 +error: `#[doc(cfg_hide(...))]` takes a list of attributes + --> $DIR/doc_cfg_hide.rs:3:8 | LL | #![doc(cfg_hide = "test")] | ^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> -error: `#[doc(cfg_hide(...)]` takes a list of attributes - --> $DIR/doc_cfg_hide.rs:6:8 +error: `#[doc(cfg_hide(...))]` takes a list of attributes + --> $DIR/doc_cfg_hide.rs:4:8 | LL | #![doc(cfg_hide)] | ^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: aborting due to 3 previous errors diff --git a/tests/rustdoc-ui/lints/invalid-doc-attr.rs b/tests/rustdoc-ui/lints/invalid-doc-attr.rs index 16b12cca5a0..e1cc08ca242 100644 --- a/tests/rustdoc-ui/lints/invalid-doc-attr.rs +++ b/tests/rustdoc-ui/lints/invalid-doc-attr.rs @@ -1,32 +1,25 @@ #![crate_type = "lib"] -#![deny(warnings)] #![feature(doc_masked)] #![doc(masked)] //~^ ERROR this attribute can only be applied to an `extern crate` item -//~| WARN is being phased out #[doc(test(no_crate_inject))] //~^ ERROR can only be applied at the crate level -//~| WARN is being phased out //~| HELP to apply to the crate, use an inner attribute //~| SUGGESTION ! #[doc(inline)] //~^ ERROR can only be applied to a `use` item -//~| WARN is being phased out pub fn foo() {} pub mod bar { #![doc(test(no_crate_inject))] //~^ ERROR can only be applied at the crate level - //~| WARN is being phased out #[doc(test(no_crate_inject))] //~^ ERROR can only be applied at the crate level - //~| WARN is being phased out #[doc(inline)] //~^ ERROR can only be applied to a `use` item - //~| WARN is being phased out pub fn baz() {} } @@ -38,10 +31,8 @@ pub use bar::baz; #[doc(masked)] //~^ ERROR this attribute can only be applied to an `extern crate` item -//~| WARN is being phased out pub struct Masked; #[doc(masked)] //~^ ERROR this attribute cannot be applied to an `extern crate self` item -//~| WARN is being phased out pub extern crate self as reexport; diff --git a/tests/rustdoc-ui/lints/invalid-doc-attr.stderr b/tests/rustdoc-ui/lints/invalid-doc-attr.stderr index 82ea33e1d89..7621999a8ca 100644 --- a/tests/rustdoc-ui/lints/invalid-doc-attr.stderr +++ b/tests/rustdoc-ui/lints/invalid-doc-attr.stderr @@ -1,48 +1,37 @@ error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:9:7 + --> $DIR/invalid-doc-attr.rs:7:7 | LL | #[doc(test(no_crate_inject))] | ^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information -note: the lint level is defined here - --> $DIR/invalid-doc-attr.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default help: to apply to the crate, use an inner attribute | LL | #![doc(test(no_crate_inject))] | + error: this attribute can only be applied to a `use` item - --> $DIR/invalid-doc-attr.rs:14:7 + --> $DIR/invalid-doc-attr.rs:11:7 | LL | #[doc(inline)] | ^^^^^^ only applicable on `use` items -... +LL | LL | pub fn foo() {} | ------------ not a `use` item | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:20:12 + --> $DIR/invalid-doc-attr.rs:16:12 | LL | #![doc(test(no_crate_inject))] | ^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information error: conflicting doc inlining attributes - --> $DIR/invalid-doc-attr.rs:33:7 + --> $DIR/invalid-doc-attr.rs:26:7 | LL | #[doc(inline)] | ^^^^^^ this attribute... @@ -52,61 +41,50 @@ LL | #[doc(no_inline)] = help: remove one of the conflicting attributes error: this attribute can only be applied to an `extern crate` item - --> $DIR/invalid-doc-attr.rs:39:7 + --> $DIR/invalid-doc-attr.rs:32:7 | LL | #[doc(masked)] | ^^^^^^ only applicable on `extern crate` items -... +LL | LL | pub struct Masked; | ----------------- not an `extern crate` item | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information error: this attribute cannot be applied to an `extern crate self` item - --> $DIR/invalid-doc-attr.rs:44:7 + --> $DIR/invalid-doc-attr.rs:36:7 | LL | #[doc(masked)] | ^^^^^^ not applicable on `extern crate self` items -... +LL | LL | pub extern crate self as reexport; | --------------------------------- `extern crate self` defined here - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: this attribute can only be applied to an `extern crate` item - --> $DIR/invalid-doc-attr.rs:5:8 + --> $DIR/invalid-doc-attr.rs:4:8 | LL | #![doc(masked)] | ^^^^^^ only applicable on `extern crate` items | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information error: this attribute can only be applied at the crate level - --> $DIR/invalid-doc-attr.rs:24:11 + --> $DIR/invalid-doc-attr.rs:19:11 | LL | #[doc(test(no_crate_inject))] | ^^^^^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information error: this attribute can only be applied to a `use` item - --> $DIR/invalid-doc-attr.rs:27:11 + --> $DIR/invalid-doc-attr.rs:21:11 | LL | #[doc(inline)] | ^^^^^^ only applicable on `use` items -... +LL | LL | pub fn baz() {} | ------------ not a `use` item | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information error: aborting due to 9 previous errors diff --git a/tests/rustdoc/auxiliary/jump-to-def-macro.rs b/tests/rustdoc/auxiliary/jump-to-def-macro.rs new file mode 100644 index 00000000000..f442b9461e8 --- /dev/null +++ b/tests/rustdoc/auxiliary/jump-to-def-macro.rs @@ -0,0 +1,6 @@ +#[macro_export] +macro_rules! symbols { + ($name:ident = $value:expr) => { + pub const $name: isize = $value; + } +} diff --git a/tests/rustdoc/jump-to-def-macro.rs b/tests/rustdoc/jump-to-def-macro.rs new file mode 100644 index 00000000000..e8e97a442dd --- /dev/null +++ b/tests/rustdoc/jump-to-def-macro.rs @@ -0,0 +1,15 @@ +//@ aux-build:jump-to-def-macro.rs +//@ build-aux-docs +//@ compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +// @has 'src/foo/jump-to-def-macro.rs.html' + +#[macro_use] +extern crate jump_to_def_macro; + +// @has - '//a[@href="../../jump_to_def_macro/macro.symbols.html"]' 'symbols!' +symbols! { + A = 12 +} diff --git a/tests/rustdoc/source-code-highlight.rs b/tests/rustdoc/source-code-highlight.rs new file mode 100644 index 00000000000..0a1be791ec2 --- /dev/null +++ b/tests/rustdoc/source-code-highlight.rs @@ -0,0 +1,29 @@ +// We need this option to be enabled for the `foo` macro declaration to ensure +// that the link on the ident is not including whitespace characters. + +//@ compile-flags: -Zunstable-options --generate-link-to-definition +#![crate_name = "foo"] + +// @has 'src/foo/source-code-highlight.rs.html' + +// @hasraw - '<a href="../../foo/macro.foo.html">foo</a>' +#[macro_export] +macro_rules! foo { + () => {} +} + +// @hasraw - '<span class="macro">foo!</span>' +foo! {} + +// @hasraw - '<a href="../../foo/fn.f.html">f</a>' +#[rustfmt::skip] +pub fn f () {} +// @hasraw - '<a href="../../foo/struct.Bar.html">Bar</a>' +// @hasraw - '<a href="../../foo/struct.Bar.html">Bar</a>' +// @hasraw - '<a href="{{channel}}/std/primitive.u32.html">u32</a>' +#[rustfmt::skip] +pub struct Bar ( u32 ); +// @hasraw - '<a href="../../foo/enum.Foo.html">Foo</a>' +pub enum Foo { + A, +} diff --git a/tests/rustdoc/type-alias/primitive-local-link-121106.rs b/tests/rustdoc/type-alias/primitive-local-link-121106.rs new file mode 100644 index 00000000000..c11d35d8646 --- /dev/null +++ b/tests/rustdoc/type-alias/primitive-local-link-121106.rs @@ -0,0 +1,19 @@ +#![crate_name = "foo"] + +#![feature(rustc_attrs)] + +// @has foo/primitive.i32.html '//h1' 'Primitive Type i32' +// @has foo/index.html '//a/@href' '../foo/index.html' +#[rustc_doc_primitive = "i32"] +mod i32 {} + +// @has foo/struct.Node.html '//a/@href' 'primitive.i32.html' +pub struct Node; + +impl Node { + pub fn edge(&self) -> i32 { 0 } +} + +// @!has foo/type.Alias.html '//a/@href' 'primitive.i32.html' +// @hasraw 'type.impl/foo/struct.Node.js' 'href=\"foo/primitive.i32.html\"' +pub type Alias = Node; diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 42270d2bbde..8dcc34d4f60 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -13,8 +13,8 @@ extern crate rustc_session; extern crate rustc_span; use rustc_errors::{ - AddToDiagnostic, Diagnostic, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, DiagCtxt, - IntoDiagnostic, Level, SubdiagnosticMessageOp, + AddToDiagnostic, Diag, EmissionGuarantee, DiagCtxt, IntoDiagnostic, Level, + SubdiagnosticMessageOp, }; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::Span; @@ -38,8 +38,8 @@ struct Note { pub struct UntranslatableInIntoDiagnostic; impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UntranslatableInIntoDiagnostic { - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> { - DiagnosticBuilder::new(dcx, level, "untranslatable diagnostic") + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> { + Diag::new(dcx, level, "untranslatable diagnostic") //~^ ERROR diagnostics should be created using translatable messages } } @@ -47,8 +47,8 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UntranslatableInIntoDia pub struct TranslatableInIntoDiagnostic; impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for TranslatableInIntoDiagnostic { - fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> { - DiagnosticBuilder::new(dcx, level, crate::fluent_generated::no_crate_example) + fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> { + Diag::new(dcx, level, crate::fluent_generated::no_crate_example) } } @@ -57,7 +57,7 @@ pub struct UntranslatableInAddToDiagnostic; impl AddToDiagnostic for UntranslatableInAddToDiagnostic { fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>( self, - diag: &mut DiagnosticBuilder<'_, G>, + diag: &mut Diag<'_, G>, f: F, ) { diag.note("untranslatable diagnostic"); @@ -70,7 +70,7 @@ pub struct TranslatableInAddToDiagnostic; impl AddToDiagnostic for TranslatableInAddToDiagnostic { fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>( self, - diag: &mut DiagnosticBuilder<'_, G>, + diag: &mut Diag<'_, G>, f: F, ) { diag.note(crate::fluent_generated::no_crate_note); diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr index a69a71bf50e..1b1ad7d5892 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr +++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr @@ -1,8 +1,8 @@ error: diagnostics should be created using translatable messages --> $DIR/diagnostics.rs:42:9 | -LL | DiagnosticBuilder::new(dcx, level, "untranslatable diagnostic") - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | Diag::new(dcx, level, "untranslatable diagnostic") + | ^^^^^^^^^ | note: the lint level is defined here --> $DIR/diagnostics.rs:6:9 diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr index 7844e60c654..98600d28229 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -8,7 +8,7 @@ LL | arg: NotIntoDiagnosticArg, | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` | = help: normalized in stderr -note: required by a bound in `DiagnosticBuilder::<'a, G>::arg` +note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -22,7 +22,7 @@ LL | arg: NotIntoDiagnosticArg, | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` | = help: normalized in stderr -note: required by a bound in `DiagnosticBuilder::<'a, G>::arg` +note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 8732629db47..058c88d315b 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -628,7 +628,7 @@ LL | other: Hello, | ^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` | = help: normalized in stderr -note: required by a bound in `DiagnosticBuilder::<'a, G>::arg` +note: required by a bound in `Diag::<'a, G>::arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC = note: this error originates in the macro `with_fn` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/associated-inherent-types/issue-111404-1.rs b/tests/ui/associated-inherent-types/issue-111404-1.rs index dd62e59f07d..3255bf20ebd 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.rs +++ b/tests/ui/associated-inherent-types/issue-111404-1.rs @@ -8,7 +8,9 @@ impl<'a> Foo<fn(&'a ())> { } fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} -//~^ ERROR higher-ranked subtype error +//~^ ERROR mismatched types [E0308] +//~| ERROR mismatched types [E0308] +//~| ERROR higher-ranked subtype error //~| ERROR higher-ranked subtype error fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-111404-1.stderr b/tests/ui/associated-inherent-types/issue-111404-1.stderr index cf4d4a5f19b..5074c877a8e 100644 --- a/tests/ui/associated-inherent-types/issue-111404-1.stderr +++ b/tests/ui/associated-inherent-types/issue-111404-1.stderr @@ -1,3 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/issue-111404-1.rs:10:11 + | +LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Foo<fn(&())>` + found struct `Foo<for<'b> fn(&'b ())>` + +error[E0308]: mismatched types + --> $DIR/issue-111404-1.rs:10:11 + | +LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Foo<fn(&())>` + found struct `Foo<for<'b> fn(&'b ())>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error: higher-ranked subtype error --> $DIR/issue-111404-1.rs:10:1 | @@ -12,5 +31,6 @@ LL | fn bar(_: fn(Foo<for<'b> fn(Foo<fn(&'b ())>::Assoc)>::Assoc)) {} | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr deleted file mode 100644 index 65f7a72fbff..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error: return type notation uses `()` instead of `(..)` for elided arguments - --> $DIR/bad-inputs-and-output.rs:20:24 - | -LL | fn baz<T: Trait<method(..): Send>>() {} - | ^^ help: remove the `..` - -error[E0658]: associated type bounds are unstable - --> $DIR/bad-inputs-and-output.rs:12:17 - | -LL | fn foo<T: Trait<method(i32): Send>>() {} - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information - = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable - -error[E0658]: associated type bounds are unstable - --> $DIR/bad-inputs-and-output.rs:16:17 - | -LL | fn bar<T: Trait<method() -> (): Send>>() {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information - = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable - -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-inputs-and-output.rs:5:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:12:23 - | -LL | fn foo<T: Trait<method(i32): Send>>() {} - | ^^^^^ help: remove the input types: `()` - -error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:16:25 - | -LL | fn bar<T: Trait<method() -> (): Send>>() {} - | ^^^^^^ help: remove the return type - -error: aborting due to 5 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr deleted file mode 100644 index 65f7a72fbff..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error: return type notation uses `()` instead of `(..)` for elided arguments - --> $DIR/bad-inputs-and-output.rs:20:24 - | -LL | fn baz<T: Trait<method(..): Send>>() {} - | ^^ help: remove the `..` - -error[E0658]: associated type bounds are unstable - --> $DIR/bad-inputs-and-output.rs:12:17 - | -LL | fn foo<T: Trait<method(i32): Send>>() {} - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information - = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable - -error[E0658]: associated type bounds are unstable - --> $DIR/bad-inputs-and-output.rs:16:17 - | -LL | fn bar<T: Trait<method() -> (): Send>>() {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information - = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable - -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-inputs-and-output.rs:5:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:12:23 - | -LL | fn foo<T: Trait<method(i32): Send>>() {} - | ^^^^^ help: remove the input types: `()` - -error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:16:25 - | -LL | fn bar<T: Trait<method() -> (): Send>>() {} - | ^^^^^^ help: remove the return type - -error: aborting due to 5 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr deleted file mode 100644 index c4dc5d36296..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:8:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr deleted file mode 100644 index 3666007e3d3..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:8:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: future cannot be sent between threads safely - --> $DIR/basic.rs:26:13 - | -LL | is_send(foo::<T>()); - | ^^^^^^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/basic.rs:16:5 - | -LL | T::method().await?; - | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send` -note: required by a bound in `is_send` - --> $DIR/basic.rs:20:20 - | -LL | fn is_send(_: impl Send) {} - | ^^^^ required by this bound in `is_send` - -error: aborting due to 1 previous error; 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr deleted file mode 100644 index c4dc5d36296..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:8:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr deleted file mode 100644 index 3666007e3d3..00000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr +++ /dev/null @@ -1,29 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:8:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: future cannot be sent between threads safely - --> $DIR/basic.rs:26:13 - | -LL | is_send(foo::<T>()); - | ^^^^^^^^^^ future returned by `foo` is not `Send` - | - = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>>` -note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/basic.rs:16:5 - | -LL | T::method().await?; - | ^^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<(), ()>>`, which is not `Send` -note: required by a bound in `is_send` - --> $DIR/basic.rs:20:20 - | -LL | fn is_send(_: impl Send) {} - | ^^^^ required by this bound in `is_send` - -error: aborting due to 1 previous error; 1 warning emitted - diff --git a/tests/ui/associated-types/impl-wf-cycle-6.fixed b/tests/ui/associated-types/impl-wf-cycle-6.fixed index 45143be1e74..ce98b9c2f02 100644 --- a/tests/ui/associated-types/impl-wf-cycle-6.fixed +++ b/tests/ui/associated-types/impl-wf-cycle-6.fixed @@ -21,7 +21,6 @@ impl Grault for () { impl<T: Grault> Grault for (T,) //~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` - { type A = (); type B = bool; diff --git a/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs b/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs index 9c3b458cd3a..be436465315 100644 --- a/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs +++ b/tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs @@ -8,11 +8,15 @@ extern crate block_on; fn main() { block_on::block_on(async { - let x = async || {}; - async fn needs_async_fn_once(x: impl async FnOnce()) { x().await; } - needs_async_fn_once(x).await; + + needs_async_fn_once(async || {}).await; + + needs_async_fn_once(|| async {}).await; + + async fn foo() {} + needs_async_fn_once(foo).await; }); } diff --git a/tests/ui/async-await/async-closures/is-fn.rs b/tests/ui/async-await/async-closures/is-fn.rs new file mode 100644 index 00000000000..64cc28e425f --- /dev/null +++ b/tests/ui/async-await/async-closures/is-fn.rs @@ -0,0 +1,24 @@ +//@ aux-build:block-on.rs +//@ edition:2021 +//@ build-pass +//@ revisions: current next +//@[next] compile-flags: -Znext-solver + +#![feature(async_closure)] + +use std::future::Future; + +extern crate block_on; + +// Check that closures that don't capture any state may implement `Fn`. + +fn main() { + block_on::block_on(async { + async fn call_once<F: Future>(x: impl FnOnce(&'static str) -> F) -> F::Output { + x("hello, world").await + } + call_once(async |x: &'static str| { + println!("hello, {x}"); + }).await + }); +} diff --git a/tests/ui/async-await/async-closures/move-is-async-fn.rs b/tests/ui/async-await/async-closures/move-is-async-fn.rs index 0ccd137266d..79e2298f609 100644 --- a/tests/ui/async-await/async-closures/move-is-async-fn.rs +++ b/tests/ui/async-await/async-closures/move-is-async-fn.rs @@ -2,7 +2,7 @@ //@ edition:2021 //@ build-pass -#![feature(async_closure)] +#![feature(async_closure, async_fn_traits)] extern crate block_on; @@ -15,7 +15,11 @@ fn main() { c().await; c().await; - fn is_static<T: 'static>(_: T) {} - is_static(c); + fn is_static<T: 'static>(_: &T) {} + is_static(&c); + + // Check that `<{async fn} as AsyncFnOnce>::CallOnceFuture` owns its captures. + fn call_once<F: async FnOnce()>(f: F) -> F::CallOnceFuture { f() } + is_static(&call_once(c)); }); } diff --git a/tests/ui/async-await/async-closures/once.rs b/tests/ui/async-await/async-closures/once.rs index 55e4cedb267..761df3de444 100644 --- a/tests/ui/async-await/async-closures/once.rs +++ b/tests/ui/async-await/async-closures/once.rs @@ -1,6 +1,8 @@ //@ aux-build:block-on.rs //@ edition:2021 //@ build-pass +//@ revisions: current next +//@[next] compile-flags: -Znext-solver #![feature(async_closure)] @@ -8,11 +10,11 @@ use std::future::Future; extern crate block_on; -struct NoCopy; +// Check that async closures always implement `FnOnce` fn main() { block_on::block_on(async { - async fn call_once<F: Future>(x: impl Fn(&'static str) -> F) -> F::Output { + async fn call_once<F: Future>(x: impl FnOnce(&'static str) -> F) -> F::Output { x("hello, world").await } call_once(async |x: &'static str| { diff --git a/tests/ui/async-await/async-closures/refd.rs b/tests/ui/async-await/async-closures/refd.rs index 1d9bc1a601b..0b8d3d7aff5 100644 --- a/tests/ui/async-await/async-closures/refd.rs +++ b/tests/ui/async-await/async-closures/refd.rs @@ -2,8 +2,6 @@ //@ edition:2021 //@ build-pass -// check that `&{async-closure}` implements `AsyncFn`. - #![feature(async_closure)] extern crate block_on; @@ -13,6 +11,15 @@ struct NoCopy; fn main() { block_on::block_on(async { async fn call_once(x: impl async Fn()) { x().await } - call_once(&async || {}).await + + // check that `&{async-closure}` implements `async Fn`. + call_once(&async || {}).await; + + // check that `&{closure}` implements `async Fn`. + call_once(&|| async {}).await; + + // check that `&fndef` implements `async Fn`. + async fn foo() {} + call_once(&foo).await; }); } diff --git a/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs new file mode 100644 index 00000000000..5680c057737 --- /dev/null +++ b/tests/ui/async-await/async-fn/higher-ranked-async-fn.rs @@ -0,0 +1,31 @@ +//@ aux-build:block-on.rs +//@ edition:2018 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ build-pass (since it ICEs during mono) + +#![feature(async_closure)] + +extern crate block_on; + +use std::future::Future; + +async fn f(arg: &i32) {} + +async fn func<F>(f: F) +where + F: async for<'a> Fn(&'a i32), +{ + let x: i32 = 0; + f(&x).await; +} + +fn main() { + block_on::block_on(async { + // Function + func(f).await; + + // Regular closure (doesn't capture) + func(|x: &i32| async {}); + }); +} diff --git a/tests/ui/async-await/async-fn/project.rs b/tests/ui/async-await/async-fn/project.rs new file mode 100644 index 00000000000..302564bb951 --- /dev/null +++ b/tests/ui/async-await/async-fn/project.rs @@ -0,0 +1,12 @@ +//@ edition:2018 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ check-pass + +#![feature(async_closure, unboxed_closures, async_fn_traits)] + +fn project<F: async Fn<()>>(_: F) -> Option<F::Output> { None } + +fn main() { + let x: Option<i32> = project(|| async { 1i32 }); +} diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr deleted file mode 100644 index 77385e966ce..00000000000 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.current.stderr +++ /dev/null @@ -1,50 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-110963-early.rs:6:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0308]: mismatched types - --> $DIR/issue-110963-early.rs:17:5 - | -LL | / spawn(async move { -LL | | let mut hc = hc; -LL | | if !hc.check().await { -LL | | log_health_check_failure().await; -LL | | } -LL | | }); - | |______^ one type is more general than the other - | - = note: expected trait `Send` - found trait `for<'a> Send` -note: the lifetime requirement is introduced here - --> $DIR/issue-110963-early.rs:37:17 - | -LL | F: Future + Send + 'static, - | ^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-110963-early.rs:17:5 - | -LL | / spawn(async move { -LL | | let mut hc = hc; -LL | | if !hc.check().await { -LL | | log_health_check_failure().await; -LL | | } -LL | | }); - | |______^ one type is more general than the other - | - = note: expected trait `Send` - found trait `for<'a> Send` -note: the lifetime requirement is introduced here - --> $DIR/issue-110963-early.rs:37:17 - | -LL | F: Future + Send + 'static, - | ^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr deleted file mode 100644 index 77385e966ce..00000000000 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.next.stderr +++ /dev/null @@ -1,50 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-110963-early.rs:6:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0308]: mismatched types - --> $DIR/issue-110963-early.rs:17:5 - | -LL | / spawn(async move { -LL | | let mut hc = hc; -LL | | if !hc.check().await { -LL | | log_health_check_failure().await; -LL | | } -LL | | }); - | |______^ one type is more general than the other - | - = note: expected trait `Send` - found trait `for<'a> Send` -note: the lifetime requirement is introduced here - --> $DIR/issue-110963-early.rs:37:17 - | -LL | F: Future + Send + 'static, - | ^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-110963-early.rs:17:5 - | -LL | / spawn(async move { -LL | | let mut hc = hc; -LL | | if !hc.check().await { -LL | | log_health_check_failure().await; -LL | | } -LL | | }); - | |______^ one type is more general than the other - | - = note: expected trait `Send` - found trait `for<'a> Send` -note: the lifetime requirement is introduced here - --> $DIR/issue-110963-early.rs:37:17 - | -LL | F: Future + Send + 'static, - | ^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.current.stderr b/tests/ui/async-await/return-type-notation/issue-110963-late.current.stderr deleted file mode 100644 index 018f4f2207a..00000000000 --- a/tests/ui/async-await/return-type-notation/issue-110963-late.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-110963-late.rs:6:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr deleted file mode 100644 index 5f482b60878..00000000000 --- a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/super-method-bound.rs:6:31 - | -LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr deleted file mode 100644 index 928b321697c..00000000000 --- a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/supertrait-bound.rs:5:49 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr deleted file mode 100644 index 928b321697c..00000000000 --- a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/supertrait-bound.rs:5:49 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr deleted file mode 100644 index e2bbb6013fc..00000000000 --- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr +++ /dev/null @@ -1,28 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ty-or-ct-params.rs:5:31 - | -LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: return type notation is not allowed for functions that have type parameters - --> $DIR/ty-or-ct-params.rs:16:12 - | -LL | async fn bar<T>() {} - | - type parameter declared here -... -LL | T: Foo<bar(): Send, baz(): Send>, - | ^^^^^^^^^^^ - -error: return type notation is not allowed for functions that have const parameters - --> $DIR/ty-or-ct-params.rs:16:25 - | -LL | async fn baz<const N: usize>() {} - | -------------- const parameter declared here -... -LL | T: Foo<bar(): Send, baz(): Send>, - | ^^^^^^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr deleted file mode 100644 index e2bbb6013fc..00000000000 --- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr +++ /dev/null @@ -1,28 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ty-or-ct-params.rs:5:31 - | -LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: return type notation is not allowed for functions that have type parameters - --> $DIR/ty-or-ct-params.rs:16:12 - | -LL | async fn bar<T>() {} - | - type parameter declared here -... -LL | T: Foo<bar(): Send, baz(): Send>, - | ^^^^^^^^^^^ - -error: return type notation is not allowed for functions that have const parameters - --> $DIR/ty-or-ct-params.rs:16:25 - | -LL | async fn baz<const N: usize>() {} - | -------------- const parameter declared here -... -LL | T: Foo<bar(): Send, baz(): Send>, - | ^^^^^^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted - diff --git a/tests/ui/attributes/doc-attr.rs b/tests/ui/attributes/doc-attr.rs index 980d1c0e207..666aeb55cbe 100644 --- a/tests/ui/attributes/doc-attr.rs +++ b/tests/ui/attributes/doc-attr.rs @@ -1,25 +1,17 @@ #![crate_type = "lib"] -#![deny(warnings)] #![doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~^^ WARN #[doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~^^ WARN pub fn foo() {} #[doc(123)] //~^ ERROR invalid `doc` attribute -//~| WARN #[doc("hello", "bar")] //~^ ERROR invalid `doc` attribute -//~| WARN //~| ERROR invalid `doc` attribute -//~| WARN #[doc(foo::bar, crate::bar::baz = "bye")] //~^ ERROR unknown `doc` attribute -//~| WARN //~| ERROR unknown `doc` attribute -//~| WARN fn bar() {} diff --git a/tests/ui/attributes/doc-attr.stderr b/tests/ui/attributes/doc-attr.stderr index 68df2771fd7..091ffc20d46 100644 --- a/tests/ui/attributes/doc-attr.stderr +++ b/tests/ui/attributes/doc-attr.stderr @@ -1,71 +1,46 @@ error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:7:7 + --> $DIR/doc-attr.rs:5:7 | LL | #[doc(as_ptr)] | ^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> -note: the lint level is defined here - --> $DIR/doc-attr.rs:2:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default error: invalid `doc` attribute - --> $DIR/doc-attr.rs:12:7 + --> $DIR/doc-attr.rs:9:7 | LL | #[doc(123)] | ^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:7 + --> $DIR/doc-attr.rs:11:7 | LL | #[doc("hello", "bar")] | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: invalid `doc` attribute - --> $DIR/doc-attr.rs:15:16 + --> $DIR/doc-attr.rs:11:16 | LL | #[doc("hello", "bar")] | ^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `foo::bar` - --> $DIR/doc-attr.rs:20:7 + --> $DIR/doc-attr.rs:14:7 | LL | #[doc(foo::bar, crate::bar::baz = "bye")] | ^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `crate::bar::baz` - --> $DIR/doc-attr.rs:20:17 + --> $DIR/doc-attr.rs:14:17 | LL | #[doc(foo::bar, crate::bar::baz = "bye")] | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:3:8 + --> $DIR/doc-attr.rs:2:8 | LL | #![doc(as_ptr)] | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: aborting due to 7 previous errors diff --git a/tests/ui/attributes/doc-test-literal.rs b/tests/ui/attributes/doc-test-literal.rs index a06a1afcb3f..92fe7846f14 100644 --- a/tests/ui/attributes/doc-test-literal.rs +++ b/tests/ui/attributes/doc-test-literal.rs @@ -1,7 +1,4 @@ -#![deny(warnings)] - #![doc(test(""))] //~^ ERROR `#![doc(test(...)]` does not take a literal -//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! fn main() {} diff --git a/tests/ui/attributes/doc-test-literal.stderr b/tests/ui/attributes/doc-test-literal.stderr index ed2964825c7..39e109a76ce 100644 --- a/tests/ui/attributes/doc-test-literal.stderr +++ b/tests/ui/attributes/doc-test-literal.stderr @@ -1,17 +1,10 @@ error: `#![doc(test(...)]` does not take a literal - --> $DIR/doc-test-literal.rs:3:13 + --> $DIR/doc-test-literal.rs:1:13 | LL | #![doc(test(""))] | ^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> -note: the lint level is defined here - --> $DIR/doc-test-literal.rs:1:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]` + = note: `#[deny(invalid_doc_attributes)]` on by default error: aborting due to 1 previous error diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs index 7bf1c7350c3..7bf1c7350c3 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.rs diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr index b18ec9abc37..56218ed499e 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-bare.stderr @@ -1,5 +1,5 @@ error: valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl` - --> $DIR/unix_sigpipe.rs:3:1 + --> $DIR/unix_sigpipe-bare.rs:3:1 | LL | #[unix_sigpipe] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs new file mode 100644 index 00000000000..294cb38526b --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.rs @@ -0,0 +1,5 @@ +#![feature(unix_sigpipe)] + +#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes +fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr new file mode 100644 index 00000000000..c2a3b9f45f9 --- /dev/null +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-different-duplicates.stderr @@ -0,0 +1,14 @@ +error: multiple `unix_sigpipe` attributes + --> $DIR/unix_sigpipe-different-duplicates.rs:4:1 + | +LL | #[unix_sigpipe = "inherit"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unix_sigpipe-different-duplicates.rs:3:1 + | +LL | #[unix_sigpipe = "sig_ign"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs index 294cb38526b..eccb23021b6 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.rs @@ -1,5 +1,5 @@ #![feature(unix_sigpipe)] -#[unix_sigpipe = "sig_ign"] +#[unix_sigpipe = "inherit"] #[unix_sigpipe = "inherit"] //~ error: multiple `unix_sigpipe` attributes fn main() {} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr index 931aae96b0f..c86e54a1e53 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-duplicates.stderr @@ -7,7 +7,7 @@ LL | #[unix_sigpipe = "inherit"] note: attribute also specified here --> $DIR/unix_sigpipe-duplicates.rs:3:1 | -LL | #[unix_sigpipe = "sig_ign"] +LL | #[unix_sigpipe = "inherit"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs index 778e06cb3ef..b0044f5e919 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-not-used.rs @@ -1,6 +1,9 @@ +//@ revisions: with_feature without_feature //@ run-pass //@ aux-build:sigpipe-utils.rs +#![cfg_attr(with_feature, feature(unix_sigpipe))] + fn main() { extern crate sigpipe_utils; diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs deleted file mode 100644 index 6bbe4a8d0d6..00000000000 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-only-feature.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -//@ aux-build:sigpipe-utils.rs - -#![feature(unix_sigpipe)] - -fn main() { - extern crate sigpipe_utils; - - // Only #![feature(unix_sigpipe)] is enabled, not #[unix_sigpipe = "..."]. - // This shall not change any behavior, so we still expect SIGPIPE to be - // ignored - sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore); -} diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs index ccd6c678660..ccd6c678660 100644 --- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-error.rs +++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-sig_ign.rs diff --git a/tests/ui/borrowck/borrowck-uninit.rs b/tests/ui/borrowck/borrowck-uninit.rs index 5d0ebabb008..2e2e120d427 100644 --- a/tests/ui/borrowck/borrowck-uninit.rs +++ b/tests/ui/borrowck/borrowck-uninit.rs @@ -3,4 +3,17 @@ fn foo(x: isize) { println!("{}", x); } fn main() { let x: isize; foo(x); //~ ERROR E0381 + + // test for #120634 + struct A(u8); + struct B { d: u8 } + let (a, ); + let [b, ]; + let A(c); + let B { d }; + let _: (u8, u8, u8, u8) = (a, b, c, d); + //~^ ERROR used binding `a` + //~| ERROR used binding `b` + //~| ERROR used binding `c` + //~| ERROR used binding `d` } diff --git a/tests/ui/borrowck/borrowck-uninit.stderr b/tests/ui/borrowck/borrowck-uninit.stderr index 213b541b8a9..1e004baa143 100644 --- a/tests/ui/borrowck/borrowck-uninit.stderr +++ b/tests/ui/borrowck/borrowck-uninit.stderr @@ -11,6 +11,41 @@ help: consider assigning a value LL | let x: isize = 0; | +++ -error: aborting due to 1 previous error +error[E0381]: used binding `a` isn't initialized + --> $DIR/borrowck-uninit.rs:14:32 + | +LL | let (a, ); + | - binding declared here but left uninitialized +... +LL | let _: (u8, u8, u8, u8) = (a, b, c, d); + | ^ `a` used here but it isn't initialized + +error[E0381]: used binding `b` isn't initialized + --> $DIR/borrowck-uninit.rs:14:35 + | +LL | let [b, ]; + | - binding declared here but left uninitialized +... +LL | let _: (u8, u8, u8, u8) = (a, b, c, d); + | ^ `b` used here but it isn't initialized + +error[E0381]: used binding `c` isn't initialized + --> $DIR/borrowck-uninit.rs:14:38 + | +LL | let A(c); + | - binding declared here but left uninitialized +LL | let B { d }; +LL | let _: (u8, u8, u8, u8) = (a, b, c, d); + | ^ `c` used here but it isn't initialized + +error[E0381]: used binding `d` isn't initialized + --> $DIR/borrowck-uninit.rs:14:41 + | +LL | let B { d }; + | - binding declared here but left uninitialized +LL | let _: (u8, u8, u8, u8) = (a, b, c, d); + | ^ `d` used here but it isn't initialized + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/closure-expected-type/expect-fn-supply-fn.rs b/tests/ui/closure-expected-type/expect-fn-supply-fn.rs index 7f1c140279c..7599d078351 100644 --- a/tests/ui/closure-expected-type/expect-fn-supply-fn.rs +++ b/tests/ui/closure-expected-type/expect-fn-supply-fn.rs @@ -30,14 +30,16 @@ fn expect_free_supply_bound() { // Here, we are given a function whose region is bound at closure level, // but we expect one bound in the argument. Error results. with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - //~^ ERROR mismatched types + //~^ ERROR mismatched types [E0308] + //~| ERROR lifetime may not live long enough } fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) { // Here, we are given a `fn(&u32)` but we expect a `fn(&'x // u32)`. In principle, this could be ok, but we demand equality. with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - //~^ ERROR mismatched types + //~^ ERROR mismatched types [E0308] + //~| ERROR lifetime may not live long enough } fn expect_bound_supply_free_from_closure() { diff --git a/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr b/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr index e010f0502f8..4215cd0bc11 100644 --- a/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/tests/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -19,6 +19,15 @@ LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^ requires that `'x` must outlive `'static` +error: lifetime may not live long enough + --> $DIR/expect-fn-supply-fn.rs:32:49 + | +LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); + | ^ + | | + | has type `fn(&'1 u32)` + | requires that `'1` must outlive `'static` + error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:32:49 | @@ -29,7 +38,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); found fn pointer `for<'a> fn(&'a _)` error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:39:50 + --> $DIR/expect-fn-supply-fn.rs:40:50 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); | ^ one type is more general than the other @@ -37,8 +46,17 @@ LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); = note: expected fn pointer `for<'a> fn(&'a _)` found fn pointer `fn(&_)` +error: lifetime may not live long enough + --> $DIR/expect-fn-supply-fn.rs:40:50 + | +LL | fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) { + | -- lifetime `'x` defined here +... +LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); + | ^ requires that `'x` must outlive `'static` + error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:48:50 + --> $DIR/expect-fn-supply-fn.rs:50:50 | LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { | ^ one type is more general than the other @@ -46,6 +64,6 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { = note: expected fn pointer `for<'a> fn(&'a _)` found fn pointer `fn(&_)` -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs index 99f805f7f0f..fb706ba1352 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.rs @@ -1,10 +1,15 @@ -// Test that impls for these two types are considered ovelapping: +//@ check-pass + +// These types were previously considered equal as they are subtypes of each other. +// This has been changed in #118247 and we now consider them to be disjoint. +// +// In our test: // // * `for<'r> fn(fn(&'r u32))` // * `fn(fn(&'a u32)` where `'a` is free // -// This is because, for `'a = 'static`, the two types overlap. -// Effectively for them to be equal to you get: +// These were considered equal as for `'a = 'static` subtyping succeeds in both +// directions: // // * `for<'r> fn(fn(&'r u32)) <: fn(fn(&'static u32))` // * true if `exists<'r> { 'r: 'static }` (obviously true) @@ -15,12 +20,7 @@ trait Trait {} impl Trait for for<'r> fn(fn(&'r ())) {} impl<'a> Trait for fn(fn(&'a ())) {} -//~^ ERROR conflicting implementations -// -// Note in particular that we do NOT get a future-compatibility warning -// here. This is because the new leak-check proposed in [MCP 295] does not -// "error" when these two types are equated. -// -// [MCP 295]: https://github.com/rust-lang/compiler-team/issues/295 +//~^ WARN conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` [coherence_leak_check] +//~| WARN the behavior may change in a future release fn main() {} diff --git a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr index 316da26b54d..01694eaf5d1 100644 --- a/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr +++ b/tests/ui/coherence/coherence-fn-covariant-bound-vs-static.stderr @@ -1,13 +1,15 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` - --> $DIR/coherence-fn-covariant-bound-vs-static.rs:17:1 +warning: conflicting implementations of trait `Trait` for type `for<'r> fn(fn(&'r ()))` + --> $DIR/coherence-fn-covariant-bound-vs-static.rs:22:1 | LL | impl Trait for for<'r> fn(fn(&'r ())) {} | ------------------------------------- first implementation here LL | impl<'a> Trait for fn(fn(&'a ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'r> fn(fn(&'r ()))` | + = warning: the behavior may change in a future release + = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + = note: `#[warn(coherence_leak_check)]` on by default -error: aborting due to 1 previous error +warning: 1 warning emitted -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/coherence-fn-inputs.rs b/tests/ui/coherence/coherence-fn-inputs.rs index 3afec5c5459..a88a846329d 100644 --- a/tests/ui/coherence/coherence-fn-inputs.rs +++ b/tests/ui/coherence/coherence-fn-inputs.rs @@ -1,11 +1,12 @@ -// Test that we consider these two types completely equal: +//@ check-pass + +// These types were previously considered equal as they are subtypes of each other. +// This has been changed in #118247 and we now consider them to be disjoint. // // * `for<'a, 'b> fn(&'a u32, &'b u32)` // * `for<'c> fn(&'c u32, &'c u32)` // -// For a long time we considered these to be distinct types. But in fact they -// are equivalent, if you work through the implications of subtyping -- this is -// because: +// These types are subtypes of each other as: // // * `'c` can be the intersection of `'a` and `'b` (and there is always an intersection) // * `'a` and `'b` can both be equal to `'c` @@ -13,7 +14,8 @@ trait Trait {} impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} impl Trait for for<'c> fn(&'c u32, &'c u32) { - //~^ ERROR conflicting implementations + //~^ WARN conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` [coherence_leak_check] + //~| WARN the behavior may change in a future release // // Note in particular that we do NOT get a future-compatibility warning // here. This is because the new leak-check proposed in [MCP 295] does not diff --git a/tests/ui/coherence/coherence-fn-inputs.stderr b/tests/ui/coherence/coherence-fn-inputs.stderr index 246ec5947b3..56f3a14833e 100644 --- a/tests/ui/coherence/coherence-fn-inputs.stderr +++ b/tests/ui/coherence/coherence-fn-inputs.stderr @@ -1,13 +1,15 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` - --> $DIR/coherence-fn-inputs.rs:15:1 +warning: conflicting implementations of trait `Trait` for type `for<'a, 'b> fn(&'a u32, &'b u32)` + --> $DIR/coherence-fn-inputs.rs:16:1 | LL | impl Trait for for<'a, 'b> fn(&'a u32, &'b u32) {} | ----------------------------------------------- first implementation here LL | impl Trait for for<'c> fn(&'c u32, &'c u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u32, &'b u32)` | + = warning: the behavior may change in a future release + = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + = note: `#[warn(coherence_leak_check)]` on by default -error: aborting due to 1 previous error +warning: 1 warning emitted -For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr index 220fcd38b09..26e724c9061 100644 --- a/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr +++ b/tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr @@ -7,5 +7,21 @@ LL | WHAT_A_TYPE => 0, = note: the traits must be derived, manual `impl`s are not sufficient = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details -error: aborting due to 1 previous error +error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied + --> $DIR/typeid-equality-by-subtyping.rs:44:51 + | +LL | fn unsound<T>(x: <One as WithAssoc<T>>::Assoc) -> <Two as WithAssoc<T>>::Assoc + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` + +error[E0277]: the trait bound `for<'a, 'b> fn(&'a (), &'b ()): WithAssoc<T>` is not satisfied + --> $DIR/typeid-equality-by-subtyping.rs:47:1 + | +LL | / { +LL | | let x: <Two as WithAssoc<T>>::Assoc = generic::<One, T>(x); +LL | | x +LL | | } + | |_^ the trait `WithAssoc<T>` is not implemented for `for<'a, 'b> fn(&'a (), &'b ())` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs index 4c90d1c9840..53207e43fdf 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.rs +++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs @@ -1,7 +1,8 @@ // ignore-tidy-linelength #![allow(unused)] +#![feature(ptr_metadata)] -use std::mem; +use std::{ptr, mem}; // Strip out raw byte dumps to make comparison platform-independent: //@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" @@ -145,6 +146,8 @@ const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92 const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; //~^ ERROR it is undefined behavior to use this value const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) } as *const dyn Trait; // ok because raw +// Officially blessed way to get the vtable +const DYN_METADATA: ptr::DynMetadata<dyn Send> = ptr::metadata::<dyn Send>(ptr::null::<i32>()); // Const eval fails for these, so they need to be statics to error. static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe { diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr index 91ce531c9f7..2fa462a6a64 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:38:1 + --> $DIR/ub-wide-ptr.rs:39:1 | LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -10,7 +10,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:40:1 + --> $DIR/ub-wide-ptr.rs:41:1 | LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object @@ -21,7 +21,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:43:1 + --> $DIR/ub-wide-ptr.rs:44:1 | LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer @@ -30,7 +30,7 @@ LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:46:1 + --> $DIR/ub-wide-ptr.rs:47:1 | LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer @@ -39,7 +39,7 @@ LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:48:1 + --> $DIR/ub-wide-ptr.rs:49:1 | LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -50,7 +50,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:52:1 + --> $DIR/ub-wide-ptr.rs:53:1 | LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string @@ -61,7 +61,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit: } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:55:1 + --> $DIR/ub-wide-ptr.rs:56:1 | LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string @@ -72,13 +72,13 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:62:1 + --> $DIR/ub-wide-ptr.rs:63:1 | LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:69:1 + --> $DIR/ub-wide-ptr.rs:70:1 | LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation) @@ -89,7 +89,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:72:1 + --> $DIR/ub-wide-ptr.rs:73:1 | LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object @@ -100,7 +100,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:75:1 + --> $DIR/ub-wide-ptr.rs:76:1 | LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer @@ -109,7 +109,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:78:1 + --> $DIR/ub-wide-ptr.rs:79:1 | LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation) @@ -120,7 +120,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us } error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:81:1 + --> $DIR/ub-wide-ptr.rs:82:1 | LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer @@ -129,7 +129,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3) = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:85:1 + --> $DIR/ub-wide-ptr.rs:86:1 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean @@ -140,13 +140,13 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; } note: erroneous constant encountered - --> $DIR/ub-wide-ptr.rs:85:40 + --> $DIR/ub-wide-ptr.rs:86:40 | LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:92:1 + --> $DIR/ub-wide-ptr.rs:93:1 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean @@ -157,13 +157,13 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3 } note: erroneous constant encountered - --> $DIR/ub-wide-ptr.rs:92:42 + --> $DIR/ub-wide-ptr.rs:93:42 | LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:96:1 + --> $DIR/ub-wide-ptr.rs:97:1 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean @@ -174,19 +174,19 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran } note: erroneous constant encountered - --> $DIR/ub-wide-ptr.rs:96:42 + --> $DIR/ub-wide-ptr.rs:97:42 | LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/ub-wide-ptr.rs:104:1 + --> $DIR/ub-wide-ptr.rs:105:1 | LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:113:1 + --> $DIR/ub-wide-ptr.rs:114:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC12<imm>, but expected a vtable pointer @@ -197,7 +197,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:117:1 + --> $DIR/ub-wide-ptr.rs:118:1 | LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC14<imm>, but expected a vtable pointer @@ -208,7 +208,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W(( } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:121:1 + --> $DIR/ub-wide-ptr.rs:122:1 | LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer @@ -219,7 +219,7 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:124:1 + --> $DIR/ub-wide-ptr.rs:125:1 | LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC17<imm>, but expected a vtable pointer @@ -230,7 +230,7 @@ LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92 } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:127:1 + --> $DIR/ub-wide-ptr.rs:128:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC19<imm>, but expected a vtable pointer @@ -241,7 +241,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92 } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:130:1 + --> $DIR/ub-wide-ptr.rs:131:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC21<imm>, but expected a vtable pointer @@ -252,7 +252,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:133:1 + --> $DIR/ub-wide-ptr.rs:134:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC23<imm>, but expected a vtable pointer @@ -263,7 +263,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:138:1 + --> $DIR/ub-wide-ptr.rs:139:1 | LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean @@ -274,7 +274,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:143:1 + --> $DIR/ub-wide-ptr.rs:144:1 | LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer @@ -285,7 +285,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:145:1 + --> $DIR/ub-wide-ptr.rs:146:1 | LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC28<imm>, but expected a vtable pointer @@ -296,7 +296,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:150:1 + --> $DIR/ub-wide-ptr.rs:153:1 | LL | static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer @@ -307,7 +307,7 @@ LL | static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-wide-ptr.rs:154:1 + --> $DIR/ub-wide-ptr.rs:157:1 | LL | static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC31<imm>, but expected a vtable pointer diff --git a/tests/ui/consts/const-mut-refs/const_mut_refs.rs b/tests/ui/consts/const-mut-refs/const_mut_refs.rs index e4a2b78f115..1b3091c8dba 100644 --- a/tests/ui/consts/const-mut-refs/const_mut_refs.rs +++ b/tests/ui/consts/const-mut-refs/const_mut_refs.rs @@ -33,6 +33,11 @@ const fn bazz(foo: &mut Foo) -> usize { // Empty slices get promoted so this passes the static checks. // Make sure it also passes the dynamic checks. static MUTABLE_REFERENCE_HOLDER: Mutex<&mut [u8]> = Mutex::new(&mut []); +// This variant with a non-empty slice also seems entirely reasonable. +static MUTABLE_REFERENCE_HOLDER2: Mutex<&mut [u8]> = unsafe { + static mut FOO: [u8; 1] = [42]; // a private static that we are sure nobody else will reference + Mutex::new(&mut *std::ptr::addr_of_mut!(FOO)) +}; fn main() { let _: [(); foo().bar()] = [(); 1]; diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs index bd4a9863c74..f3f0e1446fc 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs @@ -18,9 +18,7 @@ const fn helper() -> Option<&'static mut i32> { unsafe { Some(&mut *std::ptr::addr_of_mut!(BUFFER)) } } const MUT: Option<&mut i32> = helper(); //~ ERROR it is undefined behavior to use this value -//~^ encountered mutable reference -static MUT_STATIC: Option<&mut i32> = helper(); //~ ERROR it is undefined behavior to use this value -//~^ encountered mutable reference +//~^ encountered reference to mutable const fn helper_int2ptr() -> Option<&'static mut i32> { unsafe { // Undefined behaviour (integer as pointer), who doesn't love tests like this. @@ -38,11 +36,9 @@ const fn helper_dangling() -> Option<&'static mut i32> { unsafe { const DANGLING: Option<&mut i32> = helper_dangling(); //~ ERROR encountered dangling pointer static DANGLING_STATIC: Option<&mut i32> = helper_dangling(); //~ ERROR encountered dangling pointer -// Variant of the real-world case in <https://github.com/rust-lang/rust/issues/120450>. -// Maybe we should allow this in the future (then the rest should move to `const_mut_refs.rs`), -// but for now we reject it. +// These are fine! Just statics pointing to mutable statics, nothing fundamentally wrong with this. +static MUT_STATIC: Option<&mut i32> = helper(); static mut MUT_ARRAY: &mut [u8] = &mut [42]; -static MUTEX: Mutex<&mut [u8]> = Mutex::new(unsafe { &mut *MUT_ARRAY }); //~ ERROR it is undefined behavior to use this value -//~^ encountered mutable reference +static MUTEX: Mutex<&mut [u8]> = Mutex::new(unsafe { &mut *MUT_ARRAY }); fn main() {} diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr index a99d1584932..5923683a1c9 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr @@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/mut_ref_in_final_dynamic_check.rs:20:1 | LL | const MUT: Option<&mut i32> = helper(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered reference to mutable memory in `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { @@ -10,18 +10,7 @@ LL | const MUT: Option<&mut i32> = helper(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:22:1 - | -LL | static MUT_STATIC: Option<&mut i32> = helper(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { - HEX_DUMP - } - -error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:29:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:27:1 | LL | const INT2PTR: Option<&mut i32> = helper_int2ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance) @@ -32,7 +21,7 @@ LL | const INT2PTR: Option<&mut i32> = helper_int2ptr(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:31:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:29:1 | LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance) @@ -43,28 +32,17 @@ LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr(); } error: encountered dangling pointer in final value of constant - --> $DIR/mut_ref_in_final_dynamic_check.rs:38:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:36:1 | LL | const DANGLING: Option<&mut i32> = helper_dangling(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered dangling pointer in final value of static - --> $DIR/mut_ref_in_final_dynamic_check.rs:39:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:37:1 | LL | static DANGLING_STATIC: Option<&mut i32> = helper_dangling(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:45:1 - | -LL | static MUTEX: Mutex<&mut [u8]> = Mutex::new(unsafe { &mut *MUT_ARRAY }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .data.value: encountered mutable reference in a `const` or `static` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { - HEX_DUMP - } - -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr deleted file mode 100644 index 2b5e8643f3b..00000000000 --- a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr +++ /dev/null @@ -1,180 +0,0 @@ -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:17:1 - | -LL | const MUH: Meh = Meh { - | ^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:28:1 - | -LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:33:1 - | -LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; - | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - ╾ALLOC0╼ │ ╾──────╼ - } - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:36:1 - | -LL | const BLUNT: &mut i32 = &mut 42; - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:41:1 - | -LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - ╾ALLOC1<imm>╼ │ ╾──────╼ - } - -error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:48:1 - | -LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 8, align: 8) { - ╾ALLOC2<imm>╼ │ ╾──────╼ - } - -note: erroneous constant encountered - --> $DIR/mutable_references_err.rs:50:34 - | -LL | const READS_FROM_MUTABLE: i32 = *POINTS_TO_MUTABLE1; - | ^^^^^^^^^^^^^^^^^^ - -error[E0080]: evaluation of constant value failed - --> $DIR/mutable_references_err.rs:52:43 - | -LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF }; - | ^^^^^^^^^^^^^ constant accesses mutable global memory - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:56:1 - | -LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:58:1 - | -LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:60:1 - | -LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:72:1 - | -LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:74:1 - | -LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:76:1 - | -LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: skipping const checks - | -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:19:8 - | -LL | x: &UnsafeCell::new(42), - | ^^^^^^^^^^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:28:27 - | -LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:33:40 - | -LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; - | ^^^ -help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:33:35 - | -LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; - | ^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:36:25 - | -LL | const BLUNT: &mut i32 = &mut 42; - | ^^^^^^^ -help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:41:49 - | -LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:41:49 - | -LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:48:44 - | -LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE }; - | ^^^^^^^ -help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:52:45 - | -LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF }; - | ^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:56:45 - | -LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _; - | ^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:58:46 - | -LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _; - | ^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:60:47 - | -LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; - | ^^^^^^^^^^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:72:51 - | -LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) }; - | ^^^^^^^^^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:74:49 - | -LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ }; - | ^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:76:51 - | -LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 }; - | ^^^^^^ - -error: aborting due to 13 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.rs b/tests/ui/consts/miri_unleashed/mutable_references_err.rs index feb2c825380..3f3e5f57175 100644 --- a/tests/ui/consts/miri_unleashed/mutable_references_err.rs +++ b/tests/ui/consts/miri_unleashed/mutable_references_err.rs @@ -1,5 +1,6 @@ -//@ stderr-per-bitwidth //@ compile-flags: -Zunleash-the-miri-inside-of-you +//@ 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" #![allow(invalid_reference_casting, static_mut_refs)] use std::cell::UnsafeCell; diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.stderr index ea7573bf217..c86e2ea081f 100644 --- a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr +++ b/tests/ui/consts/miri_unleashed/mutable_references_err.stderr @@ -1,98 +1,98 @@ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:17:1 + --> $DIR/mutable_references_err.rs:18:1 | LL | const MUH: Meh = Meh { | ^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:28:1 + --> $DIR/mutable_references_err.rs:29:1 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:33:1 + --> $DIR/mutable_references_err.rs:34:1 | LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; - | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static` + | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - ╾ALLOC0╼ │ ╾──╼ + = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { + HEX_DUMP } error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:36:1 + --> $DIR/mutable_references_err.rs:37:1 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:41:1 + --> $DIR/mutable_references_err.rs:42:1 | LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - ╾ALLOC1<imm>╼ │ ╾──╼ + = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { + HEX_DUMP } error[E0080]: it is undefined behavior to use this value - --> $DIR/mutable_references_err.rs:48:1 + --> $DIR/mutable_references_err.rs:49:1 | LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant (size: 4, align: 4) { - ╾ALLOC2<imm>╼ │ ╾──╼ + = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { + HEX_DUMP } note: erroneous constant encountered - --> $DIR/mutable_references_err.rs:50:34 + --> $DIR/mutable_references_err.rs:51:34 | LL | const READS_FROM_MUTABLE: i32 = *POINTS_TO_MUTABLE1; | ^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/mutable_references_err.rs:52:43 + --> $DIR/mutable_references_err.rs:53:43 | LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF }; | ^^^^^^^^^^^^^ constant accesses mutable global memory error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:56:1 + --> $DIR/mutable_references_err.rs:57:1 | LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:58:1 + --> $DIR/mutable_references_err.rs:59:1 | LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:60:1 + --> $DIR/mutable_references_err.rs:61:1 | LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:72:1 + --> $DIR/mutable_references_err.rs:73:1 | LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:74:1 + --> $DIR/mutable_references_err.rs:75:1 | LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: encountered mutable pointer in final value of constant - --> $DIR/mutable_references_err.rs:76:1 + --> $DIR/mutable_references_err.rs:77:1 | LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,77 +100,77 @@ LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 }; warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:19:8 + --> $DIR/mutable_references_err.rs:20:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:28:27 + --> $DIR/mutable_references_err.rs:29:27 | LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:33:40 + --> $DIR/mutable_references_err.rs:34:40 | LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; | ^^^ help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:33:35 + --> $DIR/mutable_references_err.rs:34:35 | LL | const SUBTLE: &mut i32 = unsafe { &mut FOO }; | ^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:36:25 + --> $DIR/mutable_references_err.rs:37:25 | LL | const BLUNT: &mut i32 = &mut 42; | ^^^^^^^ help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:41:49 + --> $DIR/mutable_references_err.rs:42:49 | LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check for `const_mut_refs` feature - --> $DIR/mutable_references_err.rs:41:49 + --> $DIR/mutable_references_err.rs:42:49 | LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:48:44 + --> $DIR/mutable_references_err.rs:49:44 | LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE }; | ^^^^^^^ help: skipping check for `const_refs_to_static` feature - --> $DIR/mutable_references_err.rs:52:45 + --> $DIR/mutable_references_err.rs:53:45 | LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF }; | ^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:56:45 + --> $DIR/mutable_references_err.rs:57:45 | LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _; | ^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:58:46 + --> $DIR/mutable_references_err.rs:59:46 | LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _; | ^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:60:47 + --> $DIR/mutable_references_err.rs:61:47 | LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:72:51 + --> $DIR/mutable_references_err.rs:73:51 | LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) }; | ^^^^^^^^^^^^^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:74:49 + --> $DIR/mutable_references_err.rs:75:49 | LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ }; | ^^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/mutable_references_err.rs:76:51 + --> $DIR/mutable_references_err.rs:77:51 | LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 }; | ^^^^^^ diff --git a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs index 66d562d2eb5..5c2c3b8ec61 100644 --- a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs +++ b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs @@ -1,6 +1,5 @@ const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻² //~^ ERROR expected at least one digit in exponent //~| ERROR unknown start of token: \u{2212} -//~| ERROR cannot subtract `{integer}` from `{float}` fn main() {} diff --git a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index 44bdbb93ff5..4b3d429c750 100644 --- a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -15,24 +15,5 @@ help: Unicode character '−' (Minus Sign) looks like '-' (Minus/Hyphen), but it LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻² | ~ -error[E0277]: cannot subtract `{integer}` from `{float}` - --> $DIR/issue-49746-unicode-confusable-in-float-literal-expt.rs:1:53 - | -LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻² - | ^ no implementation for `{float} - {integer}` - | - = help: the trait `Sub<{integer}>` is not implemented for `{float}` - = help: the following other types implement trait `Sub<Rhs>`: - <isize as Sub> - <isize as Sub<&isize>> - <i8 as Sub> - <i8 as Sub<&i8>> - <i16 as Sub> - <i16 as Sub<&i16>> - <i32 as Sub> - <i32 as Sub<&i32>> - and 48 others - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/error-codes/E0017.rs b/tests/ui/error-codes/E0017.rs index c29015c8f33..6ba5f9c9a2b 100644 --- a/tests/ui/error-codes/E0017.rs +++ b/tests/ui/error-codes/E0017.rs @@ -15,8 +15,4 @@ static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR cannot borrow immutable static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed //~| WARN taking a mutable -static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; -//~^ WARN mutable reference to mutable static is discouraged [static_mut_refs] -//~| ERROR undefined behavior - fn main() {} diff --git a/tests/ui/error-codes/E0017.stderr b/tests/ui/error-codes/E0017.stderr index b5e9bacb122..bb9f718b895 100644 --- a/tests/ui/error-codes/E0017.stderr +++ b/tests/ui/error-codes/E0017.stderr @@ -1,18 +1,3 @@ -warning: creating a mutable reference to mutable static is discouraged - --> $DIR/E0017.rs:18:52 - | -LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; - | ^^^^^^ mutable reference to mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: this will be a hard error in the 2024 edition - = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior - = note: `#[warn(static_mut_refs)]` on by default -help: use `addr_of_mut!` instead to create a raw pointer - | -LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { addr_of_mut!(M) }; - | ~~~~~~~~~~~~~~~ - warning: taking a mutable reference to a `const` item --> $DIR/E0017.rs:10:30 | @@ -60,18 +45,7 @@ error[E0764]: mutable references are not allowed in the final value of statics LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ -error[E0080]: it is undefined behavior to use this value - --> $DIR/E0017.rs:18:1 - | -LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. - = note: the raw bytes of the constant { - ╾ALLOC0╼ - } - -error: aborting due to 4 previous errors; 3 warnings emitted +error: aborting due to 3 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0080, E0596, E0764. -For more information about an error, try `rustc --explain E0080`. +Some errors have detailed explanations: E0596, E0764. +For more information about an error, try `rustc --explain E0596`. diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr deleted file mode 100644 index ce39f6b2971..00000000000 --- a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_current.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0658]: return type notation is experimental - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = help: add `#![feature(return_type_notation)]` to the crate attributes to enable - -error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^-- - | | - | help: remove these parentheses - -error[E0220]: associated type `m` not found for `Trait` - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^ associated type `m` not found - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0220, E0658. -For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr deleted file mode 100644 index ce39f6b2971..00000000000 --- a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg_next.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0658]: return type notation is experimental - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = help: add `#![feature(return_type_notation)]` to the crate attributes to enable - -error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^-- - | | - | help: remove these parentheses - -error[E0220]: associated type `m` not found for `Trait` - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^ associated type `m` not found - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0220, E0658. -For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr deleted file mode 100644 index d11359e7f48..00000000000 --- a/tests/ui/feature-gates/feature-gate-return_type_notation.no_current.stderr +++ /dev/null @@ -1,13 +0,0 @@ -warning: return type notation is experimental - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = help: add `#![feature(return_type_notation)]` to the crate attributes to enable - = warning: unstable syntax can change at any point in the future, causing a hard error! - = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860> - -warning: 1 warning emitted - diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr deleted file mode 100644 index d11359e7f48..00000000000 --- a/tests/ui/feature-gates/feature-gate-return_type_notation.no_next.stderr +++ /dev/null @@ -1,13 +0,0 @@ -warning: return type notation is experimental - --> $DIR/feature-gate-return_type_notation.rs:17:17 - | -LL | fn foo<T: Trait<m(): Send>>() {} - | ^^^^^^^^^ - | - = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information - = help: add `#![feature(return_type_notation)]` to the crate attributes to enable - = warning: unstable syntax can change at any point in the future, causing a hard error! - = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860> - -warning: 1 warning emitted - diff --git a/tests/ui/foreign/stashed-issue-121451.rs b/tests/ui/foreign/stashed-issue-121451.rs new file mode 100644 index 00000000000..97a4af37475 --- /dev/null +++ b/tests/ui/foreign/stashed-issue-121451.rs @@ -0,0 +1,4 @@ +extern "C" fn _f() -> libc::uintptr_t {} +//~^ ERROR failed to resolve: use of undeclared crate or module `libc` + +fn main() {} diff --git a/tests/ui/foreign/stashed-issue-121451.stderr b/tests/ui/foreign/stashed-issue-121451.stderr new file mode 100644 index 00000000000..440d98d6f46 --- /dev/null +++ b/tests/ui/foreign/stashed-issue-121451.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `libc` + --> $DIR/stashed-issue-121451.rs:1:23 + | +LL | extern "C" fn _f() -> libc::uintptr_t {} + | ^^^^ use of undeclared crate or module `libc` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/future-incompatible-lint-group.rs b/tests/ui/future-incompatible-lint-group.rs index bbd0e33d719..c84538318f7 100644 --- a/tests/ui/future-incompatible-lint-group.rs +++ b/tests/ui/future-incompatible-lint-group.rs @@ -11,8 +11,7 @@ trait Tr { pub mod submodule { // Error since this is a `future_incompatible` lint #![doc(test(some_test))] - //~^ ERROR this attribute can only be applied at the crate level - //~| WARN this was previously accepted by the compiler + //~^ ERROR this attribute can only be applied at the crate level } fn main() {} diff --git a/tests/ui/future-incompatible-lint-group.stderr b/tests/ui/future-incompatible-lint-group.stderr index 161fe82e373..4e6c434fa29 100644 --- a/tests/ui/future-incompatible-lint-group.stderr +++ b/tests/ui/future-incompatible-lint-group.stderr @@ -14,15 +14,8 @@ error: this attribute can only be applied at the crate level LL | #![doc(test(some_test))] | ^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information -note: the lint level is defined here - --> $DIR/future-incompatible-lint-group.rs:3:9 - | -LL | #![deny(future_incompatible)] - | ^^^^^^^^^^^^^^^^^^^ - = note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(future_incompatible)]` + = note: `#[deny(invalid_doc_attributes)]` on by default error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/generics/generic-no-mangle.fixed b/tests/ui/generics/generic-no-mangle.fixed index f20ea0edaa6..69db712f9dc 100644 --- a/tests/ui/generics/generic-no-mangle.fixed +++ b/tests/ui/generics/generic-no-mangle.fixed @@ -2,10 +2,8 @@ #![allow(dead_code)] #![deny(no_mangle_generic_items)] - pub fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled - pub extern "C" fn bar<T>() {} //~ ERROR functions generic over types or consts must be mangled #[no_mangle] diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-equality.rs b/tests/ui/higher-ranked/higher-ranked-lifetime-equality.rs new file mode 100644 index 00000000000..38abf59d844 --- /dev/null +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-equality.rs @@ -0,0 +1,38 @@ +// A regression test for #97156 + +type One = for<'a> fn(&'a (), &'a ()); +type Two = for<'a, 'b> fn(&'a (), &'b ()); + +mod my_api { + use std::any::Any; + use std::marker::PhantomData; + + pub struct Foo<T: 'static> { + a: &'static dyn Any, + _p: PhantomData<*mut T>, // invariant, the type of the `dyn Any` + } + + impl<T: 'static> Foo<T> { + pub fn deref(&self) -> &'static T { + match self.a.downcast_ref::<T>() { + None => unsafe { std::hint::unreachable_unchecked() }, + Some(a) => a, + } + } + + pub fn new(a: T) -> Foo<T> { + Foo::<T> { a: Box::leak(Box::new(a)), _p: PhantomData } + } + } +} + +use my_api::*; + +fn main() { + let foo = Foo::<One>::new((|_, _| ()) as One); + foo.deref(); + let foo: Foo<Two> = foo; + //~^ ERROR mismatched types [E0308] + //~| ERROR mismatched types [E0308] + foo.deref(); +} diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-equality.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-equality.stderr new file mode 100644 index 00000000000..8c0d66bb0bc --- /dev/null +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-equality.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/higher-ranked-lifetime-equality.rs:34:25 + | +LL | let foo: Foo<Two> = foo; + | ^^^ one type is more general than the other + | + = note: expected struct `my_api::Foo<for<'a, 'b> fn(&'a (), &'b ())>` + found struct `my_api::Foo<for<'a> fn(&'a (), &'a ())>` + +error[E0308]: mismatched types + --> $DIR/higher-ranked-lifetime-equality.rs:34:25 + | +LL | let foo: Foo<Two> = foo; + | ^^^ one type is more general than the other + | + = note: expected struct `my_api::Foo<for<'a, 'b> fn(&'a (), &'b ())>` + found struct `my_api::Foo<for<'a> fn(&'a (), &'a ())>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs index 230a0524df4..805fd7f1232 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.rs @@ -2,8 +2,6 @@ // // In particular, we test this pattern in trait solving, where it is not connected // to any part of the source code. -// -//@ check-pass trait Trait<T> {} @@ -21,17 +19,17 @@ fn main() { // - The impl provides the clause `forall<'a> { (): Trait<fn(fn(&'a u32))> }` // - We instantiate `'a` existentially to get `(): Trait<fn(fn(&?a u32))>` // - We unify `fn(fn(&?a u32))` with `for<'b> fn(fn(&'b u32))` -- this does a - // "bidirectional" subtyping check, so we wind up with: - // - `fn(fn(&?a u32)) <: for<'b> fn(fn(&'b u32))` :- - // - `fn(&!b u32) <: fn(&?a u32)` - // - `&?a u32 <: &!b u32` - // - `?a: !'b` -- solveable if `?a` is inferred to `'static` - // - `for<'b> fn(fn(&'b u32)) <: fn(fn(&?a u32))` :- - // - `fn(&?a u32) <: fn(&?b u32)` - // - `&?b u32 <: &?a u32` - // - `?b: ?a` -- solveable if `?b` is inferred to `'static` - // - So the subtyping check succeeds, somewhat surprisingly. - // This is because we can use `'static`. + // "bidirectional" equality check, so we wind up with: + // - `fn(fn(&?a u32)) == for<'b> fn(fn(&'b u32))` :- + // - `fn(&!b u32) == fn(&?a u32)` + // - `&?a u32 == &!b u32` + // - `?a == !b` -- error. + // - `fn(fn(&?a u32)) == for<'b> fn(fn(&'b u32))` :- + // - `fn(&?b u32) == fn(&?a u32)` + // - `&?a u32 == &?b u32` + // - `?a == ?b` -- OK. + // - So the unification fails. foo::<()>(); + //~^ ERROR implementation of `Trait` is not general enough } diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr new file mode 100644 index 00000000000..385de795b18 --- /dev/null +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-exists-forall-trait-covariant.stderr @@ -0,0 +1,11 @@ +error: implementation of `Trait` is not general enough + --> $DIR/hrtb-exists-forall-trait-covariant.rs:33:5 + | +LL | foo::<()>(); + | ^^^^^^^^^^^ implementation of `Trait` is not general enough + | + = note: `()` must implement `Trait<for<'b> fn(fn(&'b u32))>` + = note: ...but it actually implements `Trait<fn(fn(&'0 u32))>`, for some specific lifetime `'0` + +error: aborting due to 1 previous error + diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.next.stderr b/tests/ui/higher-ranked/trait-bounds/issue-95230.next.stderr index 6155579c9fa..9b0efe9abe6 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-95230.next.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.next.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `for<'a> &'a mut Bar well-form LL | for<'a> &'a mut Self:; | ^^^^^^^^^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_95230`) note: required by a bound in `Bar` --> $DIR/issue-95230.rs:9:13 | diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.migrate.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.migrate.stderr deleted file mode 100644 index 0f38f8e3283..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.migrate.stderr +++ /dev/null @@ -1,79 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>` - found type `for<'r> FnOnce<(&'r &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 - | -LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:54:5 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `FnOnce<(&&str,)>` - found type `for<'r> FnOnce<(&'r &str,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:54:24 - | -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 - | -LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool - | ^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>` - found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:9 - | -LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/issue-71955.rs:58:5 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected type `FnOnce<(&Wrapper<'_>,)>` - found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-71955.rs:58:24 - | -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^ -note: the lifetime requirement is introduced here - --> $DIR/issue-71955.rs:34:44 - | -LL | F2: FnOnce(&<F1 as Parser>::Output) -> bool - | ^^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs index e991b74a0f8..e0a7aef2c5f 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs @@ -5,7 +5,7 @@ trait T {} trait MyTrait { async fn foo() -> &'static impl T; - //~^ ERROR the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough + //~^ ERROR the associated type `impl T` may not live long enough } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr index 15aa3cf54bb..19ffff9d3f2 100644 --- a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr +++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr @@ -1,10 +1,10 @@ -error[E0310]: the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough +error[E0310]: the associated type `impl T` may not live long enough --> $DIR/async-and-ret-ref.rs:7:5 | LL | async fn foo() -> &'static impl T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | the associated type `<Self as MyTrait>::{opaque#0}` must be valid for the static lifetime... + | the associated type `impl T` must be valid for the static lifetime... | ...so that the reference type `&'static impl T` does not outlive the data it points at error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr index baee1b5db6e..fc3efb44ac7 100644 --- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr +++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr @@ -6,11 +6,11 @@ LL | fn bar() -> () {} | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `Foo::{opaque#0}` +note: required by a bound in `Foo::{synthetic#0}` --> $DIR/doesnt-satisfy.rs:2:22 | LL | fn bar() -> impl std::fmt::Display; - | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}` + | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{synthetic#0}` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs index a36799c3ebd..ee9ecdda902 100644 --- a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs +++ b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.rs @@ -9,7 +9,7 @@ trait Erased { impl<T: Original> Erased for T { fn f(&self) -> Box<dyn Fn()> { Box::new(<T as Original>::f()) - //~^ ERROR the associated type `<T as Original>::{opaque#0}` may not live long enough + //~^ ERROR the associated type `impl Fn()` may not live long enough } } diff --git a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr index 5ec0ee38347..1f787c1842c 100644 --- a/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr +++ b/tests/ui/impl-trait/in-trait/missing-static-bound-from-impl.stderr @@ -1,10 +1,10 @@ -error[E0310]: the associated type `<T as Original>::{opaque#0}` may not live long enough +error[E0310]: the associated type `impl Fn()` may not live long enough --> $DIR/missing-static-bound-from-impl.rs:11:9 | LL | Box::new(<T as Original>::f()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | the associated type `<T as Original>::{opaque#0}` must be valid for the static lifetime... + | the associated type `impl Fn()` must be valid for the static lifetime... | ...so that the type `impl Fn()` will meet its required lifetime bounds error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/refine-normalize.rs b/tests/ui/impl-trait/in-trait/refine-normalize.rs new file mode 100644 index 00000000000..95f2cda6a74 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine-normalize.rs @@ -0,0 +1,20 @@ +//@ check-pass +//@ edition: 2021 +//@ revisions: current next +//@[next] compile-flags: -Znext-solver + +#![deny(refining_impl_trait)] + +pub trait Foo { + type Item; + + fn hello() -> impl Iterator<Item = Self::Item>; +} + +impl Foo for () { + type Item = (); + + fn hello() -> impl Iterator<Item = ()> { [()].into_iter() } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index 638de01f913..12725c3456f 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -5,11 +5,11 @@ LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { | ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>` | = help: the trait `Foo<char>` is implemented for `Bar` -note: required by a bound in `Foo::{opaque#0}` +note: required by a bound in `Foo::{synthetic#0}` --> $DIR/return-dont-satisfy-bounds.rs:2:30 | LL | fn foo<F2>(self) -> impl Foo<T>; - | ^^^^^^ required by this bound in `Foo::{opaque#0}` + | ^^^^^^ required by this bound in `Foo::{synthetic#0}` error[E0276]: impl has stricter requirements than trait --> $DIR/return-dont-satisfy-bounds.rs:8:16 diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.rs b/tests/ui/impl-trait/stashed-diag-issue-121504.rs new file mode 100644 index 00000000000..4ac8ffe8931 --- /dev/null +++ b/tests/ui/impl-trait/stashed-diag-issue-121504.rs @@ -0,0 +1,13 @@ +//@ edition: 2021 + +trait MyTrait { + async fn foo(self) -> (Self, i32); +} + +impl MyTrait for xyz::T { //~ ERROR failed to resolve: use of undeclared crate or module `xyz` + async fn foo(self, key: i32) -> (u32, i32) { + (self, key) + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.stderr b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr new file mode 100644 index 00000000000..6a881dc7f9f --- /dev/null +++ b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `xyz` + --> $DIR/stashed-diag-issue-121504.rs:7:18 + | +LL | impl MyTrait for xyz::T { + | ^^^ use of undeclared crate or module `xyz` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.rs b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.rs index 7f3817b326a..5e3d21eb26a 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.rs +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.rs @@ -10,7 +10,7 @@ pub trait MessageListenersInterface { impl<'a> MessageListenersInterface for MessageListeners<'a> { fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { - //~^ ERROR cannot infer an appropriate lifetime for lifetime parameter 'b in generic type due to conflicting requirements + //~^ ERROR in type `&'a MessageListeners<'_>`, reference has a longer lifetime than the data it references self } } diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr index 6a412eb5e4b..e0cf15d0d1f 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr @@ -1,27 +1,15 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'b in generic type due to conflicting requirements +error[E0491]: in type `&'a MessageListeners<'_>`, reference has a longer lifetime than the data it references --> $DIR/impl-implied-bounds-compatibility.rs:12:5 | LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'c` as defined here... - --> $DIR/impl-implied-bounds-compatibility.rs:12:5 - | -LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...so that the method type is compatible with trait - --> $DIR/impl-implied-bounds-compatibility.rs:12:5 - | -LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `fn(&'c MessageListeners<'_>) -> &'c MessageListeners<'c>` - found `fn(&MessageListeners<'_>) -> &'a MessageListeners<'_>` -note: but, the lifetime must be valid for the lifetime `'a` as defined here... +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/impl-implied-bounds-compatibility.rs:11:6 | LL | impl<'a> MessageListenersInterface for MessageListeners<'a> { | ^^ -note: ...so that the reference type `&'a MessageListeners<'_>` does not outlive the data it points at +note: but the referenced data is only valid for the lifetime `'c` as defined here --> $DIR/impl-implied-bounds-compatibility.rs:12:5 | LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { @@ -29,4 +17,4 @@ LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0491`. diff --git a/tests/ui/imports/auxiliary/import-alias-issue-121168-extern.rs b/tests/ui/imports/auxiliary/import-alias-issue-121168-extern.rs new file mode 100644 index 00000000000..a665eb8eb96 --- /dev/null +++ b/tests/ui/imports/auxiliary/import-alias-issue-121168-extern.rs @@ -0,0 +1 @@ +pub struct Foo<T>(pub core::ptr::NonNull<T>); diff --git a/tests/ui/imports/import-alias-issue-121168.edition2015.stderr b/tests/ui/imports/import-alias-issue-121168.edition2015.stderr new file mode 100644 index 00000000000..47001fc1a52 --- /dev/null +++ b/tests/ui/imports/import-alias-issue-121168.edition2015.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `Foo` in this scope + --> $DIR/import-alias-issue-121168.rs:11:12 + | +LL | let _: Foo<i32> = todo!(); + | ^^^ not found in this scope + | +help: consider importing this struct + | +LL + use nice_crate_name::Foo; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/imports/import-alias-issue-121168.edition2018.stderr b/tests/ui/imports/import-alias-issue-121168.edition2018.stderr new file mode 100644 index 00000000000..b61a0e3edd5 --- /dev/null +++ b/tests/ui/imports/import-alias-issue-121168.edition2018.stderr @@ -0,0 +1,16 @@ +error[E0412]: cannot find type `Foo` in this scope + --> $DIR/import-alias-issue-121168.rs:11:12 + | +LL | let _: Foo<i32> = todo!(); + | ^^^ not found in this scope + | +help: consider importing one of these items + | +LL + use crate::nice_crate_name::Foo; + | +LL + use import_alias_issue_121168_extern::Foo; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/imports/import-alias-issue-121168.edition2021.stderr b/tests/ui/imports/import-alias-issue-121168.edition2021.stderr new file mode 100644 index 00000000000..b61a0e3edd5 --- /dev/null +++ b/tests/ui/imports/import-alias-issue-121168.edition2021.stderr @@ -0,0 +1,16 @@ +error[E0412]: cannot find type `Foo` in this scope + --> $DIR/import-alias-issue-121168.rs:11:12 + | +LL | let _: Foo<i32> = todo!(); + | ^^^ not found in this scope + | +help: consider importing one of these items + | +LL + use crate::nice_crate_name::Foo; + | +LL + use import_alias_issue_121168_extern::Foo; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/imports/import-alias-issue-121168.rs b/tests/ui/imports/import-alias-issue-121168.rs new file mode 100644 index 00000000000..826a6765b03 --- /dev/null +++ b/tests/ui/imports/import-alias-issue-121168.rs @@ -0,0 +1,14 @@ +//@ revisions: edition2015 edition2018 edition2021 +//@ [edition2015] edition:2015 +//@ [edition2018] edition:2018 +//@ [edition2021] edition:2021 +//@ compile-flags: --extern import_alias_issue_121168_extern +//@ aux-build: import-alias-issue-121168-extern.rs + +extern crate import_alias_issue_121168_extern as nice_crate_name; + +fn use_foo_from_another_crate_without_importing_it_first() { + let _: Foo<i32> = todo!(); //~ ERROR cannot find type `Foo` in this scope +} + +fn main() {} diff --git a/tests/ui/imports/issue-52891.fixed b/tests/ui/imports/issue-52891.fixed index 9faef1703ac..0382960db2f 100644 --- a/tests/ui/imports/issue-52891.fixed +++ b/tests/ui/imports/issue-52891.fixed @@ -27,10 +27,8 @@ use issue_52891::{l, use issue_52891::a::inner; use issue_52891::b::inner as other_inner; //~ ERROR `inner` is defined multiple times - //~^ ERROR `issue_52891` is defined multiple times - #[macro_use] use issue_52891::n; //~ ERROR `n` is defined multiple times diff --git a/tests/ui/imports/unused-import-issue-87973.fixed b/tests/ui/imports/unused-import-issue-87973.fixed index 96508fa3ea2..d1167d7d486 100644 --- a/tests/ui/imports/unused-import-issue-87973.fixed +++ b/tests/ui/imports/unused-import-issue-87973.fixed @@ -2,7 +2,6 @@ #![deny(unused_imports)] // Check that attributes get removed too. See #87973. - //~^ ERROR unused import fn main() {} diff --git a/tests/ui/imports/unused-imports-in-test-module.stderr b/tests/ui/imports/unused-imports-in-test-module.stderr index 1598368eb32..2d885efc099 100644 --- a/tests/ui/imports/unused-imports-in-test-module.stderr +++ b/tests/ui/imports/unused-imports-in-test-module.stderr @@ -16,7 +16,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:8:1 | LL | mod test { @@ -28,7 +28,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:18:1 | LL | mod tests { @@ -40,7 +40,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:28:1 | LL | mod test_a { @@ -52,7 +52,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:38:1 | LL | mod a_test { @@ -64,7 +64,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:48:1 | LL | mod tests_a { @@ -76,7 +76,7 @@ error: unused import: `super::a` LL | use super::a; | ^^^^^^^^ | -help: consider adding a `#[cfg(test)]` to the containing module +help: if this is a test module, consider adding a `#[cfg(test)]` to the containing module --> $DIR/unused-imports-in-test-module.rs:58:1 | LL | mod a_tests { diff --git a/tests/ui/inference/stmts-as-exp-105431.rs b/tests/ui/inference/stmts-as-exp-105431.rs new file mode 100644 index 00000000000..b5adb4a2b66 --- /dev/null +++ b/tests/ui/inference/stmts-as-exp-105431.rs @@ -0,0 +1,76 @@ +#![allow(unused)] + +fn test_if() -> i32 { + let x = if true { + eprintln!("hello"); + 3; + } + else { + 4; + }; + x //~ ERROR mismatched types +} + +fn test_if_without_binding() -> i32 { + if true { //~ ERROR mismatched types + eprintln!("hello"); + 3; + } + else { //~ ERROR mismatched types + 4; + } +} + +fn test_match() -> i32 { + let v = 1; + let res = match v { + 1 => { 1; } + _ => { 2; } + }; + res //~ ERROR mismatched types +} + +fn test_match_match_without_binding() -> i32 { + let v = 1; + match v { + 1 => { 1; } //~ ERROR mismatched types + _ => { 2; } //~ ERROR mismatched types + } +} + +fn test_match_arm_different_types() -> i32 { + let v = 1; + let res = match v { + 1 => { if 1 < 2 { 1 } else { 2 } } + _ => { 2; } //~ ERROR `match` arms have incompatible types + }; + res +} + +fn test_if_match_mixed() -> i32 { + let x = if true { + 3; + } else { + match 1 { + 1 => { 1 } + _ => { 2 } + }; + }; + x //~ ERROR mismatched types +} + +fn test_if_match_mixed_failed() -> i32 { + let x = if true { + 3; + } else { + // because this is a tailed expr, so we won't check deeper + match 1 { + 1 => { 33; } + _ => { 44; } + } + }; + x //~ ERROR mismatched types +} + + +fn main() {} diff --git a/tests/ui/inference/stmts-as-exp-105431.stderr b/tests/ui/inference/stmts-as-exp-105431.stderr new file mode 100644 index 00000000000..f3da04b39a3 --- /dev/null +++ b/tests/ui/inference/stmts-as-exp-105431.stderr @@ -0,0 +1,129 @@ +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:11:5 + | +LL | fn test_if() -> i32 { + | --- expected `i32` because of return type +... +LL | x + | ^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 3; +LL + 3 + | +help: remove this semicolon to return this value + | +LL - 4; +LL + 4 + | + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:15:13 + | +LL | if true { + | _____________^ +LL | | eprintln!("hello"); +LL | | 3; + | | - help: remove this semicolon to return this value +LL | | } + | |_____^ expected `i32`, found `()` + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:19:10 + | +LL | else { + | __________^ +LL | | 4; + | | - help: remove this semicolon to return this value +LL | | } + | |_____^ expected `i32`, found `()` + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:30:5 + | +LL | fn test_match() -> i32 { + | --- expected `i32` because of return type +... +LL | res + | ^^^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 1 => { 1; } +LL + 1 => { 1 } + | +help: remove this semicolon to return this value + | +LL - _ => { 2; } +LL + _ => { 2 } + | + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:36:14 + | +LL | 1 => { 1; } + | ^^^-^^ + | | | + | | help: remove this semicolon to return this value + | expected `i32`, found `()` + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:37:14 + | +LL | _ => { 2; } + | ^^^-^^ + | | | + | | help: remove this semicolon to return this value + | expected `i32`, found `()` + +error[E0308]: `match` arms have incompatible types + --> $DIR/stmts-as-exp-105431.rs:45:16 + | +LL | let res = match v { + | _______________- +LL | | 1 => { if 1 < 2 { 1 } else { 2 } } + | | ------------------------- this is found to be of type `{integer}` +LL | | _ => { 2; } + | | ^- + | | || + | | |help: consider removing this semicolon + | | expected integer, found `()` +LL | | }; + | |_____- `match` arms have incompatible types + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:59:5 + | +LL | fn test_if_match_mixed() -> i32 { + | --- expected `i32` because of return type +... +LL | x + | ^ expected `i32`, found `()` + | +help: remove this semicolon to return this value + | +LL - 3; +LL + 3 + | +help: remove this semicolon to return this value + | +LL - }; +LL + } + | + +error[E0308]: mismatched types + --> $DIR/stmts-as-exp-105431.rs:72:5 + | +LL | fn test_if_match_mixed_failed() -> i32 { + | --- expected `i32` because of return type +LL | let x = if true { +LL | 3; + | - help: remove this semicolon to return this value +... +LL | x + | ^ expected `i32`, found `()` + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-1.migrate.stderr b/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-1.migrate.stderr deleted file mode 100644 index 2090530571b..00000000000 --- a/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-1.migrate.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-1.rs:11:9 - | -LL | || { - | - inferred to be a `FnMut` closure -LL | &mut x - | ^^^^^^ returns a reference to a captured variable which escapes the closure body - | - = note: `FnMut` closures only have access to their captured variables while they are executing... - = note: ...therefore, they cannot allow references to captured variables to escape - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-3.migrate.stderr b/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-3.migrate.stderr deleted file mode 100644 index 59aba4a8ef8..00000000000 --- a/tests/ui/issues/issue-40510-captured-variable-return/issue-40510-3.migrate.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-3.rs:11:9 - | -LL | || { - | - inferred to be a `FnMut` closure -LL | / || { -LL | | x.push(()) -LL | | } - | |_________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body - | - = note: `FnMut` closures only have access to their captured variables while they are executing... - = note: ...therefore, they cannot allow references to captured variables to escape - -error: aborting due to 1 previous error - diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr index 85e8061f173..80377bf6c20 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr +++ b/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr @@ -3,8 +3,6 @@ error[E0275]: overflow evaluating the requirement `Loop == _` | LL | impl Loop {} | ^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_impls_overflow`) error[E0392]: type parameter `T` is never used --> $DIR/inherent-impls-overflow.rs:13:12 diff --git a/tests/ui/lazy-type-alias/leading-where-clause.fixed b/tests/ui/lazy-type-alias/leading-where-clause.fixed index 885556c1efe..003eaa6c54e 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.fixed +++ b/tests/ui/lazy-type-alias/leading-where-clause.fixed @@ -2,14 +2,20 @@ #![feature(lazy_type_alias)] #![allow(incomplete_features)] +#![crate_type = "lib"] // Check that we *reject* leading where-clauses on lazy type aliases. -type Alias<T> - +pub type Leading0<T> = T where String: From<T>; -//~^^^ ERROR where clauses are not allowed before the type for type aliases -fn main() { - let _: Alias<&str>; -} +pub type Leading1<T, U> += (T, U) +where + U: Copy, String: From<T>; + +pub type EmptyLeading0 = () where; +//~^ ERROR where clauses are not allowed before the type for type aliases + +pub type EmptyLeading1<T> = T where T: Copy; +//~^ ERROR where clauses are not allowed before the type for type aliases diff --git a/tests/ui/lazy-type-alias/leading-where-clause.rs b/tests/ui/lazy-type-alias/leading-where-clause.rs index a0a09a2a08e..460f7e3a999 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.rs +++ b/tests/ui/lazy-type-alias/leading-where-clause.rs @@ -2,15 +2,24 @@ #![feature(lazy_type_alias)] #![allow(incomplete_features)] +#![crate_type = "lib"] // Check that we *reject* leading where-clauses on lazy type aliases. -type Alias<T> -where +pub type Leading0<T> +where //~ ERROR where clauses are not allowed before the type for type aliases String: From<T>, = T; -//~^^^ ERROR where clauses are not allowed before the type for type aliases -fn main() { - let _: Alias<&str>; -} +pub type Leading1<T, U> +where //~ ERROR where clauses are not allowed before the type for type aliases + String: From<T>, += (T, U) +where + U: Copy; + +pub type EmptyLeading0 where = (); +//~^ ERROR where clauses are not allowed before the type for type aliases + +pub type EmptyLeading1<T> where = T where T: Copy; +//~^ ERROR where clauses are not allowed before the type for type aliases diff --git a/tests/ui/lazy-type-alias/leading-where-clause.stderr b/tests/ui/lazy-type-alias/leading-where-clause.stderr index 6b0613787e8..344c318d0ef 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.stderr +++ b/tests/ui/lazy-type-alias/leading-where-clause.stderr @@ -1,5 +1,5 @@ error: where clauses are not allowed before the type for type aliases - --> $DIR/leading-where-clause.rs:9:1 + --> $DIR/leading-where-clause.rs:10:1 | LL | / where LL | | String: From<T>, @@ -12,5 +12,42 @@ LL + LL ~ = T where String: From<T>; | -error: aborting due to 1 previous error +error: where clauses are not allowed before the type for type aliases + --> $DIR/leading-where-clause.rs:15:1 + | +LL | / where +LL | | String: From<T>, + | |____________________^ + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information +help: move it to the end of the type declaration + | +LL + +LL | = (T, U) +LL | where +LL ~ U: Copy, String: From<T>; + | + +error: where clauses are not allowed before the type for type aliases + --> $DIR/leading-where-clause.rs:21:24 + | +LL | pub type EmptyLeading0 where = (); + | ^^^^^ + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information +help: move it to the end of the type declaration + | +LL - pub type EmptyLeading0 where = (); +LL + pub type EmptyLeading0 = () where; + | + +error: where clauses are not allowed before the type for type aliases + --> $DIR/leading-where-clause.rs:24:27 + | +LL | pub type EmptyLeading1<T> where = T where T: Copy; + | ^^^^^ help: remove this `where` + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information + +error: aborting due to 4 previous errors diff --git a/tests/ui/lint/suggestions.fixed b/tests/ui/lint/suggestions.fixed index b017438a8bd..66d097b121f 100644 --- a/tests/ui/lint/suggestions.fixed +++ b/tests/ui/lint/suggestions.fixed @@ -7,7 +7,6 @@ //~^ ERROR const items should never be `#[no_mangle]` //~| HELP try a static value - //~^ HELP remove this attribute pub fn defiant<T>(_t: T) {} //~^ WARN functions generic over types or consts must be mangled diff --git a/tests/ui/lint/unused/import_remove_line.fixed b/tests/ui/lint/unused/import_remove_line.fixed new file mode 100644 index 00000000000..45876cd4ebc --- /dev/null +++ b/tests/ui/lint/unused/import_remove_line.fixed @@ -0,0 +1,11 @@ +//@ run-rustfix +//@ check-pass + +#![crate_type = "lib"] +#![warn(unused_imports)] + +//~^ WARN unused imports +//~^ WARN unused import + +//~^ WARN unused import +//~| WARN unused import diff --git a/tests/ui/lint/unused/import_remove_line.rs b/tests/ui/lint/unused/import_remove_line.rs new file mode 100644 index 00000000000..fd45f04eb80 --- /dev/null +++ b/tests/ui/lint/unused/import_remove_line.rs @@ -0,0 +1,13 @@ +//@ run-rustfix +//@ check-pass + +#![crate_type = "lib"] +#![warn(unused_imports)] + +use std::time::{Duration, Instant}; +//~^ WARN unused imports +use std::time::SystemTime; +//~^ WARN unused import +use std::time::SystemTimeError;use std::time::TryFromFloatSecsError; +//~^ WARN unused import +//~| WARN unused import diff --git a/tests/ui/lint/unused/import_remove_line.stderr b/tests/ui/lint/unused/import_remove_line.stderr new file mode 100644 index 00000000000..0e8c5de3558 --- /dev/null +++ b/tests/ui/lint/unused/import_remove_line.stderr @@ -0,0 +1,32 @@ +warning: unused imports: `Duration`, `Instant` + --> $DIR/import_remove_line.rs:7:17 + | +LL | use std::time::{Duration, Instant}; + | ^^^^^^^^ ^^^^^^^ + | +note: the lint level is defined here + --> $DIR/import_remove_line.rs:5:9 + | +LL | #![warn(unused_imports)] + | ^^^^^^^^^^^^^^ + +warning: unused import: `std::time::SystemTime` + --> $DIR/import_remove_line.rs:9:5 + | +LL | use std::time::SystemTime; + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `std::time::SystemTimeError` + --> $DIR/import_remove_line.rs:11:5 + | +LL | use std::time::SystemTimeError;use std::time::TryFromFloatSecsError; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `std::time::TryFromFloatSecsError` + --> $DIR/import_remove_line.rs:11:36 + | +LL | use std::time::SystemTimeError;use std::time::TryFromFloatSecsError; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 4 warnings emitted + diff --git a/tests/ui/lowering/issue-121108.rs b/tests/ui/lowering/issue-121108.rs index 6b2dd24e4a8..6dfb7e00821 100644 --- a/tests/ui/lowering/issue-121108.rs +++ b/tests/ui/lowering/issue-121108.rs @@ -3,7 +3,7 @@ use std::ptr::addr_of; const UNINHABITED_VARIANT: () = unsafe { - let v = *addr_of!(data).cast(); //~ ERROR cannot determine resolution for the macro `addr_of` + let v = *addr_of!(data).cast(); }; fn main() {} diff --git a/tests/ui/lowering/issue-121108.stderr b/tests/ui/lowering/issue-121108.stderr index c2c5746d6f1..e4942e8cb07 100644 --- a/tests/ui/lowering/issue-121108.stderr +++ b/tests/ui/lowering/issue-121108.stderr @@ -13,13 +13,5 @@ LL - #![derive(Clone, Copy)] LL + #[derive(Clone, Copy)] | -error: cannot determine resolution for the macro `addr_of` - --> $DIR/issue-121108.rs:6:14 - | -LL | let v = *addr_of!(data).cast(); - | ^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/lub-glb/old-lub-glb-hr-eq.rs b/tests/ui/lub-glb/old-lub-glb-hr-eq.rs index 97062ec91af..df288793608 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-eq.rs +++ b/tests/ui/lub-glb/old-lub-glb-hr-eq.rs @@ -3,8 +3,6 @@ // error. However, now that we handle subtyping correctly, we no // longer get an error, because we recognize these two types as // equivalent! -// -//@ check-pass fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { // The two types above are actually equivalent. With the older @@ -13,6 +11,7 @@ fn foo(x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8)) { let z = match 22 { 0 => x, _ => y, + //~^ ERROR `match` arms have incompatible types [E0308] }; } diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-eq.stderr index 0d1f9a7690f..ea8e53f2460 100644 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr +++ b/tests/ui/lub-glb/old-lub-glb-hr-eq.stderr @@ -1,20 +1,18 @@ error[E0308]: `match` arms have incompatible types - --> $DIR/old-lub-glb-hr-noteq1.rs:17:14 + --> $DIR/old-lub-glb-hr-eq.rs:13:14 | LL | let z = match 22 { | _____________- LL | | 0 => x, - | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` + | | - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8)` LL | | _ => y, | | ^ one type is more general than the other LL | | -... | -LL | | LL | | }; | |_____- `match` arms have incompatible types | - = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` - found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` + = note: expected fn pointer `for<'a, 'b> fn(&'a _, &'b _)` + found fn pointer `for<'a> fn(&'a _, &'a _)` error: aborting due to 1 previous error diff --git a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr b/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr deleted file mode 100644 index 83962653569..00000000000 --- a/tests/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/old-lub-glb-hr-noteq1.rs:17:14 - | -LL | _ => y, - | ^ one type is more general than the other - | - = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` - found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs index 039ca1fb58d..52b983cd12f 100644 --- a/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs +++ b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs @@ -6,7 +6,6 @@ // another -- effectively, the single lifetime `'a` is just inferred // to be the intersection of the two distinct lifetimes. // -//@ check-pass //@ compile-flags:-Zno-leak-check use std::cell::Cell; @@ -17,7 +16,9 @@ fn make_cell_aa() -> Cell<for<'a> fn(&'a u32, &'a u32)> { fn aa_eq_ab() { let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa(); + //~^ ERROR mismatched types [E0308] + //~| ERROR mismatched types [E0308] drop(a); } -fn main() { } +fn main() {} diff --git a/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr new file mode 100644 index 00000000000..9a88ce8756c --- /dev/null +++ b/tests/ui/nll/relate_tys/hr-fn-aau-eq-abu.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/hr-fn-aau-eq-abu.rs:18:53 + | +LL | let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa(); + | ^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Cell<for<'a, 'b> fn(&'a _, &'b _)>` + found struct `Cell<for<'a> fn(&'a _, &'a _)>` + +error[E0308]: mismatched types + --> $DIR/hr-fn-aau-eq-abu.rs:18:53 + | +LL | let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa(); + | ^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Cell<for<'a, 'b> fn(&'a _, &'b _)>` + found struct `Cell<for<'a> fn(&'a _, &'a _)>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/f16-f128.rs b/tests/ui/parser/f16-f128.rs new file mode 100644 index 00000000000..4f31dccce3c --- /dev/null +++ b/tests/ui/parser/f16-f128.rs @@ -0,0 +1,37 @@ +// Make sure we don't ICE while incrementally adding f16 and f128 support + +mod f16_checks { + const A: f16 = 10.0; //~ ERROR cannot find type `f16` in this scope + + pub fn main() { + let a: f16 = 100.0; //~ ERROR cannot find type `f16` in this scope + let b = 0.0f16; //~ ERROR invalid width `16` for float literal + + foo(1.23); + } + + fn foo(a: f16) {} //~ ERROR cannot find type `f16` in this scope + + struct Bar { + a: f16, //~ ERROR cannot find type `f16` in this scope + } +} + +mod f128_checks { + const A: f128 = 10.0; //~ ERROR cannot find type `f128` in this scope + + pub fn main() { + let a: f128 = 100.0; //~ ERROR cannot find type `f128` in this scope + let b = 0.0f128; //~ ERROR invalid width `128` for float literal + + foo(1.23); + } + + fn foo(a: f128) {} //~ ERROR cannot find type `f128` in this scope + + struct Bar { + a: f128, //~ ERROR cannot find type `f128` in this scope + } +} + +fn main() {} diff --git a/tests/ui/parser/f16-f128.stderr b/tests/ui/parser/f16-f128.stderr new file mode 100644 index 00000000000..d3f2227acd7 --- /dev/null +++ b/tests/ui/parser/f16-f128.stderr @@ -0,0 +1,67 @@ +error[E0412]: cannot find type `f16` in this scope + --> $DIR/f16-f128.rs:4:14 + | +LL | const A: f16 = 10.0; + | ^^^ help: a builtin type with a similar name exists: `i16` + +error[E0412]: cannot find type `f16` in this scope + --> $DIR/f16-f128.rs:7:16 + | +LL | let a: f16 = 100.0; + | ^^^ help: a builtin type with a similar name exists: `i16` + +error[E0412]: cannot find type `f16` in this scope + --> $DIR/f16-f128.rs:13:15 + | +LL | fn foo(a: f16) {} + | ^^^ help: a builtin type with a similar name exists: `i16` + +error[E0412]: cannot find type `f16` in this scope + --> $DIR/f16-f128.rs:16:12 + | +LL | a: f16, + | ^^^ help: a builtin type with a similar name exists: `i16` + +error[E0412]: cannot find type `f128` in this scope + --> $DIR/f16-f128.rs:21:14 + | +LL | const A: f128 = 10.0; + | ^^^^ help: a builtin type with a similar name exists: `i128` + +error[E0412]: cannot find type `f128` in this scope + --> $DIR/f16-f128.rs:24:16 + | +LL | let a: f128 = 100.0; + | ^^^^ help: a builtin type with a similar name exists: `i128` + +error[E0412]: cannot find type `f128` in this scope + --> $DIR/f16-f128.rs:30:15 + | +LL | fn foo(a: f128) {} + | ^^^^ help: a builtin type with a similar name exists: `i128` + +error[E0412]: cannot find type `f128` in this scope + --> $DIR/f16-f128.rs:33:12 + | +LL | a: f128, + | ^^^^ help: a builtin type with a similar name exists: `i128` + +error: invalid width `16` for float literal + --> $DIR/f16-f128.rs:8:17 + | +LL | let b = 0.0f16; + | ^^^^^^ + | + = help: valid widths are 32 and 64 + +error: invalid width `128` for float literal + --> $DIR/f16-f128.rs:25:17 + | +LL | let b = 0.0f128; + | ^^^^^^^ + | + = help: valid widths are 32 and 64 + +error: aborting due to 10 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/float-field.rs b/tests/ui/parser/float-field.rs index eaa7465dc4d..59fefee26aa 100644 --- a/tests/ui/parser/float-field.rs +++ b/tests/ui/parser/float-field.rs @@ -3,60 +3,91 @@ struct S(u8, (u8, u8)); fn main() { let s = S(0, (0, 0)); - s.1e1; //~ ERROR no field `1e1` on type `S` - s.1.; //~ ERROR unexpected token: `;` - s.1.1; - s.1.1e1; //~ ERROR no field `1e1` on type `(u8, u8)` + { s.1e1; } //~ ERROR no field `1e1` on type `S` + + { s.1.; } //~ ERROR unexpected token: `;` + + { s.1.1; } + + { s.1.1e1; } //~ ERROR no field `1e1` on type `(u8, u8)` + { s.1e+; } //~ ERROR unexpected token: `1e+` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+` //~| ERROR expected at least one digit in exponent + { s.1e-; } //~ ERROR unexpected token: `1e-` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-` //~| ERROR expected at least one digit in exponent + { s.1e+1; } //~ ERROR unexpected token: `1e+1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+1` + { s.1e-1; } //~ ERROR unexpected token: `1e-1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-1` + { s.1.1e+1; } //~ ERROR unexpected token: `1.1e+1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e+1` + { s.1.1e-1; } //~ ERROR unexpected token: `1.1e-1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e-1` - s.0x1e1; //~ ERROR no field `0x1e1` on type `S` - s.0x1.; //~ ERROR no field `0x1` on type `S` - //~| ERROR hexadecimal float literal is not supported - //~| ERROR unexpected token: `;` - s.0x1.1; //~ ERROR no field `0x1` on type `S` - //~| ERROR hexadecimal float literal is not supported - s.0x1.1e1; //~ ERROR no field `0x1` on type `S` - //~| ERROR hexadecimal float literal is not supported + + { s.0x1e1; } //~ ERROR no field `0x1e1` on type `S` + + { s.0x1.; } //~ ERROR hexadecimal float literal is not supported + //~| ERROR unexpected token: `0x1.` + //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.` + + { s.0x1.1; } //~ ERROR hexadecimal float literal is not supported + //~| ERROR unexpected token: `0x1.1` + //~| expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1` + + { s.0x1.1e1; } //~ ERROR hexadecimal float literal is not supported + //~| ERROR unexpected token: `0x1.1e1` + //~| expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e1` + { s.0x1e+; } //~ ERROR expected expression, found `;` + { s.0x1e-; } //~ ERROR expected expression, found `;` - s.0x1e+1; //~ ERROR no field `0x1e` on type `S` - s.0x1e-1; //~ ERROR no field `0x1e` on type `S` + + { s.0x1e+1; } //~ ERROR no field `0x1e` on type `S` + + { s.0x1e-1; } //~ ERROR no field `0x1e` on type `S` + { s.0x1.1e+1; } //~ ERROR unexpected token: `0x1.1e+1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e+1` //~| ERROR hexadecimal float literal is not supported + { s.0x1.1e-1; } //~ ERROR unexpected token: `0x1.1e-1` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e-1` //~| ERROR hexadecimal float literal is not supported - s.1e1f32; //~ ERROR no field `1e1` on type `S` - //~| ERROR suffixes on a tuple index are invalid - s.1.f32; //~ ERROR no field `f32` on type `(u8, u8)` - s.1.1f32; //~ ERROR suffixes on a tuple index are invalid - s.1.1e1f32; //~ ERROR no field `1e1` on type `(u8, u8)` - //~| ERROR suffixes on a tuple index are invalid + + { s.1e1f32; } //~ ERROR no field `1e1` on type `S` + //~| ERROR suffixes on a tuple index are invalid + + { s.1.f32; } //~ ERROR no field `f32` on type `(u8, u8)` + + { s.1.1f32; } //~ ERROR suffixes on a tuple index are invalid + + { s.1.1e1f32; } //~ ERROR no field `1e1` on type `(u8, u8)` + //~| ERROR suffixes on a tuple index are invalid + { s.1e+f32; } //~ ERROR unexpected token: `1e+f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+f32` //~| ERROR expected at least one digit in exponent + { s.1e-f32; } //~ ERROR unexpected token: `1e-f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-f32` //~| ERROR expected at least one digit in exponent + { s.1e+1f32; } //~ ERROR unexpected token: `1e+1f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+1f32` + { s.1e-1f32; } //~ ERROR unexpected token: `1e-1f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-1f32` + { s.1.1e+1f32; } //~ ERROR unexpected token: `1.1e+1f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e+1f32` + { s.1.1e-1f32; } //~ ERROR unexpected token: `1.1e-1f32` //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e-1f32` } diff --git a/tests/ui/parser/float-field.stderr b/tests/ui/parser/float-field.stderr index d67d270ef7b..0cc1b0767dc 100644 --- a/tests/ui/parser/float-field.stderr +++ b/tests/ui/parser/float-field.stderr @@ -1,349 +1,355 @@ error: expected at least one digit in exponent - --> $DIR/float-field.rs:10:9 + --> $DIR/float-field.rs:14:9 | LL | { s.1e+; } | ^^^ error: expected at least one digit in exponent - --> $DIR/float-field.rs:13:9 + --> $DIR/float-field.rs:18:9 | LL | { s.1e-; } | ^^^ error: hexadecimal float literal is not supported - --> $DIR/float-field.rs:25:7 + --> $DIR/float-field.rs:36:9 | -LL | s.0x1.; - | ^^^^ +LL | { s.0x1.; } + | ^^^^ error: hexadecimal float literal is not supported - --> $DIR/float-field.rs:28:7 + --> $DIR/float-field.rs:40:9 | -LL | s.0x1.1; - | ^^^^^ +LL | { s.0x1.1; } + | ^^^^^ error: hexadecimal float literal is not supported - --> $DIR/float-field.rs:30:7 + --> $DIR/float-field.rs:44:9 | -LL | s.0x1.1e1; - | ^^^^^^^ +LL | { s.0x1.1e1; } + | ^^^^^^^ error: hexadecimal float literal is not supported - --> $DIR/float-field.rs:36:9 + --> $DIR/float-field.rs:56:9 | LL | { s.0x1.1e+1; } | ^^^^^^^^ error: hexadecimal float literal is not supported - --> $DIR/float-field.rs:39:9 + --> $DIR/float-field.rs:60:9 | LL | { s.0x1.1e-1; } | ^^^^^^^^ error: expected at least one digit in exponent - --> $DIR/float-field.rs:48:9 + --> $DIR/float-field.rs:74:9 | LL | { s.1e+f32; } | ^^^^^^ error: expected at least one digit in exponent - --> $DIR/float-field.rs:51:9 + --> $DIR/float-field.rs:78:9 | LL | { s.1e-f32; } | ^^^^^^ error: unexpected token: `;` - --> $DIR/float-field.rs:7:9 + --> $DIR/float-field.rs:8:11 | -LL | s.1.; - | ^ +LL | { s.1.; } + | ^ error: unexpected token: `1e+` - --> $DIR/float-field.rs:10:9 + --> $DIR/float-field.rs:14:9 | LL | { s.1e+; } | ^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+` - --> $DIR/float-field.rs:10:9 + --> $DIR/float-field.rs:14:9 | LL | { s.1e+; } | ^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e-` - --> $DIR/float-field.rs:13:9 + --> $DIR/float-field.rs:18:9 | LL | { s.1e-; } | ^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-` - --> $DIR/float-field.rs:13:9 + --> $DIR/float-field.rs:18:9 | LL | { s.1e-; } | ^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e+1` - --> $DIR/float-field.rs:16:9 + --> $DIR/float-field.rs:22:9 | LL | { s.1e+1; } | ^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+1` - --> $DIR/float-field.rs:16:9 + --> $DIR/float-field.rs:22:9 | LL | { s.1e+1; } | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e-1` - --> $DIR/float-field.rs:18:9 + --> $DIR/float-field.rs:25:9 | LL | { s.1e-1; } | ^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-1` - --> $DIR/float-field.rs:18:9 + --> $DIR/float-field.rs:25:9 | LL | { s.1e-1; } | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1.1e+1` - --> $DIR/float-field.rs:20:9 + --> $DIR/float-field.rs:28:9 | LL | { s.1.1e+1; } | ^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e+1` - --> $DIR/float-field.rs:20:9 + --> $DIR/float-field.rs:28:9 | LL | { s.1.1e+1; } | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1.1e-1` - --> $DIR/float-field.rs:22:9 + --> $DIR/float-field.rs:31:9 | LL | { s.1.1e-1; } | ^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e-1` - --> $DIR/float-field.rs:22:9 + --> $DIR/float-field.rs:31:9 | LL | { s.1.1e-1; } | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator -error: unexpected token: `;` - --> $DIR/float-field.rs:25:11 +error: unexpected token: `0x1.` + --> $DIR/float-field.rs:36:9 | -LL | s.0x1.; - | ^ +LL | { s.0x1.; } + | ^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.` + --> $DIR/float-field.rs:36:9 + | +LL | { s.0x1.; } + | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: unexpected token: `0x1.1` + --> $DIR/float-field.rs:40:9 + | +LL | { s.0x1.1; } + | ^^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1` + --> $DIR/float-field.rs:40:9 + | +LL | { s.0x1.1; } + | ^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: unexpected token: `0x1.1e1` + --> $DIR/float-field.rs:44:9 + | +LL | { s.0x1.1e1; } + | ^^^^^^^ + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e1` + --> $DIR/float-field.rs:44:9 + | +LL | { s.0x1.1e1; } + | ^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: expected expression, found `;` - --> $DIR/float-field.rs:32:14 + --> $DIR/float-field.rs:48:14 | LL | { s.0x1e+; } | ^ expected expression error: expected expression, found `;` - --> $DIR/float-field.rs:33:14 + --> $DIR/float-field.rs:50:14 | LL | { s.0x1e-; } | ^ expected expression error: unexpected token: `0x1.1e+1` - --> $DIR/float-field.rs:36:9 + --> $DIR/float-field.rs:56:9 | LL | { s.0x1.1e+1; } | ^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e+1` - --> $DIR/float-field.rs:36:9 + --> $DIR/float-field.rs:56:9 | LL | { s.0x1.1e+1; } | ^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `0x1.1e-1` - --> $DIR/float-field.rs:39:9 + --> $DIR/float-field.rs:60:9 | LL | { s.0x1.1e-1; } | ^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e-1` - --> $DIR/float-field.rs:39:9 + --> $DIR/float-field.rs:60:9 | LL | { s.0x1.1e-1; } | ^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: suffixes on a tuple index are invalid - --> $DIR/float-field.rs:42:7 + --> $DIR/float-field.rs:64:9 | -LL | s.1e1f32; - | ^^^^^^ invalid suffix `f32` +LL | { s.1e1f32; } + | ^^^^^^ invalid suffix `f32` error: suffixes on a tuple index are invalid - --> $DIR/float-field.rs:45:7 + --> $DIR/float-field.rs:69:9 | -LL | s.1.1f32; - | ^^^^^^ invalid suffix `f32` +LL | { s.1.1f32; } + | ^^^^^^ invalid suffix `f32` error: suffixes on a tuple index are invalid - --> $DIR/float-field.rs:46:7 + --> $DIR/float-field.rs:71:9 | -LL | s.1.1e1f32; - | ^^^^^^^^ invalid suffix `f32` +LL | { s.1.1e1f32; } + | ^^^^^^^^ invalid suffix `f32` error: unexpected token: `1e+f32` - --> $DIR/float-field.rs:48:9 + --> $DIR/float-field.rs:74:9 | LL | { s.1e+f32; } | ^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+f32` - --> $DIR/float-field.rs:48:9 + --> $DIR/float-field.rs:74:9 | LL | { s.1e+f32; } | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e-f32` - --> $DIR/float-field.rs:51:9 + --> $DIR/float-field.rs:78:9 | LL | { s.1e-f32; } | ^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-f32` - --> $DIR/float-field.rs:51:9 + --> $DIR/float-field.rs:78:9 | LL | { s.1e-f32; } | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e+1f32` - --> $DIR/float-field.rs:54:9 + --> $DIR/float-field.rs:82:9 | LL | { s.1e+1f32; } | ^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e+1f32` - --> $DIR/float-field.rs:54:9 + --> $DIR/float-field.rs:82:9 | LL | { s.1e+1f32; } | ^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1e-1f32` - --> $DIR/float-field.rs:56:9 + --> $DIR/float-field.rs:85:9 | LL | { s.1e-1f32; } | ^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1e-1f32` - --> $DIR/float-field.rs:56:9 + --> $DIR/float-field.rs:85:9 | LL | { s.1e-1f32; } | ^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1.1e+1f32` - --> $DIR/float-field.rs:58:9 + --> $DIR/float-field.rs:88:9 | LL | { s.1.1e+1f32; } | ^^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e+1f32` - --> $DIR/float-field.rs:58:9 + --> $DIR/float-field.rs:88:9 | LL | { s.1.1e+1f32; } | ^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error: unexpected token: `1.1e-1f32` - --> $DIR/float-field.rs:60:9 + --> $DIR/float-field.rs:91:9 | LL | { s.1.1e-1f32; } | ^^^^^^^^^ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1e-1f32` - --> $DIR/float-field.rs:60:9 + --> $DIR/float-field.rs:91:9 | LL | { s.1.1e-1f32; } | ^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator error[E0609]: no field `1e1` on type `S` - --> $DIR/float-field.rs:6:7 + --> $DIR/float-field.rs:6:9 | -LL | s.1e1; - | ^^^ unknown field +LL | { s.1e1; } + | ^^^ unknown field | = note: available fields are: `0`, `1` error[E0609]: no field `1e1` on type `(u8, u8)` - --> $DIR/float-field.rs:9:9 + --> $DIR/float-field.rs:12:11 | -LL | s.1.1e1; - | ^^^ unknown field +LL | { s.1.1e1; } + | ^^^ unknown field error[E0609]: no field `0x1e1` on type `S` - --> $DIR/float-field.rs:24:7 - | -LL | s.0x1e1; - | ^^^^^ unknown field - | - = note: available fields are: `0`, `1` - -error[E0609]: no field `0x1` on type `S` - --> $DIR/float-field.rs:25:7 - | -LL | s.0x1.; - | ^^^ unknown field - | - = note: available fields are: `0`, `1` - -error[E0609]: no field `0x1` on type `S` - --> $DIR/float-field.rs:28:7 - | -LL | s.0x1.1; - | ^^^ unknown field - | - = note: available fields are: `0`, `1` - -error[E0609]: no field `0x1` on type `S` - --> $DIR/float-field.rs:30:7 + --> $DIR/float-field.rs:34:9 | -LL | s.0x1.1e1; - | ^^^ unknown field +LL | { s.0x1e1; } + | ^^^^^ unknown field | = note: available fields are: `0`, `1` error[E0609]: no field `0x1e` on type `S` - --> $DIR/float-field.rs:34:7 + --> $DIR/float-field.rs:52:9 | -LL | s.0x1e+1; - | ^^^^ unknown field +LL | { s.0x1e+1; } + | ^^^^ unknown field | = note: available fields are: `0`, `1` error[E0609]: no field `0x1e` on type `S` - --> $DIR/float-field.rs:35:7 + --> $DIR/float-field.rs:54:9 | -LL | s.0x1e-1; - | ^^^^ unknown field +LL | { s.0x1e-1; } + | ^^^^ unknown field | = note: available fields are: `0`, `1` error[E0609]: no field `1e1` on type `S` - --> $DIR/float-field.rs:42:7 + --> $DIR/float-field.rs:64:9 | -LL | s.1e1f32; - | ^^^^^^ unknown field +LL | { s.1e1f32; } + | ^^^^^^ unknown field | = note: available fields are: `0`, `1` error[E0609]: no field `f32` on type `(u8, u8)` - --> $DIR/float-field.rs:44:9 + --> $DIR/float-field.rs:67:11 | -LL | s.1.f32; - | ^^^ unknown field +LL | { s.1.f32; } + | ^^^ unknown field error[E0609]: no field `1e1` on type `(u8, u8)` - --> $DIR/float-field.rs:46:7 + --> $DIR/float-field.rs:71:9 | -LL | s.1.1e1f32; - | ^^^^^^^^ unknown field +LL | { s.1.1e1f32; } + | ^^^^^^^^ unknown field -error: aborting due to 55 previous errors +error: aborting due to 57 previous errors For more information about this error, try `rustc --explain E0609`. diff --git a/tests/ui/repr/invalid_repr_list_help.rs b/tests/ui/repr/invalid_repr_list_help.rs index 785ffb1e0f4..77f2a68537b 100644 --- a/tests/ui/repr/invalid_repr_list_help.rs +++ b/tests/ui/repr/invalid_repr_list_help.rs @@ -17,6 +17,5 @@ pub enum OwO4 { } #[repr(uwu)] //~ERROR: unrecognized representation hint -#[doc(owo)] //~WARN: unknown `doc` attribute - //~^ WARN: this was previously +#[doc(owo)] //~ERROR: unknown `doc` attribute pub struct Owo5; diff --git a/tests/ui/repr/invalid_repr_list_help.stderr b/tests/ui/repr/invalid_repr_list_help.stderr index 7ffe1287eb3..e87cbd37a99 100644 --- a/tests/ui/repr/invalid_repr_list_help.stderr +++ b/tests/ui/repr/invalid_repr_list_help.stderr @@ -30,15 +30,13 @@ LL | #[repr(uwu, u8)] | = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` -warning: unknown `doc` attribute `owo` +error: unknown `doc` attribute `owo` --> $DIR/invalid_repr_list_help.rs:20:7 | LL | #[doc(owo)] | ^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> - = note: `#[warn(invalid_doc_attributes)]` on by default + = note: `#[deny(invalid_doc_attributes)]` on by default error[E0552]: unrecognized representation hint --> $DIR/invalid_repr_list_help.rs:19:8 @@ -48,6 +46,6 @@ LL | #[repr(uwu)] | = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize` -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0552`. diff --git a/tests/ui/resolve/issue-111312.rs b/tests/ui/resolve/issue-111312.rs index 68fc8573dde..79c6f67dadd 100644 --- a/tests/ui/resolve/issue-111312.rs +++ b/tests/ui/resolve/issue-111312.rs @@ -7,5 +7,7 @@ trait Has { trait HasNot {} fn main() { - HasNot::has(); //~ ERROR + HasNot::has(); + //~^ ERROR trait objects must include the `dyn` keyword + //~| ERROR no function or associated item named `has` found for trait `HasNot` } diff --git a/tests/ui/resolve/issue-111312.stderr b/tests/ui/resolve/issue-111312.stderr index 7e7ef22ae61..431802ead30 100644 --- a/tests/ui/resolve/issue-111312.stderr +++ b/tests/ui/resolve/issue-111312.stderr @@ -1,3 +1,14 @@ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/issue-111312.rs:10:5 + | +LL | HasNot::has(); + | ^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | <dyn HasNot>::has(); + | ++++ + + error[E0599]: no function or associated item named `has` found for trait `HasNot` --> $DIR/issue-111312.rs:10:13 | @@ -10,6 +21,7 @@ note: `Has` defines an item `has` LL | trait Has { | ^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0599, E0782. +For more information about an error, try `rustc --explain E0599`. diff --git a/tests/ui/resolve/issue-111727.rs b/tests/ui/resolve/issue-111727.rs index 740037fe434..fcab924b809 100644 --- a/tests/ui/resolve/issue-111727.rs +++ b/tests/ui/resolve/issue-111727.rs @@ -1,5 +1,7 @@ //@ edition: 2021 fn main() { - std::any::Any::create(); //~ ERROR + std::any::Any::create(); + //~^ ERROR trait objects must include the `dyn` keyword + //~| ERROR no function or associated item named `create` found for trait `Any` } diff --git a/tests/ui/resolve/issue-111727.stderr b/tests/ui/resolve/issue-111727.stderr index b58168d0e75..1ef5a1a1d5e 100644 --- a/tests/ui/resolve/issue-111727.stderr +++ b/tests/ui/resolve/issue-111727.stderr @@ -1,9 +1,21 @@ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/issue-111727.rs:4:5 + | +LL | std::any::Any::create(); + | ^^^^^^^^^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | <dyn std::any::Any>::create(); + | ++++ + + error[E0599]: no function or associated item named `create` found for trait `Any` --> $DIR/issue-111727.rs:4:20 | LL | std::any::Any::create(); | ^^^^^^ function or associated item not found in `Any` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0599, E0782. +For more information about an error, try `rustc --explain E0599`. diff --git a/tests/ui/resolve/resolve-conflict-import-vs-import.fixed b/tests/ui/resolve/resolve-conflict-import-vs-import.fixed index 2ebf2a194b8..d981d629c46 100644 --- a/tests/ui/resolve/resolve-conflict-import-vs-import.fixed +++ b/tests/ui/resolve/resolve-conflict-import-vs-import.fixed @@ -2,7 +2,6 @@ #[allow(unused_imports)] use std::mem::transmute; - //~^ ERROR the name `transmute` is defined multiple times fn main() { diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr index 3fbbfd0fd0d..b17700ec632 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Something: Termination` is not satisfied LL | fn main() -> Something { | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` | -note: required by a bound in `Main::{opaque#0}` +note: required by a bound in `Main::{synthetic#0}` --> $DIR/issue-103052-2.rs:5:27 | LL | fn main() -> impl std::process::Termination; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{synthetic#0}` error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed index fcab56ac819..ca8422c03a3 100644 --- a/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed +++ b/tests/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed @@ -9,7 +9,6 @@ #![deny(rust_2018_idioms)] #![allow(dead_code)] - //~^ ERROR unused extern crate // Shouldn't suggest changing to `use`, as `bar` diff --git a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed index 2625cdc8b48..75b3918be1d 100644 --- a/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed +++ b/tests/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed @@ -8,7 +8,6 @@ // The suggestion span should include the attribute. - //~^ ERROR unused extern crate fn main() {} diff --git a/tests/ui/rustdoc/deny-invalid-doc-attrs.rs b/tests/ui/rustdoc/deny-invalid-doc-attrs.rs index 02e9c67915f..15bfd723424 100644 --- a/tests/ui/rustdoc/deny-invalid-doc-attrs.rs +++ b/tests/ui/rustdoc/deny-invalid-doc-attrs.rs @@ -2,6 +2,4 @@ //~^ NOTE defined here #![doc(x)] //~^ ERROR unknown `doc` attribute `x` -//~| WARNING will become a hard error -//~| NOTE see issue #82730 fn main() {} diff --git a/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr b/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr index bf104f48be0..0884e9c8bb2 100644 --- a/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr +++ b/tests/ui/rustdoc/deny-invalid-doc-attrs.stderr @@ -4,8 +4,6 @@ error: unknown `doc` attribute `x` LL | #![doc(x)] | ^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> note: the lint level is defined here --> $DIR/deny-invalid-doc-attrs.rs:1:9 | diff --git a/tests/ui/rustdoc/doc-primitive.rs b/tests/ui/rustdoc/doc-primitive.rs index 4336961e3b5..fbb1e1bc1fa 100644 --- a/tests/ui/rustdoc/doc-primitive.rs +++ b/tests/ui/rustdoc/doc-primitive.rs @@ -2,7 +2,6 @@ #[doc(primitive = "foo")] //~^ ERROR unknown `doc` attribute `primitive` -//~| WARN mod bar {} fn main() {} diff --git a/tests/ui/rustdoc/doc-primitive.stderr b/tests/ui/rustdoc/doc-primitive.stderr index 5f535206d26..8f6f330b3e5 100644 --- a/tests/ui/rustdoc/doc-primitive.stderr +++ b/tests/ui/rustdoc/doc-primitive.stderr @@ -4,8 +4,6 @@ error: unknown `doc` attribute `primitive` LL | #[doc(primitive = "foo")] | ^^^^^^^^^^^^^^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> note: the lint level is defined here --> $DIR/doc-primitive.rs:1:9 | diff --git a/tests/ui/rustdoc/doc-test-attr.rs b/tests/ui/rustdoc/doc-test-attr.rs index 46178ad865a..fb3db6a80fa 100644 --- a/tests/ui/rustdoc/doc-test-attr.rs +++ b/tests/ui/rustdoc/doc-test-attr.rs @@ -3,12 +3,9 @@ #![doc(test)] //~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler #![doc(test = "hello")] //~^ ERROR `#[doc(test(...)]` takes a list of attributes -//~^^ WARN this was previously accepted by the compiler #![doc(test(a))] //~^ ERROR unknown `doc(test)` attribute `a` -//~^^ WARN this was previously accepted by the compiler pub fn foo() {} diff --git a/tests/ui/rustdoc/doc-test-attr.stderr b/tests/ui/rustdoc/doc-test-attr.stderr index 5e6014954a4..51672314a43 100644 --- a/tests/ui/rustdoc/doc-test-attr.stderr +++ b/tests/ui/rustdoc/doc-test-attr.stderr @@ -4,8 +4,6 @@ error: `#[doc(test(...)]` takes a list of attributes LL | #![doc(test)] | ^^^^ | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> note: the lint level is defined here --> $DIR/doc-test-attr.rs:2:9 | @@ -13,22 +11,16 @@ LL | #![deny(invalid_doc_attributes)] | ^^^^^^^^^^^^^^^^^^^^^^ error: `#[doc(test(...)]` takes a list of attributes - --> $DIR/doc-test-attr.rs:7:8 + --> $DIR/doc-test-attr.rs:6:8 | LL | #![doc(test = "hello")] | ^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: unknown `doc(test)` attribute `a` - --> $DIR/doc-test-attr.rs:10:13 + --> $DIR/doc-test-attr.rs:8:13 | LL | #![doc(test(a))] | ^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> error: aborting due to 3 previous errors diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.aarch64.stderr index 1006c3bc17e..1006c3bc17e 100644 --- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr +++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.aarch64.stderr diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.rs b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.rs index c628709d7a1..c628709d7a1 100644 --- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.rs +++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.rs diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.x86_64.stderr index 1006c3bc17e..1006c3bc17e 100644 --- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr +++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-sanitizer-kcfi.x86_64.stderr diff --git a/tests/ui/suggestions/silenced-binding-typo.stderr b/tests/ui/suggestions/silenced-binding-typo.stderr index 8dbd94208d6..c362d00c713 100644 --- a/tests/ui/suggestions/silenced-binding-typo.stderr +++ b/tests/ui/suggestions/silenced-binding-typo.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `x` in this scope LL | let _y = x; | ^ | -help: a local variable with a similar name exists, consider changing it +help: a local variable with a similar name exists, consider renaming `_x` into `x` | LL | let x = 42; | ~ diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs index 05b167326d4..2607f047024 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs @@ -13,8 +13,8 @@ fn main() { } fn weird0() -> impl Sized + !Sized {} -//~^ ERROR type mismatch resolving `() == impl !Sized + Sized` +//~^ ERROR type mismatch resolving `impl !Sized + Sized == ()` fn weird1() -> impl !Sized + Sized {} -//~^ ERROR type mismatch resolving `() == impl !Sized + Sized` +//~^ ERROR type mismatch resolving `impl !Sized + Sized == ()` fn weird2() -> impl !Sized {} -//~^ ERROR type mismatch resolving `() == impl !Sized` +//~^ ERROR type mismatch resolving `impl !Sized == ()` diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr index d803e56e817..ceaf42431fe 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr @@ -1,16 +1,16 @@ -error[E0271]: type mismatch resolving `() == impl !Sized + Sized` +error[E0271]: type mismatch resolving `impl !Sized + Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:15:16 | LL | fn weird0() -> impl Sized + !Sized {} | ^^^^^^^^^^^^^^^^^^^ types differ -error[E0271]: type mismatch resolving `() == impl !Sized + Sized` +error[E0271]: type mismatch resolving `impl !Sized + Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:17:16 | LL | fn weird1() -> impl !Sized + Sized {} | ^^^^^^^^^^^^^^^^^^^ types differ -error[E0271]: type mismatch resolving `() == impl !Sized` +error[E0271]: type mismatch resolving `impl !Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:19:16 | LL | fn weird2() -> impl !Sized {} diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs index d714d781c88..9951826a846 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs @@ -3,6 +3,6 @@ #![feature(negative_bounds, unboxed_closures)] fn produce() -> impl !Fn<(u32,)> {} -//~^ ERROR type mismatch resolving `() == impl !Fn<(u32,)>` +//~^ ERROR type mismatch resolving `impl !Fn<(u32,)> == ()` fn main() {} diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr index 1fd30410b00..e1b84e0df7a 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `() == impl !Fn<(u32,)>` +error[E0271]: type mismatch resolving `impl !Fn<(u32,)> == ()` --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17 | LL | fn produce() -> impl !Fn<(u32,)> {} diff --git a/tests/ui/traits/negative-impls/negative-impl-normalizes-to.rs b/tests/ui/traits/negative-impls/negative-impl-normalizes-to.rs new file mode 100644 index 00000000000..998b0d0c458 --- /dev/null +++ b/tests/ui/traits/negative-impls/negative-impl-normalizes-to.rs @@ -0,0 +1,22 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ check-pass + +// Check that negative impls for traits with associated types +// do not result in an ICE when trying to normalize. +#![feature(negative_impls)] +trait Trait { + type Assoc; +} + +struct Local<T>(T); +impl !Trait for Local<u32> {} +impl Trait for Local<i32> { + type Assoc = i32; +} + +trait NoOverlap {} +impl<T: Trait<Assoc = u32>> NoOverlap for T {} +impl<T> NoOverlap for Local<T> {} + +fn main() {} diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.stderr b/tests/ui/traits/next-solver/alias-bound-unsound.stderr index 2408e05728a..a5c2f215134 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.stderr +++ b/tests/ui/traits/next-solver/alias-bound-unsound.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `String: Copy` LL | type Item = String where String: Copy; | ^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) note: the requirement `String: Copy` appears on the `impl`'s associated type `Item` but not on the corresponding trait's associated type --> $DIR/alias-bound-unsound.rs:8:10 | @@ -18,32 +17,24 @@ error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item` | LL | drop(<() as Foo>::copy_me(&x)); | ^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` --> $DIR/alias-bound-unsound.rs:24:10 | LL | drop(<() as Foo>::copy_me(&x)); | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed` --> $DIR/alias-bound-unsound.rs:24:31 | LL | drop(<() as Foo>::copy_me(&x)); | ^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed` --> $DIR/alias-bound-unsound.rs:24:10 | LL | drop(<() as Foo>::copy_me(&x)); | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` --> $DIR/alias-bound-unsound.rs:24:10 @@ -51,7 +42,6 @@ error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` LL | drop(<() as Foo>::copy_me(&x)); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`) = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 6 previous errors diff --git a/tests/ui/traits/next-solver/coherence-fulfill-overflow.stderr b/tests/ui/traits/next-solver/coherence-fulfill-overflow.stderr index 406c0ccca97..57cba790b55 100644 --- a/tests/ui/traits/next-solver/coherence-fulfill-overflow.stderr +++ b/tests/ui/traits/next-solver/coherence-fulfill-overflow.stderr @@ -5,6 +5,9 @@ LL | impl<T: ?Sized + TwoW> Trait for W<T> {} | ------------------------------------- first implementation here LL | impl<T: ?Sized + TwoW> Trait for T {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>` + | + = note: overflow evaluating the requirement `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>: TwoW` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`coherence_fulfill_overflow`) error: aborting due to 1 previous error diff --git a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr index fc145b81196..a04fa1ab8a1 100644 --- a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr +++ b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr @@ -6,6 +6,9 @@ LL | impl<T: Copy> Trait for T {} LL | struct LocalTy; LL | impl Trait for <LocalTy as Overflow>::Assoc {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + | + = note: overflow evaluating the requirement `_ == <LocalTy as Overflow>::Assoc` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`trait_ref_is_knowable_norm_overflow`) error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc: Sized` --> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18 diff --git a/tests/ui/traits/next-solver/constrain-alias-goals-in-unsize.rs b/tests/ui/traits/next-solver/constrain-alias-goals-in-unsize.rs new file mode 100644 index 00000000000..1656238bd61 --- /dev/null +++ b/tests/ui/traits/next-solver/constrain-alias-goals-in-unsize.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +use std::mem::ManuallyDrop; + +trait Foo {} + +struct Guard<T> { + value: ManuallyDrop<T>, +} + +impl<T: Foo> Guard<T> { + fn uwu(&self) { + let x: &dyn Foo = &*self.value; + } +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr index 150100f2c53..8d7d8cee08a 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `W<_>: Trait` LL | impls::<W<_>>(); | ^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`) note: required by a bound in `impls` --> $DIR/fixpoint-exponential-growth.rs:30:13 | diff --git a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr index a3404da51f0..7cedb4d36c9 100644 --- a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr +++ b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `(): Trait` LL | impls_trait::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait` --> $DIR/double-cycle-inductive-coinductive.rs:17:19 | @@ -17,7 +16,6 @@ error[E0275]: overflow evaluating the requirement `(): TraitRev` LL | impls_trait_rev::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait_rev` --> $DIR/double-cycle-inductive-coinductive.rs:29:23 | diff --git a/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr index 42451920744..a2a5c028cf8 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr +++ b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `W<_>: Trait` LL | impls_trait::<W<_>>(); | ^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_fixpoint_hang`) note: required by a bound in `impls_trait` --> $DIR/inductive-fixpoint-hang.rs:28:19 | diff --git a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr index 859b3f3f1c7..e9cc6bc6c81 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr +++ b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `(): A` LL | impls_a::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`) note: required by a bound in `impls_a` --> $DIR/inductive-not-on-stack.rs:25:15 | @@ -17,7 +16,6 @@ error[E0275]: overflow evaluating the requirement `(): AR` LL | impls_ar::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`) note: required by a bound in `impls_ar` --> $DIR/inductive-not-on-stack.rs:38:16 | diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr index e828bdeb16b..17544eb1da5 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `(): A` LL | impls_a::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mixed_cycles_1`) note: required by a bound in `impls_a` --> $DIR/mixed-cycles-1.rs:34:15 | diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr index ec13093f707..a9be1016c74 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `(): A` LL | impls_a::<()>(); | ^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mixed_cycles_2`) note: required by a bound in `impls_a` --> $DIR/mixed-cycles-2.rs:27:15 | diff --git a/tests/ui/traits/next-solver/member-constraints-in-root-universe.rs b/tests/ui/traits/next-solver/member-constraints-in-root-universe.rs index 74164ad2aa2..a5696fc7796 100644 --- a/tests/ui/traits/next-solver/member-constraints-in-root-universe.rs +++ b/tests/ui/traits/next-solver/member-constraints-in-root-universe.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Znext-solver -//@ check-pass trait Trait { type Ty; @@ -11,6 +10,7 @@ impl Trait for for<'a> fn(&'a u8, &'a u8) { // argument is necessary to create universes before registering the hidden type. fn test<'a>(_: <fn(&u8, &u8) as Trait>::Ty) -> impl Sized { + //~^ ERROR the type `<for<'a, 'b> fn(&'a u8, &'b u8) as Trait>::Ty` is not well-formed "hidden type is `&'?0 str` with '?0 member of ['static,]" } diff --git a/tests/ui/traits/next-solver/member-constraints-in-root-universe.stderr b/tests/ui/traits/next-solver/member-constraints-in-root-universe.stderr new file mode 100644 index 00000000000..7a9982f07f6 --- /dev/null +++ b/tests/ui/traits/next-solver/member-constraints-in-root-universe.stderr @@ -0,0 +1,8 @@ +error: the type `<for<'a, 'b> fn(&'a u8, &'b u8) as Trait>::Ty` is not well-formed + --> $DIR/member-constraints-in-root-universe.rs:12:16 + | +LL | fn test<'a>(_: <fn(&u8, &u8) as Trait>::Ty) -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/next-solver/normalize-param-env-2.stderr b/tests/ui/traits/next-solver/normalize-param-env-2.stderr index 86729eb8a4b..74a0a90885d 100644 --- a/tests/ui/traits/next-solver/normalize-param-env-2.stderr +++ b/tests/ui/traits/next-solver/normalize-param-env-2.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>` LL | Self::Assoc: A<T>, | ^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) note: the requirement `<() as A<T>>::Assoc: A<T>` appears on the `impl`'s method `f` but not on the corresponding trait's method --> $DIR/normalize-param-env-2.rs:12:8 | @@ -19,24 +18,18 @@ error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>` | LL | Self::Assoc: A<T>, | ^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc well-formed` --> $DIR/normalize-param-env-2.rs:24:22 | LL | Self::Assoc: A<T>, | ^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) error[E0275]: overflow evaluating the requirement `(): A<T>` --> $DIR/normalize-param-env-2.rs:27:10 | LL | <() as A<T>>::f(); | ^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>` --> $DIR/normalize-param-env-2.rs:27:9 @@ -44,7 +37,6 @@ error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>` LL | <() as A<T>>::f(); | ^^^^^^^^^^^^^^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) note: required by a bound in `A::f` --> $DIR/normalize-param-env-2.rs:14:22 | diff --git a/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr b/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr index 2a017fac104..1bee8ee88ff 100644 --- a/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr +++ b/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr @@ -3,16 +3,12 @@ error[E0275]: overflow evaluating the requirement `<T as Trait>::Assoc: Trait` | LL | <T as Trait>::Assoc: Trait, | ^^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_4`) error[E0275]: overflow evaluating the requirement `<T as Trait>::Assoc well-formed` --> $DIR/normalize-param-env-4.rs:18:26 | LL | <T as Trait>::Assoc: Trait, | ^^^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_4`) error[E0275]: overflow evaluating the requirement `T: Trait` --> $DIR/normalize-param-env-4.rs:31:19 @@ -20,7 +16,6 @@ error[E0275]: overflow evaluating the requirement `T: Trait` LL | impls_trait::<T>(); | ^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_4`) note: required by a bound in `impls_trait` --> $DIR/normalize-param-env-4.rs:14:19 | diff --git a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr index 90b54b1e789..b032ae3e740 100644 --- a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr +++ b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr @@ -4,7 +4,6 @@ error[E0275]: overflow evaluating the requirement `W<_>: Trait` LL | impls::<W<_>>(); | ^^^^ | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`exponential_trait_goals`) note: required by a bound in `impls` --> $DIR/exponential-trait-goals.rs:14:13 | diff --git a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs index fb668f83b01..1b80287d9da 100644 --- a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs +++ b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.rs @@ -1,12 +1,7 @@ -//~ ERROR overflow evaluating the requirement `Self well-formed` -//~| ERROR overflow evaluating the requirement `Self: Trait` - // This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE. //@ compile-flags: -Znext-solver --crate-type=lib -//@ check-fail +//@ check-pass #![recursion_limit = "0"] trait Trait {} impl Trait for u32 {} -//~^ ERROR overflow evaluating the requirement `u32: Trait` -//~| ERROR overflow evaluating the requirement `u32 well-formed` diff --git a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr deleted file mode 100644 index 16b25d90ace..00000000000 --- a/tests/ui/traits/next-solver/overflow/recursion-limit-zero-issue-115351.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0275]: overflow evaluating the requirement `Self: Trait` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error[E0275]: overflow evaluating the requirement `Self well-formed` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error[E0275]: overflow evaluating the requirement `u32: Trait` - --> $DIR/recursion-limit-zero-issue-115351.rs:10:16 - | -LL | impl Trait for u32 {} - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error[E0275]: overflow evaluating the requirement `u32 well-formed` - --> $DIR/recursion-limit-zero-issue-115351.rs:10:16 - | -LL | impl Trait for u32 {} - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/transmutability/abstraction/abstracted_assume.rs b/tests/ui/transmutability/abstraction/abstracted_assume.rs index 0e62dc632bf..897e1b4b50a 100644 --- a/tests/ui/transmutability/abstraction/abstracted_assume.rs +++ b/tests/ui/transmutability/abstraction/abstracted_assume.rs @@ -13,41 +13,27 @@ mod assert { pub fn is_transmutable< Src, Dst, - Context, const ASSUME: std::mem::Assume, >() where Dst: BikeshedIntrinsicFrom< Src, - Context, ASSUME, >, {} } fn direct() { - struct Context; - #[repr(C)] struct Src; - #[repr(C)] struct Dst; - - assert::is_transmutable::<Src, Dst, Context, { std::mem::Assume::NOTHING }>(); + assert::is_transmutable::<(), (), { std::mem::Assume::NOTHING }>(); } fn via_const() { - struct Context; - #[repr(C)] struct Src; - #[repr(C)] struct Dst; - const FALSE: bool = false; - assert::is_transmutable::<Src, Dst, Context, { std::mem::Assume::NOTHING }>(); + assert::is_transmutable::<(), (), { std::mem::Assume::NOTHING }>(); } fn via_associated_const() { - struct Context; - #[repr(C)] struct Src; - #[repr(C)] struct Dst; - trait Trait { const FALSE: bool = true; } @@ -57,9 +43,8 @@ fn via_associated_const() { impl Trait for Ty {} assert::is_transmutable::< - Src, - Dst, - Context, + (), + (), { std::mem::Assume { alignment: {Ty::FALSE}, diff --git a/tests/ui/transmutability/abstraction/const_generic_fn.rs b/tests/ui/transmutability/abstraction/const_generic_fn.rs index 076b7c8999b..0a5f0de0214 100644 --- a/tests/ui/transmutability/abstraction/const_generic_fn.rs +++ b/tests/ui/transmutability/abstraction/const_generic_fn.rs @@ -7,12 +7,11 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn array_like<T, E, const N: usize>() where - T: BikeshedIntrinsicFrom<[E; N], Context, { Assume::SAFETY }>, - [E; N]: BikeshedIntrinsicFrom<T, Context, { Assume::SAFETY }> + T: BikeshedIntrinsicFrom<[E; N], { Assume::SAFETY }>, + [E; N]: BikeshedIntrinsicFrom<T, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/alignment/align-fail.rs b/tests/ui/transmutability/alignment/align-fail.rs index 2bb6bfeeaae..d88f1285c11 100644 --- a/tests/ui/transmutability/alignment/align-fail.rs +++ b/tests/ui/transmutability/alignment/align-fail.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: false, lifetimes: true, diff --git a/tests/ui/transmutability/alignment/align-fail.stderr b/tests/ui/transmutability/alignment/align-fail.stderr index c68c1481f4d..c92c3d841f2 100644 --- a/tests/ui/transmutability/alignment/align-fail.stderr +++ b/tests/ui/transmutability/alignment/align-fail.stderr @@ -1,16 +1,16 @@ -error[E0277]: `&[u8; 0]` cannot be safely transmuted into `&[u16; 0]` in the defining scope of `assert::Context` - --> $DIR/align-fail.rs:22:55 +error[E0277]: `&[u8; 0]` cannot be safely transmuted into `&[u16; 0]` + --> $DIR/align-fail.rs:21:55 | LL | ...tatic [u8; 0], &'static [u16; 0]>(); | ^^^^^^^^^^^^^^^^^ The minimum alignment of `&[u8; 0]` (1) should be greater than that of `&[u16; 0]` (2) | note: required by a bound in `is_maybe_transmutable` - --> $DIR/align-fail.rs:10:14 + --> $DIR/align-fail.rs:9:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: false, diff --git a/tests/ui/transmutability/alignment/align-pass.rs b/tests/ui/transmutability/alignment/align-pass.rs index d97a55f730c..aecf7b02d62 100644 --- a/tests/ui/transmutability/alignment/align-pass.rs +++ b/tests/ui/transmutability/alignment/align-pass.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: false, lifetimes: false, diff --git a/tests/ui/transmute/issue-115402-overflow-size.rs b/tests/ui/transmutability/arrays/huge-len.rs index 91168041ed6..3fe254ebef4 100644 --- a/tests/ui/transmute/issue-115402-overflow-size.rs +++ b/tests/ui/transmutability/arrays/huge-len.rs @@ -2,11 +2,10 @@ #![feature(transmutability)] mod assert { use std::mem::BikeshedIntrinsicFrom; - struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context>, + Dst: BikeshedIntrinsicFrom<Src>, { } } diff --git a/tests/ui/transmute/issue-115402-overflow-size.stderr b/tests/ui/transmutability/arrays/huge-len.stderr index 08d180f6427..37160c5c959 100644 --- a/tests/ui/transmute/issue-115402-overflow-size.stderr +++ b/tests/ui/transmutability/arrays/huge-len.stderr @@ -1,32 +1,32 @@ -error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` in the defining scope of `assert::Context` - --> $DIR/issue-115402-overflow-size.rs:22:41 +error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` + --> $DIR/huge-len.rs:21:41 | LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>(); | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` - --> $DIR/issue-115402-overflow-size.rs:9:14 + --> $DIR/huge-len.rs:8:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` -error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/issue-115402-overflow-size.rs:25:55 +error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` + --> $DIR/huge-len.rs:24:55 | LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); | ^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` - --> $DIR/issue-115402-overflow-size.rs:9:14 + --> $DIR/huge-len.rs:8:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/arrays/issue-103783-array-length.rs b/tests/ui/transmutability/arrays/issue-103783-array-length.rs index cb36e539ed1..7fcbcc01075 100644 --- a/tests/ui/transmutability/arrays/issue-103783-array-length.rs +++ b/tests/ui/transmutability/arrays/issue-103783-array-length.rs @@ -4,13 +4,11 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where Dst: BikeshedIntrinsicFrom< Src, - Context, { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, { diff --git a/tests/ui/transmutability/arrays/issue-103783-array-length.stderr b/tests/ui/transmutability/arrays/issue-103783-array-length.stderr index 2c581664f39..02ac40741cb 100644 --- a/tests/ui/transmutability/arrays/issue-103783-array-length.stderr +++ b/tests/ui/transmutability/arrays/issue-103783-array-length.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-103783-array-length.rs:21:34 + --> $DIR/issue-103783-array-length.rs:19:34 | LL | type NaughtyLenArray = [u32; 3.14159]; | ^^^^^^^ expected `usize`, found floating-point number diff --git a/tests/ui/transmutability/arrays/should_have_correct_length.rs b/tests/ui/transmutability/arrays/should_have_correct_length.rs index 44a60360014..747897d49d7 100644 --- a/tests/ui/transmutability/arrays/should_have_correct_length.rs +++ b/tests/ui/transmutability/arrays/should_have_correct_length.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/arrays/should_inherit_alignment.rs b/tests/ui/transmutability/arrays/should_inherit_alignment.rs index bb78cd82a34..d95c51e3361 100644 --- a/tests/ui/transmutability/arrays/should_inherit_alignment.rs +++ b/tests/ui/transmutability/arrays/should_inherit_alignment.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs b/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs index 853bd9cbc0f..5345b199f6e 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs @@ -6,11 +6,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index 1a0a5d3ae94..fd21ac34183 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -1,16 +1,16 @@ -error[E0277]: `[String; 0]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:26:52 +error[E0277]: `[String; 0]` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:25:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `[String; 0]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -19,19 +19,19 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:27:47 +error[E0277]: `u128` cannot be safely transmuted into `[String; 0]` + --> $DIR/should_require_well_defined_layout.rs:26:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `[String; 0]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -40,19 +40,19 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `[String; 1]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:32:52 +error[E0277]: `[String; 1]` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:31:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `[String; 1]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -61,19 +61,19 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:33:47 +error[E0277]: `u128` cannot be safely transmuted into `[String; 1]` + --> $DIR/should_require_well_defined_layout.rs:32:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `[String; 1]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -82,19 +82,19 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `[String; 2]` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:38:52 +error[E0277]: `[String; 2]` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:37:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `[String; 2]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -103,19 +103,19 @@ LL | | .and(Assume::VALIDITY) LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:39:47 +error[E0277]: `u128` cannot be safely transmuted into `[String; 2]` + --> $DIR/should_require_well_defined_layout.rs:38:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `[String; 2]` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs index 940f070e7e3..d3d463e7929 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs @@ -7,9 +7,9 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, @@ -36,8 +36,6 @@ struct Zst; #[repr(usize)] enum V0usize { V } fn n8() { - struct Context; - type Smaller = Zst; type Analog = u8; type Larger = u16; @@ -45,23 +43,21 @@ fn n8() { fn i_should_have_correct_length() { type Current = V0i8; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } fn u_should_have_correct_length() { type Current = V0u8; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } } fn n16() { - struct Context; - type Smaller = u8; type Analog = u16; type Larger = u32; @@ -69,23 +65,21 @@ fn n16() { fn i_should_have_correct_length() { type Current = V0i16; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } fn u_should_have_correct_length() { type Current = V0u16; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } } fn n32() { - struct Context; - type Smaller = u16; type Analog = u32; type Larger = u64; @@ -93,23 +87,21 @@ fn n32() { fn i_should_have_correct_length() { type Current = V0i32; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } fn u_should_have_correct_length() { type Current = V0u32; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } } fn n64() { - struct Context; - type Smaller = u32; type Analog = u64; type Larger = u128; @@ -117,23 +109,21 @@ fn n64() { fn i_should_have_correct_length() { type Current = V0i64; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } fn u_should_have_correct_length() { type Current = V0u64; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } } fn nsize() { - struct Context; - type Smaller = u8; type Analog = usize; type Larger = [usize; 2]; @@ -141,16 +131,16 @@ fn nsize() { fn i_should_have_correct_length() { type Current = V0isize; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } fn u_should_have_correct_length() { type Current = V0usize; - assert::is_transmutable::<Smaller, Current, Context>(); //~ ERROR cannot be safely transmuted - assert::is_transmutable::<Current, Analog, Context>(); - assert::is_transmutable::<Current, Larger, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Smaller, Current>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Current, Analog>(); + assert::is_transmutable::<Current, Larger>(); //~ ERROR cannot be safely transmuted } } diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr index 46cdaa92563..b2ff04eeed9 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -1,16 +1,16 @@ -error[E0277]: `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 +error[E0277]: `Zst` cannot be safely transmuted into `V0i8` + --> $DIR/primitive_reprs_should_have_correct_length.rs:46:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `Zst` is smaller than the size of `V0i8` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -20,19 +20,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:50:44 +error[E0277]: `V0i8` cannot be safely transmuted into `u16` + --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -42,19 +42,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 +error[E0277]: `Zst` cannot be safely transmuted into `V0u8` + --> $DIR/primitive_reprs_should_have_correct_length.rs:54:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `Zst` is smaller than the size of `V0u8` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -64,19 +64,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:58:44 +error[E0277]: `V0u8` cannot be safely transmuted into `u16` + --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -86,19 +86,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:72:44 +error[E0277]: `u8` cannot be safely transmuted into `V0i16` + --> $DIR/primitive_reprs_should_have_correct_length.rs:68:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u8` is smaller than the size of `V0i16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -108,19 +108,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:74:44 +error[E0277]: `V0i16` cannot be safely transmuted into `u32` + --> $DIR/primitive_reprs_should_have_correct_length.rs:70:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -130,19 +130,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:80:44 +error[E0277]: `u8` cannot be safely transmuted into `V0u16` + --> $DIR/primitive_reprs_should_have_correct_length.rs:76:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u8` is smaller than the size of `V0u16` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -152,19 +152,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:82:44 +error[E0277]: `V0u16` cannot be safely transmuted into `u32` + --> $DIR/primitive_reprs_should_have_correct_length.rs:78:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -174,19 +174,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:96:44 +error[E0277]: `u16` cannot be safely transmuted into `V0i32` + --> $DIR/primitive_reprs_should_have_correct_length.rs:90:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u16` is smaller than the size of `V0i32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -196,19 +196,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 +error[E0277]: `V0i32` cannot be safely transmuted into `u64` + --> $DIR/primitive_reprs_should_have_correct_length.rs:92:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -218,19 +218,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:104:44 +error[E0277]: `u16` cannot be safely transmuted into `V0u32` + --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u16` is smaller than the size of `V0u32` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -240,19 +240,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:106:44 +error[E0277]: `V0u32` cannot be safely transmuted into `u64` + --> $DIR/primitive_reprs_should_have_correct_length.rs:100:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -262,19 +262,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 +error[E0277]: `u32` cannot be safely transmuted into `V0i64` + --> $DIR/primitive_reprs_should_have_correct_length.rs:112:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u32` is smaller than the size of `V0i64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -284,19 +284,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 +error[E0277]: `V0i64` cannot be safely transmuted into `u128` + --> $DIR/primitive_reprs_should_have_correct_length.rs:114:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -306,19 +306,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:128:44 +error[E0277]: `u32` cannot be safely transmuted into `V0u64` + --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u32` is smaller than the size of `V0u64` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -328,19 +328,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:130:44 +error[E0277]: `V0u64` cannot be safely transmuted into `u128` + --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -350,19 +350,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 +error[E0277]: `u8` cannot be safely transmuted into `V0isize` + --> $DIR/primitive_reprs_should_have_correct_length.rs:134:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u8` is smaller than the size of `V0isize` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -372,19 +372,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:146:44 +error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` + --> $DIR/primitive_reprs_should_have_correct_length.rs:136:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0isize` is smaller than the size of `[usize; 2]` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -394,19 +394,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:152:44 +error[E0277]: `u8` cannot be safely transmuted into `V0usize` + --> $DIR/primitive_reprs_should_have_correct_length.rs:142:44 | -LL | assert::is_transmutable::<Smaller, Current, Context>(); +LL | assert::is_transmutable::<Smaller, Current>(); | ^^^^^^^ The size of `u8` is smaller than the size of `V0usize` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -416,19 +416,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_transmutable` -error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context` - --> $DIR/primitive_reprs_should_have_correct_length.rs:154:44 +error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` + --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 | -LL | assert::is_transmutable::<Current, Larger, Context>(); +LL | assert::is_transmutable::<Current, Larger>(); | ^^^^^^ The size of `V0usize` is smaller than the size of `[usize; 2]` | note: required by a bound in `is_transmutable` --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs index 102111ae291..630e662b926 100644 --- a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr index 1612b6b3661..24730935047 100644 --- a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr @@ -1,16 +1,16 @@ -error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:28:52 +error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:27:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `void::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -20,19 +20,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:29:47 +error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:28:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `void::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -42,19 +42,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:34:52 +error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:33:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `singleton::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -64,19 +64,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:35:47 +error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:34:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `singleton::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -86,19 +86,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:40:52 +error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:39:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `duplex::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -108,19 +108,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:41:47 +error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:40:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `duplex::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:14:14 + --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/enums/should_order_correctly.rs b/tests/ui/transmutability/enums/should_order_correctly.rs index 6146e37e54e..d51a033f1a6 100644 --- a/tests/ui/transmutability/enums/should_order_correctly.rs +++ b/tests/ui/transmutability/enums/should_order_correctly.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/enums/should_pad_variants.rs b/tests/ui/transmutability/enums/should_pad_variants.rs index c077c52a36a..81ef9e8a567 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.rs +++ b/tests/ui/transmutability/enums/should_pad_variants.rs @@ -8,9 +8,9 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) @@ -38,8 +38,7 @@ enum Lopsided { #[repr(C)] struct Dst(Lopsided, V2); fn should_pad_variants() { - struct Context; // If the implementation (incorrectly) fails to pad `Lopsided::Smol` with // an uninitialized byte, this transmutation might be (wrongly) accepted: - assert::is_transmutable::<Src, Dst, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/enums/should_pad_variants.stderr b/tests/ui/transmutability/enums/should_pad_variants.stderr index fd98e355fb9..13b4c8053ad 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.stderr +++ b/tests/ui/transmutability/enums/should_pad_variants.stderr @@ -1,16 +1,16 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context` - --> $DIR/should_pad_variants.rs:44:36 +error[E0277]: `Src` cannot be safely transmuted into `Dst` + --> $DIR/should_pad_variants.rs:43:36 | -LL | assert::is_transmutable::<Src, Dst, Context>(); +LL | assert::is_transmutable::<Src, Dst>(); | ^^^ The size of `Src` is smaller than the size of `Dst` | note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/enums/should_respect_endianness.rs b/tests/ui/transmutability/enums/should_respect_endianness.rs index f3567b405f4..8e52274710a 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.rs +++ b/tests/ui/transmutability/enums/should_respect_endianness.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/enums/should_respect_endianness.stderr b/tests/ui/transmutability/enums/should_respect_endianness.stderr index 8823f40e534..c2a2eb53458 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.stderr +++ b/tests/ui/transmutability/enums/should_respect_endianness.stderr @@ -1,16 +1,16 @@ -error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context` - --> $DIR/should_respect_endianness.rs:36:36 +error[E0277]: `Src` cannot be safely transmuted into `Unexpected` + --> $DIR/should_respect_endianness.rs:35:36 | LL | assert::is_transmutable::<Src, Unexpected>(); | ^^^^^^^^^^ At least one value of `Src` isn't a bit-valid value of `Unexpected` | note: required by a bound in `is_transmutable` - --> $DIR/should_respect_endianness.rs:14:14 + --> $DIR/should_respect_endianness.rs:13:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index f2c2a471f72..0695d7d409f 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -3,9 +3,9 @@ mod assert { use std::mem::BikeshedIntrinsicFrom; - pub fn is_transmutable<Src, Context, const ASSUME_ALIGNMENT: bool>() + pub fn is_transmutable<Src, const ASSUME_ALIGNMENT: bool>() where - Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope + Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope //~^ the constant `ASSUME_ALIGNMENT` is not of type `Assume` //~| ERROR: mismatched types { @@ -13,10 +13,9 @@ mod assert { } fn via_const() { - struct Context; struct Src; - assert::is_transmutable::<Src, Context, false>(); + assert::is_transmutable::<Src, false>(); } fn main() {} diff --git a/tests/ui/transmutability/issue-101739-1.stderr b/tests/ui/transmutability/issue-101739-1.stderr index e87693f247d..1df7c3e2f97 100644 --- a/tests/ui/transmutability/issue-101739-1.stderr +++ b/tests/ui/transmutability/issue-101739-1.stderr @@ -1,23 +1,23 @@ error[E0412]: cannot find type `Dst` in this scope --> $DIR/issue-101739-1.rs:8:9 | -LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, +LL | Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, | ^^^ not found in this scope error: the constant `ASSUME_ALIGNMENT` is not of type `Assume` --> $DIR/issue-101739-1.rs:8:14 | -LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` +LL | Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` | note: required by a bound in `BikeshedIntrinsicFrom` --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL error[E0308]: mismatched types - --> $DIR/issue-101739-1.rs:8:50 + --> $DIR/issue-101739-1.rs:8:41 | -LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, - | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` +LL | Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` error: aborting due to 3 previous errors diff --git a/tests/ui/transmutability/issue-101739-2.rs b/tests/ui/transmutability/issue-101739-2.rs index 8d670ec17ca..e2cec24aac1 100644 --- a/tests/ui/transmutability/issue-101739-2.rs +++ b/tests/ui/transmutability/issue-101739-2.rs @@ -8,17 +8,15 @@ mod assert { pub fn is_transmutable< Src, Dst, - Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, >() where - Dst: BikeshedIntrinsicFrom< //~ ERROR trait takes at most 3 generic arguments but 6 generic arguments were supplied + Dst: BikeshedIntrinsicFrom< //~ ERROR trait takes at most 2 generic arguments but 5 generic arguments were supplied //~^ ERROR: the constant `ASSUME_ALIGNMENT` is not of type `Assume` Src, - Context, ASSUME_ALIGNMENT, //~ ERROR: mismatched types ASSUME_LIFETIMES, ASSUME_VALIDITY, @@ -28,11 +26,10 @@ mod assert { } fn via_const() { - struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; const FALSE: bool = false; - assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>(); + assert::is_transmutable::<Src, Dst, FALSE, FALSE, FALSE, FALSE>(); } diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index adbb5ff5aff..639b4460892 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,8 +1,8 @@ -error[E0107]: trait takes at most 3 generic arguments but 6 generic arguments were supplied - --> $DIR/issue-101739-2.rs:18:14 +error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments were supplied + --> $DIR/issue-101739-2.rs:17:14 | LL | Dst: BikeshedIntrinsicFrom< - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 3 generic arguments + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments ... LL | / ASSUME_LIFETIMES, LL | | ASSUME_VALIDITY, @@ -10,13 +10,13 @@ LL | | ASSUME_VISIBILITY, | |_____________________________- help: remove these generic arguments error: the constant `ASSUME_ALIGNMENT` is not of type `Assume` - --> $DIR/issue-101739-2.rs:18:14 + --> $DIR/issue-101739-2.rs:17:14 | LL | Dst: BikeshedIntrinsicFrom< | ______________^ LL | | LL | | Src, -LL | | Context, +LL | | ASSUME_ALIGNMENT, ... | LL | | ASSUME_VISIBILITY, LL | | >, @@ -26,7 +26,7 @@ note: required by a bound in `BikeshedIntrinsicFrom` --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL error[E0308]: mismatched types - --> $DIR/issue-101739-2.rs:22:13 + --> $DIR/issue-101739-2.rs:20:13 | LL | ASSUME_ALIGNMENT, | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` diff --git a/tests/ui/transmutability/issue-110467.rs b/tests/ui/transmutability/issue-110467.rs index 6485ed8aab7..1f9e521c24b 100644 --- a/tests/ui/transmutability/issue-110467.rs +++ b/tests/ui/transmutability/issue-110467.rs @@ -2,11 +2,10 @@ #![crate_type = "lib"] #![feature(transmutability)] use std::mem::BikeshedIntrinsicFrom; -pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context>, + Dst: BikeshedIntrinsicFrom<Src>, { } diff --git a/tests/ui/transmutability/issue-110892.rs b/tests/ui/transmutability/issue-110892.rs index 1baf117518b..9713684c959 100644 --- a/tests/ui/transmutability/issue-110892.rs +++ b/tests/ui/transmutability/issue-110892.rs @@ -8,7 +8,6 @@ mod assert { pub fn is_transmutable< Src, Dst, - Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_SAFETY: bool, @@ -17,7 +16,6 @@ mod assert { where Dst: BikeshedIntrinsicFrom< Src, - Context, { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } >, {} @@ -32,9 +30,8 @@ mod assert { } fn main() { - struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; - assert::is_transmutable::<Src, Dst, Context, false, false, { true }, false>(); + assert::is_transmutable::<Src, Dst, false, false, { true }, false>(); } diff --git a/tests/ui/transmutability/issue-110892.stderr b/tests/ui/transmutability/issue-110892.stderr index 13654307aee..b5d1e7084a0 100644 --- a/tests/ui/transmutability/issue-110892.stderr +++ b/tests/ui/transmutability/issue-110892.stderr @@ -1,29 +1,29 @@ error: expected parameter name, found `,` - --> $DIR/issue-110892.rs:27:9 + --> $DIR/issue-110892.rs:25:9 | LL | , | ^ expected parameter name error: expected parameter name, found `,` - --> $DIR/issue-110892.rs:28:9 + --> $DIR/issue-110892.rs:26:9 | LL | , | ^ expected parameter name error: expected parameter name, found `,` - --> $DIR/issue-110892.rs:29:9 + --> $DIR/issue-110892.rs:27:9 | LL | , | ^ expected parameter name error: expected parameter name, found `,` - --> $DIR/issue-110892.rs:30:9 + --> $DIR/issue-110892.rs:28:9 | LL | , | ^ expected parameter name error[E0308]: mismatched types - --> $DIR/issue-110892.rs:31:10 + --> $DIR/issue-110892.rs:29:10 | LL | const fn from_options( | ------------ implicitly returns `()` as its body has no tail or `return` expression diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs index b3a1e13b85b..bcfbc1430a8 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs @@ -6,16 +6,14 @@ mod assert { use std::mem::BikeshedIntrinsicFrom; - pub struct Context; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context> + Dst: BikeshedIntrinsicFrom<Src> {} } fn should_gracefully_handle_unknown_dst() { - struct Context; struct Src; - assert::is_transmutable::<Src, Dst, Context>(); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ cannot find type } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.stderr b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.stderr index 10e057ec104..9fa376bf433 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Dst` in this scope - --> $DIR/unknown_dst.rs:20:36 + --> $DIR/unknown_dst.rs:18:36 | -LL | assert::is_transmutable::<Src, Dst, Context>(); +LL | assert::is_transmutable::<Src, Dst>(); | ^^^ not found in this scope | help: you might be missing a type parameter diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs index 092b205b770..bd7c3fc7fb5 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs @@ -6,16 +6,14 @@ mod assert { use std::mem::BikeshedIntrinsicFrom; - pub struct Context; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context> + Dst: BikeshedIntrinsicFrom<Src> {} } fn should_gracefully_handle_unknown_src() { - struct Context; #[repr(C)] struct Dst; - assert::is_transmutable::<Src, Dst, Context>(); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ cannot find type } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.stderr b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.stderr index a84d2726fa9..f2c7d9e1bcc 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Src` in this scope - --> $DIR/unknown_src.rs:20:31 + --> $DIR/unknown_src.rs:18:31 | -LL | assert::is_transmutable::<Src, Dst, Context>(); +LL | assert::is_transmutable::<Src, Dst>(); | ^^^ not found in this scope | help: you might be missing a type parameter diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs index 8d19cabc0f9..58c16d773e1 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs @@ -6,17 +6,15 @@ mod assert { use std::mem::BikeshedIntrinsicFrom; - pub struct Context; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context> + Dst: BikeshedIntrinsicFrom<Src> {} } fn should_gracefully_handle_unknown_dst_field() { - struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst(Missing); //~ cannot find type - assert::is_transmutable::<Src, Dst, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr index c2df398b8ff..eeed8a62a2a 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr @@ -1,23 +1,23 @@ error[E0412]: cannot find type `Missing` in this scope - --> $DIR/unknown_src_field.rs:20:27 + --> $DIR/unknown_src_field.rs:18:27 | LL | #[repr(C)] struct Dst(Missing); | ^^^^^^^ not found in this scope -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_gracefully_handle_unknown_dst_field::Context` - --> $DIR/unknown_src_field.rs:21:36 +error[E0277]: `Src` cannot be safely transmuted into `Dst` + --> $DIR/unknown_src_field.rs:19:36 | -LL | assert::is_transmutable::<Src, Dst, Context>(); +LL | assert::is_transmutable::<Src, Dst>(); | ^^^ `Dst` has an unknown layout | note: required by a bound in `is_transmutable` - --> $DIR/unknown_src_field.rs:13:14 + --> $DIR/unknown_src_field.rs:12:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs index 52aa4bb3101..608366fa089 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs @@ -13,7 +13,6 @@ mod assert { pub fn is_transmutable< Src, Dst, - Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_SAFETY: bool, @@ -22,7 +21,6 @@ mod assert { where Dst: BikeshedIntrinsicFrom< Src, - Context, { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } >, {} @@ -43,11 +41,10 @@ mod assert { } fn test() { - struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; - assert::is_transmutable::<Src, Dst, Context, {0u8}, false, false, false>(); //~ ERROR mismatched types - assert::is_transmutable::<Src, Dst, Context, false, {0u8}, false, false>(); //~ ERROR mismatched types - assert::is_transmutable::<Src, Dst, Context, false, false, {0u8}, false>(); //~ ERROR mismatched types - assert::is_transmutable::<Src, Dst, Context, false, false, false, {0u8}>(); //~ ERROR mismatched types + assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>(); //~ ERROR mismatched types + assert::is_transmutable::<Src, Dst, false, {0u8}, false, false>(); //~ ERROR mismatched types + assert::is_transmutable::<Src, Dst, false, false, {0u8}, false>(); //~ ERROR mismatched types + assert::is_transmutable::<Src, Dst, false, false, false, {0u8}>(); //~ ERROR mismatched types } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr index c6d93876cfa..c6d37c24325 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr @@ -1,26 +1,26 @@ error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:49:51 + --> $DIR/wrong-type-assume.rs:46:42 | -LL | assert::is_transmutable::<Src, Dst, Context, {0u8}, false, false, false>(); - | ^^^ expected `bool`, found `u8` +LL | assert::is_transmutable::<Src, Dst, {0u8}, false, false, false>(); + | ^^^ expected `bool`, found `u8` error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:50:58 + --> $DIR/wrong-type-assume.rs:47:49 | -LL | assert::is_transmutable::<Src, Dst, Context, false, {0u8}, false, false>(); - | ^^^ expected `bool`, found `u8` +LL | assert::is_transmutable::<Src, Dst, false, {0u8}, false, false>(); + | ^^^ expected `bool`, found `u8` error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:51:65 + --> $DIR/wrong-type-assume.rs:48:56 | -LL | assert::is_transmutable::<Src, Dst, Context, false, false, {0u8}, false>(); - | ^^^ expected `bool`, found `u8` +LL | assert::is_transmutable::<Src, Dst, false, false, {0u8}, false>(); + | ^^^ expected `bool`, found `u8` error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:52:72 + --> $DIR/wrong-type-assume.rs:49:63 | -LL | assert::is_transmutable::<Src, Dst, Context, false, false, false, {0u8}>(); - | ^^^ expected `bool`, found `u8` +LL | assert::is_transmutable::<Src, Dst, false, false, false, {0u8}>(); + | ^^^ expected `bool`, found `u8` error: aborting due to 4 previous errors diff --git a/tests/ui/transmutability/primitives/bool-mut.rs b/tests/ui/transmutability/primitives/bool-mut.rs index 0a74aba8f63..5f3f4f3a8c5 100644 --- a/tests/ui/transmutability/primitives/bool-mut.rs +++ b/tests/ui/transmutability/primitives/bool-mut.rs @@ -4,11 +4,10 @@ #![feature(transmutability)] mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/primitives/bool-mut.stderr b/tests/ui/transmutability/primitives/bool-mut.stderr index 62a7a2b8622..c4f295fc70a 100644 --- a/tests/ui/transmutability/primitives/bool-mut.stderr +++ b/tests/ui/transmutability/primitives/bool-mut.stderr @@ -1,17 +1,17 @@ -error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context` - --> $DIR/bool-mut.rs:16:50 +error[E0277]: `u8` cannot be safely transmuted into `bool` + --> $DIR/bool-mut.rs:15: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:11:14 + --> $DIR/bool-mut.rs:10:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.current.stderr b/tests/ui/transmutability/primitives/bool.current.stderr index 6dfd83dd514..d6376342c9c 100644 --- a/tests/ui/transmutability/primitives/bool.current.stderr +++ b/tests/ui/transmutability/primitives/bool.current.stderr @@ -1,17 +1,17 @@ -error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context` - --> $DIR/bool.rs:21:35 +error[E0277]: `u8` cannot be safely transmuted into `bool` + --> $DIR/bool.rs:20:35 | LL | assert::is_transmutable::<u8, bool>(); | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` - --> $DIR/bool.rs:11:14 + --> $DIR/bool.rs:10:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.next.stderr b/tests/ui/transmutability/primitives/bool.next.stderr index 6dfd83dd514..d6376342c9c 100644 --- a/tests/ui/transmutability/primitives/bool.next.stderr +++ b/tests/ui/transmutability/primitives/bool.next.stderr @@ -1,17 +1,17 @@ -error[E0277]: `u8` cannot be safely transmuted into `bool` in the defining scope of `assert::Context` - --> $DIR/bool.rs:21:35 +error[E0277]: `u8` cannot be safely transmuted into `bool` + --> $DIR/bool.rs:20:35 | LL | assert::is_transmutable::<u8, bool>(); | ^^^^ At least one value of `u8` isn't a bit-valid value of `bool` | note: required by a bound in `is_transmutable` - --> $DIR/bool.rs:11:14 + --> $DIR/bool.rs:10:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.rs b/tests/ui/transmutability/primitives/bool.rs index b7dc309e469..1be3b28b643 100644 --- a/tests/ui/transmutability/primitives/bool.rs +++ b/tests/ui/transmutability/primitives/bool.rs @@ -4,16 +4,15 @@ #![feature(transmutability)] mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> {} pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/primitives/numbers.current.stderr b/tests/ui/transmutability/primitives/numbers.current.stderr index d12e172971c..7a80e444149 100644 --- a/tests/ui/transmutability/primitives/numbers.current.stderr +++ b/tests/ui/transmutability/primitives/numbers.current.stderr @@ -1,857 +1,857 @@ -error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:65:40 +error[E0277]: `i8` cannot be safely transmuted into `i16` + --> $DIR/numbers.rs:64:40 | LL | assert::is_transmutable::< i8, i16>(); | ^^^ The size of `i8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:66:40 +error[E0277]: `i8` cannot be safely transmuted into `u16` + --> $DIR/numbers.rs:65:40 | LL | assert::is_transmutable::< i8, u16>(); | ^^^ The size of `i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:67:40 +error[E0277]: `i8` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:66:40 | LL | assert::is_transmutable::< i8, i32>(); | ^^^ The size of `i8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:68:40 +error[E0277]: `i8` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:67:40 | LL | assert::is_transmutable::< i8, f32>(); | ^^^ The size of `i8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:69:40 +error[E0277]: `i8` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:68:40 | LL | assert::is_transmutable::< i8, u32>(); | ^^^ The size of `i8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:70:40 +error[E0277]: `i8` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:69:40 | LL | assert::is_transmutable::< i8, u64>(); | ^^^ The size of `i8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:71:40 +error[E0277]: `i8` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:70:40 | LL | assert::is_transmutable::< i8, i64>(); | ^^^ The size of `i8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:72:40 +error[E0277]: `i8` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:71:40 | LL | assert::is_transmutable::< i8, f64>(); | ^^^ The size of `i8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:73:39 +error[E0277]: `i8` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:72:39 | LL | assert::is_transmutable::< i8, u128>(); | ^^^^ The size of `i8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:74:39 +error[E0277]: `i8` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:73:39 | LL | assert::is_transmutable::< i8, i128>(); | ^^^^ The size of `i8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:76:40 +error[E0277]: `u8` cannot be safely transmuted into `i16` + --> $DIR/numbers.rs:75:40 | LL | assert::is_transmutable::< u8, i16>(); | ^^^ The size of `u8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:77:40 +error[E0277]: `u8` cannot be safely transmuted into `u16` + --> $DIR/numbers.rs:76:40 | LL | assert::is_transmutable::< u8, u16>(); | ^^^ The size of `u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:78:40 +error[E0277]: `u8` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:77:40 | LL | assert::is_transmutable::< u8, i32>(); | ^^^ The size of `u8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:79:40 +error[E0277]: `u8` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:78:40 | LL | assert::is_transmutable::< u8, f32>(); | ^^^ The size of `u8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:80:40 +error[E0277]: `u8` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:79:40 | LL | assert::is_transmutable::< u8, u32>(); | ^^^ The size of `u8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:81:40 +error[E0277]: `u8` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:80:40 | LL | assert::is_transmutable::< u8, u64>(); | ^^^ The size of `u8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:82:40 +error[E0277]: `u8` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:81:40 | LL | assert::is_transmutable::< u8, i64>(); | ^^^ The size of `u8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:83:40 +error[E0277]: `u8` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:82:40 | LL | assert::is_transmutable::< u8, f64>(); | ^^^ The size of `u8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:84:39 +error[E0277]: `u8` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:83:39 | LL | assert::is_transmutable::< u8, u128>(); | ^^^^ The size of `u8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:85:39 +error[E0277]: `u8` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:84:39 | LL | assert::is_transmutable::< u8, i128>(); | ^^^^ The size of `u8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:87:40 +error[E0277]: `i16` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:86:40 | LL | assert::is_transmutable::< i16, i32>(); | ^^^ The size of `i16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:88:40 +error[E0277]: `i16` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:87:40 | LL | assert::is_transmutable::< i16, f32>(); | ^^^ The size of `i16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:89:40 +error[E0277]: `i16` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:88:40 | LL | assert::is_transmutable::< i16, u32>(); | ^^^ The size of `i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:90:40 +error[E0277]: `i16` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:89:40 | LL | assert::is_transmutable::< i16, u64>(); | ^^^ The size of `i16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:91:40 +error[E0277]: `i16` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:90:40 | LL | assert::is_transmutable::< i16, i64>(); | ^^^ The size of `i16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:92:40 +error[E0277]: `i16` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:91:40 | LL | assert::is_transmutable::< i16, f64>(); | ^^^ The size of `i16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:93:39 +error[E0277]: `i16` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:92:39 | LL | assert::is_transmutable::< i16, u128>(); | ^^^^ The size of `i16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:94:39 +error[E0277]: `i16` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:93:39 | LL | assert::is_transmutable::< i16, i128>(); | ^^^^ The size of `i16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:96:40 +error[E0277]: `u16` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:95:40 | LL | assert::is_transmutable::< u16, i32>(); | ^^^ The size of `u16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:97:40 +error[E0277]: `u16` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:96:40 | LL | assert::is_transmutable::< u16, f32>(); | ^^^ The size of `u16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:98:40 +error[E0277]: `u16` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:97:40 | LL | assert::is_transmutable::< u16, u32>(); | ^^^ The size of `u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:99:40 +error[E0277]: `u16` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:98:40 | LL | assert::is_transmutable::< u16, u64>(); | ^^^ The size of `u16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:100:40 +error[E0277]: `u16` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:99:40 | LL | assert::is_transmutable::< u16, i64>(); | ^^^ The size of `u16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:101:40 +error[E0277]: `u16` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:100:40 | LL | assert::is_transmutable::< u16, f64>(); | ^^^ The size of `u16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:102:39 +error[E0277]: `u16` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:101:39 | LL | assert::is_transmutable::< u16, u128>(); | ^^^^ The size of `u16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:103:39 +error[E0277]: `u16` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:102:39 | LL | assert::is_transmutable::< u16, i128>(); | ^^^^ The size of `u16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:105:40 +error[E0277]: `i32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:104:40 | LL | assert::is_transmutable::< i32, u64>(); | ^^^ The size of `i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:106:40 +error[E0277]: `i32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:105:40 | LL | assert::is_transmutable::< i32, i64>(); | ^^^ The size of `i32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:107:40 +error[E0277]: `i32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:106:40 | LL | assert::is_transmutable::< i32, f64>(); | ^^^ The size of `i32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:108:39 +error[E0277]: `i32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:107:39 | LL | assert::is_transmutable::< i32, u128>(); | ^^^^ The size of `i32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:109:39 +error[E0277]: `i32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:108:39 | LL | assert::is_transmutable::< i32, i128>(); | ^^^^ The size of `i32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:111:40 +error[E0277]: `f32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:110:40 | LL | assert::is_transmutable::< f32, u64>(); | ^^^ The size of `f32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:112:40 +error[E0277]: `f32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:111:40 | LL | assert::is_transmutable::< f32, i64>(); | ^^^ The size of `f32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:113:40 +error[E0277]: `f32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:112:40 | LL | assert::is_transmutable::< f32, f64>(); | ^^^ The size of `f32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:114:39 +error[E0277]: `f32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:113:39 | LL | assert::is_transmutable::< f32, u128>(); | ^^^^ The size of `f32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:115:39 +error[E0277]: `f32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:114:39 | LL | assert::is_transmutable::< f32, i128>(); | ^^^^ The size of `f32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:117:40 +error[E0277]: `u32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:116:40 | LL | assert::is_transmutable::< u32, u64>(); | ^^^ The size of `u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:118:40 +error[E0277]: `u32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:117:40 | LL | assert::is_transmutable::< u32, i64>(); | ^^^ The size of `u32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:119:40 +error[E0277]: `u32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:118:40 | LL | assert::is_transmutable::< u32, f64>(); | ^^^ The size of `u32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:120:39 +error[E0277]: `u32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:119:39 | LL | assert::is_transmutable::< u32, u128>(); | ^^^^ The size of `u32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:121:39 +error[E0277]: `u32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:120:39 | LL | assert::is_transmutable::< u32, i128>(); | ^^^^ The size of `u32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:123:39 +error[E0277]: `u64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:122:39 | LL | assert::is_transmutable::< u64, u128>(); | ^^^^ The size of `u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:124:39 +error[E0277]: `u64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:123:39 | LL | assert::is_transmutable::< u64, i128>(); | ^^^^ The size of `u64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:126:39 +error[E0277]: `i64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:125:39 | LL | assert::is_transmutable::< i64, u128>(); | ^^^^ The size of `i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:127:39 +error[E0277]: `i64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:126:39 | LL | assert::is_transmutable::< i64, i128>(); | ^^^^ The size of `i64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:129:39 +error[E0277]: `f64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:128:39 | LL | assert::is_transmutable::< f64, u128>(); | ^^^^ The size of `f64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:130:39 +error[E0277]: `f64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:129:39 | LL | assert::is_transmutable::< f64, i128>(); | ^^^^ The size of `f64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 57 previous errors diff --git a/tests/ui/transmutability/primitives/numbers.next.stderr b/tests/ui/transmutability/primitives/numbers.next.stderr index d12e172971c..7a80e444149 100644 --- a/tests/ui/transmutability/primitives/numbers.next.stderr +++ b/tests/ui/transmutability/primitives/numbers.next.stderr @@ -1,857 +1,857 @@ -error[E0277]: `i8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:65:40 +error[E0277]: `i8` cannot be safely transmuted into `i16` + --> $DIR/numbers.rs:64:40 | LL | assert::is_transmutable::< i8, i16>(); | ^^^ The size of `i8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:66:40 +error[E0277]: `i8` cannot be safely transmuted into `u16` + --> $DIR/numbers.rs:65:40 | LL | assert::is_transmutable::< i8, u16>(); | ^^^ The size of `i8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:67:40 +error[E0277]: `i8` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:66:40 | LL | assert::is_transmutable::< i8, i32>(); | ^^^ The size of `i8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:68:40 +error[E0277]: `i8` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:67:40 | LL | assert::is_transmutable::< i8, f32>(); | ^^^ The size of `i8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:69:40 +error[E0277]: `i8` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:68:40 | LL | assert::is_transmutable::< i8, u32>(); | ^^^ The size of `i8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:70:40 +error[E0277]: `i8` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:69:40 | LL | assert::is_transmutable::< i8, u64>(); | ^^^ The size of `i8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:71:40 +error[E0277]: `i8` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:70:40 | LL | assert::is_transmutable::< i8, i64>(); | ^^^ The size of `i8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:72:40 +error[E0277]: `i8` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:71:40 | LL | assert::is_transmutable::< i8, f64>(); | ^^^ The size of `i8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:73:39 +error[E0277]: `i8` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:72:39 | LL | assert::is_transmutable::< i8, u128>(); | ^^^^ The size of `i8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:74:39 +error[E0277]: `i8` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:73:39 | LL | assert::is_transmutable::< i8, i128>(); | ^^^^ The size of `i8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:76:40 +error[E0277]: `u8` cannot be safely transmuted into `i16` + --> $DIR/numbers.rs:75:40 | LL | assert::is_transmutable::< u8, i16>(); | ^^^ The size of `u8` is smaller than the size of `i16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u16` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:77:40 +error[E0277]: `u8` cannot be safely transmuted into `u16` + --> $DIR/numbers.rs:76:40 | LL | assert::is_transmutable::< u8, u16>(); | ^^^ The size of `u8` is smaller than the size of `u16` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:78:40 +error[E0277]: `u8` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:77:40 | LL | assert::is_transmutable::< u8, i32>(); | ^^^ The size of `u8` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:79:40 +error[E0277]: `u8` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:78:40 | LL | assert::is_transmutable::< u8, f32>(); | ^^^ The size of `u8` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:80:40 +error[E0277]: `u8` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:79:40 | LL | assert::is_transmutable::< u8, u32>(); | ^^^ The size of `u8` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:81:40 +error[E0277]: `u8` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:80:40 | LL | assert::is_transmutable::< u8, u64>(); | ^^^ The size of `u8` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:82:40 +error[E0277]: `u8` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:81:40 | LL | assert::is_transmutable::< u8, i64>(); | ^^^ The size of `u8` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:83:40 +error[E0277]: `u8` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:82:40 | LL | assert::is_transmutable::< u8, f64>(); | ^^^ The size of `u8` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:84:39 +error[E0277]: `u8` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:83:39 | LL | assert::is_transmutable::< u8, u128>(); | ^^^^ The size of `u8` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u8` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:85:39 +error[E0277]: `u8` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:84:39 | LL | assert::is_transmutable::< u8, i128>(); | ^^^^ The size of `u8` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:87:40 +error[E0277]: `i16` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:86:40 | LL | assert::is_transmutable::< i16, i32>(); | ^^^ The size of `i16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:88:40 +error[E0277]: `i16` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:87:40 | LL | assert::is_transmutable::< i16, f32>(); | ^^^ The size of `i16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:89:40 +error[E0277]: `i16` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:88:40 | LL | assert::is_transmutable::< i16, u32>(); | ^^^ The size of `i16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:90:40 +error[E0277]: `i16` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:89:40 | LL | assert::is_transmutable::< i16, u64>(); | ^^^ The size of `i16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:91:40 +error[E0277]: `i16` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:90:40 | LL | assert::is_transmutable::< i16, i64>(); | ^^^ The size of `i16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:92:40 +error[E0277]: `i16` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:91:40 | LL | assert::is_transmutable::< i16, f64>(); | ^^^ The size of `i16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:93:39 +error[E0277]: `i16` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:92:39 | LL | assert::is_transmutable::< i16, u128>(); | ^^^^ The size of `i16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:94:39 +error[E0277]: `i16` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:93:39 | LL | assert::is_transmutable::< i16, i128>(); | ^^^^ The size of `i16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:96:40 +error[E0277]: `u16` cannot be safely transmuted into `i32` + --> $DIR/numbers.rs:95:40 | LL | assert::is_transmutable::< u16, i32>(); | ^^^ The size of `u16` is smaller than the size of `i32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `f32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:97:40 +error[E0277]: `u16` cannot be safely transmuted into `f32` + --> $DIR/numbers.rs:96:40 | LL | assert::is_transmutable::< u16, f32>(); | ^^^ The size of `u16` is smaller than the size of `f32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u32` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:98:40 +error[E0277]: `u16` cannot be safely transmuted into `u32` + --> $DIR/numbers.rs:97:40 | LL | assert::is_transmutable::< u16, u32>(); | ^^^ The size of `u16` is smaller than the size of `u32` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:99:40 +error[E0277]: `u16` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:98:40 | LL | assert::is_transmutable::< u16, u64>(); | ^^^ The size of `u16` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:100:40 +error[E0277]: `u16` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:99:40 | LL | assert::is_transmutable::< u16, i64>(); | ^^^ The size of `u16` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:101:40 +error[E0277]: `u16` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:100:40 | LL | assert::is_transmutable::< u16, f64>(); | ^^^ The size of `u16` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:102:39 +error[E0277]: `u16` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:101:39 | LL | assert::is_transmutable::< u16, u128>(); | ^^^^ The size of `u16` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u16` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:103:39 +error[E0277]: `u16` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:102:39 | LL | assert::is_transmutable::< u16, i128>(); | ^^^^ The size of `u16` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:105:40 +error[E0277]: `i32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:104:40 | LL | assert::is_transmutable::< i32, u64>(); | ^^^ The size of `i32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:106:40 +error[E0277]: `i32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:105:40 | LL | assert::is_transmutable::< i32, i64>(); | ^^^ The size of `i32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:107:40 +error[E0277]: `i32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:106:40 | LL | assert::is_transmutable::< i32, f64>(); | ^^^ The size of `i32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:108:39 +error[E0277]: `i32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:107:39 | LL | assert::is_transmutable::< i32, u128>(); | ^^^^ The size of `i32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:109:39 +error[E0277]: `i32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:108:39 | LL | assert::is_transmutable::< i32, i128>(); | ^^^^ The size of `i32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:111:40 +error[E0277]: `f32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:110:40 | LL | assert::is_transmutable::< f32, u64>(); | ^^^ The size of `f32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:112:40 +error[E0277]: `f32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:111:40 | LL | assert::is_transmutable::< f32, i64>(); | ^^^ The size of `f32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:113:40 +error[E0277]: `f32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:112:40 | LL | assert::is_transmutable::< f32, f64>(); | ^^^ The size of `f32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:114:39 +error[E0277]: `f32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:113:39 | LL | assert::is_transmutable::< f32, u128>(); | ^^^^ The size of `f32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:115:39 +error[E0277]: `f32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:114:39 | LL | assert::is_transmutable::< f32, i128>(); | ^^^^ The size of `f32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `u64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:117:40 +error[E0277]: `u32` cannot be safely transmuted into `u64` + --> $DIR/numbers.rs:116:40 | LL | assert::is_transmutable::< u32, u64>(); | ^^^ The size of `u32` is smaller than the size of `u64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `i64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:118:40 +error[E0277]: `u32` cannot be safely transmuted into `i64` + --> $DIR/numbers.rs:117:40 | LL | assert::is_transmutable::< u32, i64>(); | ^^^ The size of `u32` is smaller than the size of `i64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `f64` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:119:40 +error[E0277]: `u32` cannot be safely transmuted into `f64` + --> $DIR/numbers.rs:118:40 | LL | assert::is_transmutable::< u32, f64>(); | ^^^ The size of `u32` is smaller than the size of `f64` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:120:39 +error[E0277]: `u32` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:119:39 | LL | assert::is_transmutable::< u32, u128>(); | ^^^^ The size of `u32` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u32` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:121:39 +error[E0277]: `u32` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:120:39 | LL | assert::is_transmutable::< u32, i128>(); | ^^^^ The size of `u32` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:123:39 +error[E0277]: `u64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:122:39 | LL | assert::is_transmutable::< u64, u128>(); | ^^^^ The size of `u64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `u64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:124:39 +error[E0277]: `u64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:123:39 | LL | assert::is_transmutable::< u64, i128>(); | ^^^^ The size of `u64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:126:39 +error[E0277]: `i64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:125:39 | LL | assert::is_transmutable::< i64, u128>(); | ^^^^ The size of `i64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `i64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:127:39 +error[E0277]: `i64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:126:39 | LL | assert::is_transmutable::< i64, i128>(); | ^^^^ The size of `i64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f64` cannot be safely transmuted into `u128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:129:39 +error[E0277]: `f64` cannot be safely transmuted into `u128` + --> $DIR/numbers.rs:128:39 | LL | assert::is_transmutable::< f64, u128>(); | ^^^^ The size of `f64` is smaller than the size of `u128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `f64` cannot be safely transmuted into `i128` in the defining scope of `assert::Context` - --> $DIR/numbers.rs:130:39 +error[E0277]: `f64` cannot be safely transmuted into `i128` + --> $DIR/numbers.rs:129:39 | LL | assert::is_transmutable::< f64, i128>(); | ^^^^ The size of `f64` is smaller than the size of `i128` | note: required by a bound in `is_transmutable` - --> $DIR/numbers.rs:15:14 + --> $DIR/numbers.rs:14:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 57 previous errors diff --git a/tests/ui/transmutability/primitives/numbers.rs b/tests/ui/transmutability/primitives/numbers.rs index 8baa4b05216..2b7d8a79860 100644 --- a/tests/ui/transmutability/primitives/numbers.rs +++ b/tests/ui/transmutability/primitives/numbers.rs @@ -8,11 +8,10 @@ mod assert { use std::mem::BikeshedIntrinsicFrom; - struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context> + Dst: BikeshedIntrinsicFrom<Src> {} } diff --git a/tests/ui/transmutability/primitives/unit.current.stderr b/tests/ui/transmutability/primitives/unit.current.stderr index e5d8466c323..37088a69698 100644 --- a/tests/ui/transmutability/primitives/unit.current.stderr +++ b/tests/ui/transmutability/primitives/unit.current.stderr @@ -1,16 +1,16 @@ -error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context` - --> $DIR/unit.rs:31:35 +error[E0277]: `()` cannot be safely transmuted into `u8` + --> $DIR/unit.rs:30:35 | -LL | assert::is_transmutable::<(), u8, Context>(); +LL | assert::is_transmutable::<(), u8>(); | ^^ The size of `()` is smaller than the size of `u8` | note: required by a bound in `is_transmutable` --> $DIR/unit.rs:15:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/primitives/unit.next.stderr b/tests/ui/transmutability/primitives/unit.next.stderr index e5d8466c323..37088a69698 100644 --- a/tests/ui/transmutability/primitives/unit.next.stderr +++ b/tests/ui/transmutability/primitives/unit.next.stderr @@ -1,16 +1,16 @@ -error[E0277]: `()` cannot be safely transmuted into `u8` in the defining scope of `should_have_correct_size::Context` - --> $DIR/unit.rs:31:35 +error[E0277]: `()` cannot be safely transmuted into `u8` + --> $DIR/unit.rs:30:35 | -LL | assert::is_transmutable::<(), u8, Context>(); +LL | assert::is_transmutable::<(), u8>(); | ^^ The size of `()` is smaller than the size of `u8` | note: required by a bound in `is_transmutable` --> $DIR/unit.rs:15:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/primitives/unit.rs b/tests/ui/transmutability/primitives/unit.rs index 77240dd340b..24649443565 100644 --- a/tests/ui/transmutability/primitives/unit.rs +++ b/tests/ui/transmutability/primitives/unit.rs @@ -10,9 +10,9 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) @@ -25,8 +25,7 @@ mod assert { struct Zst; fn should_have_correct_size() { - struct Context; - assert::is_transmutable::<(), Zst, Context>(); - assert::is_transmutable::<Zst, (), Context>(); - assert::is_transmutable::<(), u8, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<(), Zst>(); + assert::is_transmutable::<Zst, ()>(); + assert::is_transmutable::<(), u8>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs index 8e005d83a45..ba2db755e3b 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr index 8b22f89c7ef..4b2866dc4f0 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr @@ -1,16 +1,16 @@ -error[E0277]: `&A` cannot be safely transmuted into `&mut B` in the defining scope of `assert::Context` - --> $DIR/recursive-wrapper-types-bit-compatible-mut.rs:24:49 +error[E0277]: `&A` cannot be safely transmuted into `&mut B` + --> $DIR/recursive-wrapper-types-bit-compatible-mut.rs:23:49 | LL | assert::is_maybe_transmutable::<&'static A, &'static mut B>(); | ^^^^^^^^^^^^^^ `&A` is a shared reference, but `&mut B` is a unique reference | note: required by a bound in `is_maybe_transmutable` - --> $DIR/recursive-wrapper-types-bit-compatible-mut.rs:10:14 + --> $DIR/recursive-wrapper-types-bit-compatible-mut.rs:9:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs index 6dd49863609..cd70c278285 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs index bac174014ee..2f264e8339e 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr index 982af825918..305fca30939 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr @@ -1,16 +1,16 @@ -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` - --> $DIR/recursive-wrapper-types-bit-incompatible.rs:24:49 +error[E0277]: `B` cannot be safely transmuted into `A` + --> $DIR/recursive-wrapper-types-bit-incompatible.rs:23:49 | LL | assert::is_maybe_transmutable::<&'static B, &'static A>(); | ^^^^^^^^^^ At least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_maybe_transmutable` - --> $DIR/recursive-wrapper-types-bit-incompatible.rs:10:14 + --> $DIR/recursive-wrapper-types-bit-incompatible.rs:9:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.rs b/tests/ui/transmutability/references/recursive-wrapper-types.rs index 9556a0e76c7..28f4d6661cb 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/u8-to-unit.rs b/tests/ui/transmutability/references/u8-to-unit.rs index bf11372f9cb..017b73d9595 100644 --- a/tests/ui/transmutability/references/u8-to-unit.rs +++ b/tests/ui/transmutability/references/u8-to-unit.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: false, lifetimes: true, diff --git a/tests/ui/transmutability/references/unit-to-itself.rs b/tests/ui/transmutability/references/unit-to-itself.rs index 5c0db04c2e6..40aec8418fe 100644 --- a/tests/ui/transmutability/references/unit-to-itself.rs +++ b/tests/ui/transmutability/references/unit-to-itself.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/unit-to-u8.rs b/tests/ui/transmutability/references/unit-to-u8.rs index ccc401042af..973d3206c12 100644 --- a/tests/ui/transmutability/references/unit-to-u8.rs +++ b/tests/ui/transmutability/references/unit-to-u8.rs @@ -3,11 +3,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/references/unit-to-u8.stderr b/tests/ui/transmutability/references/unit-to-u8.stderr index a0891dfd01e..e2eb50442ca 100644 --- a/tests/ui/transmutability/references/unit-to-u8.stderr +++ b/tests/ui/transmutability/references/unit-to-u8.stderr @@ -1,16 +1,16 @@ -error[E0277]: `Unit` cannot be safely transmuted into `u8` in the defining scope of `assert::Context` - --> $DIR/unit-to-u8.rs:23:52 +error[E0277]: `Unit` cannot be safely transmuted into `u8` + --> $DIR/unit-to-u8.rs:22:52 | LL | assert::is_maybe_transmutable::<&'static Unit, &'static u8>(); | ^^^^^^^^^^^ The size of `Unit` is smaller than the size of `u8` | note: required by a bound in `is_maybe_transmutable` - --> $DIR/unit-to-u8.rs:10:14 + --> $DIR/unit-to-u8.rs:9:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/region-infer.rs b/tests/ui/transmutability/region-infer.rs index 09f60277688..0632bc53176 100644 --- a/tests/ui/transmutability/region-infer.rs +++ b/tests/ui/transmutability/region-infer.rs @@ -1,7 +1,6 @@ #![feature(transmutability)] use std::mem::{Assume, BikeshedIntrinsicFrom}; -pub struct Context; #[repr(C)] struct W<'a>(&'a ()); @@ -10,7 +9,6 @@ fn test<'a>() where W<'a>: BikeshedIntrinsicFrom< (), - Context, { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, { diff --git a/tests/ui/transmutability/region-infer.stderr b/tests/ui/transmutability/region-infer.stderr index 805862d6c4a..5497af2429e 100644 --- a/tests/ui/transmutability/region-infer.stderr +++ b/tests/ui/transmutability/region-infer.stderr @@ -1,11 +1,11 @@ -error[E0277]: `()` cannot be safely transmuted into `W<'_>` in the defining scope of `Context` - --> $DIR/region-infer.rs:20:5 +error[E0277]: `()` cannot be safely transmuted into `W<'_>` + --> $DIR/region-infer.rs:18:5 | LL | test(); | ^^^^^^ The size of `()` is smaller than the size of `W<'_>` | note: required by a bound in `test` - --> $DIR/region-infer.rs:11:12 + --> $DIR/region-infer.rs:10:12 | LL | fn test<'a>() | ---- required by a bound in this function @@ -13,7 +13,6 @@ LL | where LL | W<'a>: BikeshedIntrinsicFrom< | ____________^ LL | | (), -LL | | Context, LL | | { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, LL | | >, | |_________^ required by this bound in `test` diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs new file mode 100644 index 00000000000..cb3c1cdf46c --- /dev/null +++ b/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs @@ -0,0 +1,24 @@ +//@ check-pass + +//! When safety is assumed, a transmutation should be accepted if the +//! destination type might carry a safety invariant. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + {} +} + +fn test() { + type Src = (); + #[repr(C)] + struct Dst; + assert::is_transmutable::<Src, Dst>(); +} diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs new file mode 100644 index 00000000000..b12c4a10d12 --- /dev/null +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs @@ -0,0 +1,26 @@ +//@ check-pass + +//! When safety is assumed, a transmutation over exclusive references should be +//! accepted if the source type potentially carries safety invariants. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + {} +} + +fn test() { + #[repr(C)] + struct Src { + non_zero: u8, + } + type Dst = u8; + assert::is_transmutable::<&mut Src, &mut Dst>(); +} diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs new file mode 100644 index 00000000000..ff01462ffec --- /dev/null +++ b/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs @@ -0,0 +1,24 @@ +//@ check-pass + +//! The presence of safety invariants in the source type does not affect +//! transmutability. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + {} +} + +fn test() { + #[repr(C)] + struct Src; + type Dst = (); + assert::is_transmutable::<Src, Dst>(); +} diff --git a/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs new file mode 100644 index 00000000000..d516e9a7da5 --- /dev/null +++ b/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs @@ -0,0 +1,24 @@ +//@ check-pass + +//! The presence of safety invariants in the source type does not affect +//! transmutability. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + {} +} + +fn test() { + #[repr(C)] + struct Src; + type Dst = (); + assert::is_transmutable::<Src, Dst>(); +} diff --git a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs new file mode 100644 index 00000000000..4f0aee31548 --- /dev/null +++ b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs @@ -0,0 +1,22 @@ +//! Unless safety is assumed, a transmutation should be rejected if the +//! destination type may have a safety invariant. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + {} +} + +fn test() { + type Src = (); + #[repr(C)] + struct Dst; + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted +} diff --git a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr new file mode 100644 index 00000000000..2339c268326 --- /dev/null +++ b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr @@ -0,0 +1,18 @@ +error[E0277]: `()` cannot be safely transmuted into `Dst` + --> $DIR/should_reject_if_dst_has_safety_invariant.rs:21:36 + | +LL | assert::is_transmutable::<Src, Dst>(); + | ^^^ `Dst` may carry safety invariants + | +note: required by a bound in `is_transmutable` + --> $DIR/should_reject_if_dst_has_safety_invariant.rs:13:14 + | +LL | pub fn is_transmutable<Src, Dst>() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs new file mode 100644 index 00000000000..126059dd7b7 --- /dev/null +++ b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs @@ -0,0 +1,24 @@ +//! Unless safety is assumed, a transmutation over exclusive references should +//! be rejected if the source potentially carries safety invariants. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable<Src, Dst>() + where + Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + {} +} + +fn test() { + #[repr(C)] + struct Src { + non_zero: u8, + } + type Dst = u8; + assert::is_transmutable::<&mut Src, &mut Dst>(); //~ ERROR cannot be safely transmuted +} diff --git a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr new file mode 100644 index 00000000000..99feebe9211 --- /dev/null +++ b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr @@ -0,0 +1,18 @@ +error[E0277]: `u8` cannot be safely transmuted into `Src` + --> $DIR/should_reject_if_ref_src_has_safety_invariant.rs:23:41 + | +LL | assert::is_transmutable::<&mut Src, &mut Dst>(); + | ^^^^^^^^ `Src` may carry safety invariants + | +note: required by a bound in `is_transmutable` + --> $DIR/should_reject_if_ref_src_has_safety_invariant.rs:13:14 + | +LL | pub fn is_transmutable<Src, Dst>() + | --------------- required by a bound in this function +LL | where +LL | Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/structs/repr/should_handle_align.rs b/tests/ui/transmutability/structs/repr/should_handle_align.rs index ca18e0f1543..0c207766045 100644 --- a/tests/ui/transmutability/structs/repr/should_handle_align.rs +++ b/tests/ui/transmutability/structs/repr/should_handle_align.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/should_handle_packed.rs b/tests/ui/transmutability/structs/repr/should_handle_packed.rs index dcd4e5b80eb..4af32d6e84e 100644 --- a/tests/ui/transmutability/structs/repr/should_handle_packed.rs +++ b/tests/ui/transmutability/structs/repr/should_handle_packed.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.rs b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.rs index 9a65b4d702d..2e673601baf 100644 --- a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.rs +++ b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.rs @@ -6,11 +6,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr index 4c5062cd3b3..924422de538 100644 --- a/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/structs/repr/should_require_well_defined_layout.stderr @@ -1,16 +1,16 @@ -error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:28:52 +error[E0277]: `should_reject_repr_rust::unit::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:27:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -20,19 +20,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:29:47 +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::unit::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:28:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `should_reject_repr_rust::unit::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -42,19 +42,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:34:52 +error[E0277]: `should_reject_repr_rust::tuple::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:33:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -64,19 +64,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:35:47 +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::tuple::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:34:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `should_reject_repr_rust::tuple::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -86,19 +86,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:40:52 +error[E0277]: `should_reject_repr_rust::braces::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:39:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -108,19 +108,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:41:47 +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::braces::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:40:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `should_reject_repr_rust::braces::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -130,19 +130,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:46:52 +error[E0277]: `aligned::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:45:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `aligned::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -152,19 +152,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:47:47 +error[E0277]: `u128` cannot be safely transmuted into `aligned::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:46:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `aligned::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -174,19 +174,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:52:52 +error[E0277]: `packed::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:51:52 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `packed::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -196,19 +196,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:53:47 +error[E0277]: `u128` cannot be safely transmuted into `packed::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:52:47 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `packed::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -218,19 +218,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:59:49 +error[E0277]: `nested::repr_c` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:58:49 | LL | assert::is_maybe_transmutable::<repr_c, ()>(); | ^^ `nested::repr_c` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -240,19 +240,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:60:47 +error[E0277]: `u128` cannot be safely transmuted into `nested::repr_c` + --> $DIR/should_require_well_defined_layout.rs:59:47 | LL | assert::is_maybe_transmutable::<u128, repr_c>(); | ^^^^^^ `nested::repr_c` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs index 0be5b41c80b..4c285a616b3 100644 --- a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs +++ b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs @@ -8,11 +8,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context>, + Dst: BikeshedIntrinsicFrom<Src>, { } } diff --git a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr index 0dedd5aaf73..7fb051f6625 100644 --- a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr +++ b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `ExplicitlyPadded` has infinite size - --> $DIR/transmute_infinitely_recursive_type.rs:22:5 + --> $DIR/transmute_infinitely_recursive_type.rs:21:5 | LL | struct ExplicitlyPadded(ExplicitlyPadded); | ^^^^^^^^^^^^^^^^^^^^^^^ ---------------- recursive without indirection @@ -12,7 +12,7 @@ LL | struct ExplicitlyPadded(Box<ExplicitlyPadded>); error[E0391]: cycle detected when computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded` | = note: ...which immediately requires computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded` again - = note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::BikeshedIntrinsicFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, assert::Context, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` + = note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::BikeshedIntrinsicFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` = 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: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/structs/should_order_fields_correctly.rs b/tests/ui/transmutability/structs/should_order_fields_correctly.rs index bda5bfb89a2..3675e4330ec 100644 --- a/tests/ui/transmutability/structs/should_order_fields_correctly.rs +++ b/tests/ui/transmutability/structs/should_order_fields_correctly.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmute/transmute-padding-ice.rs b/tests/ui/transmutability/transmute-padding-ice.rs index a1be7075a8a..3f3f75bc086 100644 --- a/tests/ui/transmute/transmute-padding-ice.rs +++ b/tests/ui/transmutability/transmute-padding-ice.rs @@ -4,13 +4,11 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where Dst: BikeshedIntrinsicFrom< Src, - Context, { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, { diff --git a/tests/ui/transmute/transmute-padding-ice.stderr b/tests/ui/transmutability/transmute-padding-ice.stderr index ff5c5c3a5dd..c48a5cd80ce 100644 --- a/tests/ui/transmute/transmute-padding-ice.stderr +++ b/tests/ui/transmutability/transmute-padding-ice.stderr @@ -1,11 +1,11 @@ -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` - --> $DIR/transmute-padding-ice.rs:27:40 +error[E0277]: `B` cannot be safely transmuted into `A` + --> $DIR/transmute-padding-ice.rs:25:40 | LL | assert::is_maybe_transmutable::<B, A>(); | ^ The size of `B` is smaller than the size of `A` | note: required by a bound in `is_maybe_transmutable` - --> $DIR/transmute-padding-ice.rs:11:14 + --> $DIR/transmute-padding-ice.rs:10:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function @@ -13,7 +13,6 @@ LL | where LL | Dst: BikeshedIntrinsicFrom< | ______________^ LL | | Src, -LL | | Context, LL | | { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, LL | | >, | |_________^ required by this bound in `is_maybe_transmutable` diff --git a/tests/ui/transmutability/unions/boolish.rs b/tests/ui/transmutability/unions/boolish.rs index 9ab5f2be59a..0ba59bcaa9f 100644 --- a/tests/ui/transmutability/unions/boolish.rs +++ b/tests/ui/transmutability/unions/boolish.rs @@ -8,11 +8,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/unions/repr/should_handle_align.rs b/tests/ui/transmutability/unions/repr/should_handle_align.rs index 652158ecf52..8668cca3cb5 100644 --- a/tests/ui/transmutability/unions/repr/should_handle_align.rs +++ b/tests/ui/transmutability/unions/repr/should_handle_align.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/repr/should_handle_packed.rs b/tests/ui/transmutability/unions/repr/should_handle_packed.rs index 173fec9ff0c..4af6c1d3a61 100644 --- a/tests/ui/transmutability/unions/repr/should_handle_packed.rs +++ b/tests/ui/transmutability/unions/repr/should_handle_packed.rs @@ -7,11 +7,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.rs b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.rs index b1d5f71dcc5..8495b0ea88f 100644 --- a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.rs +++ b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.rs @@ -6,11 +6,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr index 4293d34f47b..ee0e8a66434 100644 --- a/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/unions/repr/should_require_well_defined_layout.stderr @@ -1,16 +1,16 @@ -error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:30:48 +error[E0277]: `should_reject_repr_rust::repr_rust` cannot be safely transmuted into `()` + --> $DIR/should_require_well_defined_layout.rs:29:48 | LL | assert::is_maybe_transmutable::<repr_rust, ()>(); | ^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -20,19 +20,19 @@ LL | | } LL | | }> | |__________^ required by this bound in `is_maybe_transmutable` -error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` in the defining scope of `assert::Context` - --> $DIR/should_require_well_defined_layout.rs:31:43 +error[E0277]: `u128` cannot be safely transmuted into `should_reject_repr_rust::repr_rust` + --> $DIR/should_require_well_defined_layout.rs:30:43 | LL | assert::is_maybe_transmutable::<u128, repr_rust>(); | ^^^^^^^^^ `should_reject_repr_rust::repr_rust` does not have a well-specified layout | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_require_well_defined_layout.rs:13:14 + --> $DIR/should_require_well_defined_layout.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/unions/should_pad_variants.rs b/tests/ui/transmutability/unions/should_pad_variants.rs index cabe544677e..1e4d2db8f74 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.rs +++ b/tests/ui/transmutability/unions/should_pad_variants.rs @@ -8,9 +8,9 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub fn is_transmutable<Src, Dst, Context>() + pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { + Dst: BikeshedIntrinsicFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) @@ -38,8 +38,7 @@ union Lopsided { #[repr(C)] struct Dst(V0, Lopsided, V2); fn should_pad_variants() { - struct Context; // If the implementation (incorrectly) fails to pad `Lopsided::smol` with // an uninitialized byte, this transmutation might be (wrongly) accepted: - assert::is_transmutable::<Src, Dst, Context>(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/unions/should_pad_variants.stderr b/tests/ui/transmutability/unions/should_pad_variants.stderr index fd98e355fb9..13b4c8053ad 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.stderr +++ b/tests/ui/transmutability/unions/should_pad_variants.stderr @@ -1,16 +1,16 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context` - --> $DIR/should_pad_variants.rs:44:36 +error[E0277]: `Src` cannot be safely transmuted into `Dst` + --> $DIR/should_pad_variants.rs:43:36 | -LL | assert::is_transmutable::<Src, Dst, Context>(); +LL | assert::is_transmutable::<Src, Dst>(); | ^^^ The size of `Src` is smaller than the size of `Dst` | note: required by a bound in `is_transmutable` --> $DIR/should_pad_variants.rs:13:14 | -LL | pub fn is_transmutable<Src, Dst, Context>() +LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { +LL | Dst: BikeshedIntrinsicFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs b/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs index 82cf3aba8a7..7efe9ac70f1 100644 --- a/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs +++ b/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs @@ -8,11 +8,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_contraction.rs b/tests/ui/transmutability/unions/should_reject_contraction.rs index a24dfccd318..62a0ee92919 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.rs +++ b/tests/ui/transmutability/unions/should_reject_contraction.rs @@ -6,11 +6,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_contraction.stderr b/tests/ui/transmutability/unions/should_reject_contraction.stderr index e3493e18489..a3e387a0f84 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.stderr +++ b/tests/ui/transmutability/unions/should_reject_contraction.stderr @@ -1,17 +1,17 @@ -error[E0277]: `Superset` cannot be safely transmuted into `Subset` in the defining scope of `assert::Context` - --> $DIR/should_reject_contraction.rs:35:41 +error[E0277]: `Superset` cannot be safely transmuted into `Subset` + --> $DIR/should_reject_contraction.rs:34:41 | LL | assert::is_transmutable::<Superset, Subset>(); | ^^^^^^ At least one value of `Superset` isn't a bit-valid value of `Subset` | note: required by a bound in `is_transmutable` - --> $DIR/should_reject_contraction.rs:13:14 + --> $DIR/should_reject_contraction.rs:12:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.rs b/tests/ui/transmutability/unions/should_reject_disjoint.rs index 43aaa6905fd..732f92e8160 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.rs +++ b/tests/ui/transmutability/unions/should_reject_disjoint.rs @@ -6,11 +6,10 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index 178ae6f08c4..447ab6d9de7 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -1,32 +1,32 @@ -error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context` - --> $DIR/should_reject_disjoint.rs:33:40 +error[E0277]: `A` cannot be safely transmuted into `B` + --> $DIR/should_reject_disjoint.rs:32:40 | LL | assert::is_maybe_transmutable::<A, B>(); | ^ At least one value of `A` isn't a bit-valid value of `B` | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_reject_disjoint.rs:13:14 + --> $DIR/should_reject_disjoint.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` - --> $DIR/should_reject_disjoint.rs:34:40 +error[E0277]: `B` cannot be safely transmuted into `A` + --> $DIR/should_reject_disjoint.rs:33:40 | LL | assert::is_maybe_transmutable::<B, A>(); | ^ At least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_maybe_transmutable` - --> $DIR/should_reject_disjoint.rs:13:14 + --> $DIR/should_reject_disjoint.rs:12:14 | LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY.and(Assume::VALIDITY) }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.rs b/tests/ui/transmutability/unions/should_reject_intersecting.rs index 9cd4233ee74..752a606c861 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.rs +++ b/tests/ui/transmutability/unions/should_reject_intersecting.rs @@ -7,12 +7,11 @@ mod assert { use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // validity is NOT assumed --------------^^^^^^^^^^^^^^^^^^ + Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + // validity is NOT assumed -----^^^^^^^^^^^^^^^^^^ {} } diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index 73c29ab1c97..f0763bc8be7 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -1,32 +1,32 @@ -error[E0277]: `A` cannot be safely transmuted into `B` in the defining scope of `assert::Context` - --> $DIR/should_reject_intersecting.rs:36:34 +error[E0277]: `A` cannot be safely transmuted into `B` + --> $DIR/should_reject_intersecting.rs:35:34 | LL | assert::is_transmutable::<A, B>(); | ^ At least one value of `A` isn't a bit-valid value of `B` | note: required by a bound in `is_transmutable` - --> $DIR/should_reject_intersecting.rs:14:14 + --> $DIR/should_reject_intersecting.rs:13:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error[E0277]: `B` cannot be safely transmuted into `A` in the defining scope of `assert::Context` - --> $DIR/should_reject_intersecting.rs:37:34 +error[E0277]: `B` cannot be safely transmuted into `A` + --> $DIR/should_reject_intersecting.rs:36:34 | LL | assert::is_transmutable::<B, A>(); | ^ At least one value of `B` isn't a bit-valid value of `A` | note: required by a bound in `is_transmutable` - --> $DIR/should_reject_intersecting.rs:14:14 + --> $DIR/should_reject_intersecting.rs:13:14 | LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs deleted file mode 100644 index fa5569325b3..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_field.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ check-pass -//! If visibility is assumed, a transmutation should be accepted even if the -//! destination type contains a private field. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ - {} -} - -mod src { - #[repr(C)] pub(self) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(self) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(self) field: Zst, // <- private field - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs deleted file mode 100644 index 8ff8e2de0e6..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_private_variant.rs +++ /dev/null @@ -1,39 +0,0 @@ -//@ check-pass -//! If visibility is assumed, a transmutation should be accepted even if the -//! destination type contains a private variant. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ - {} -} - -mod src { - #[repr(C)] pub(self) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(self) field: Zst, - } -} - -mod dst { - #[derive(Copy, Clone)] - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) union Dst { - pub(self) field: Zst, // <- private variant - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs deleted file mode 100644 index b9cf66ec310..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_tricky_unreachable_field.rs +++ /dev/null @@ -1,46 +0,0 @@ -//@ check-pass -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) -//! -//! This test exercises a tricky-to-implement instance of this principle: the -//! "pub-in-priv trick". In the below example, the type `dst::private::Zst` is -//! unreachable from `Context`. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - mod private { - #[repr(C)] pub struct Zst; // <- unreachable type - } - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: private::Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs deleted file mode 100644 index a56145f59d8..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.rs +++ /dev/null @@ -1,41 +0,0 @@ -//@ check-pass - -//! If visibility is assumed, a transmutation should be accepted even if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ - {} -} - -mod src { - #[repr(C)] pub(self) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(self) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(self) struct Zst; // <- unreachable type - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, //~ WARNING type `dst::Zst` is more private than the item `Dst::field` - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr deleted file mode 100644 index 80099388d63..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_field.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: type `dst::Zst` is more private than the item `Dst::field` - --> $DIR/should_accept_if_dst_has_unreachable_field.rs:34:9 - | -LL | pub(in super) field: Zst, - | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Dst::field` is reachable at visibility `pub(crate)` - | -note: but type `dst::Zst` is only usable at visibility `pub(self)` - --> $DIR/should_accept_if_dst_has_unreachable_field.rs:31:16 - | -LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type - | ^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(private_interfaces)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs deleted file mode 100644 index b9b74d18338..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.rs +++ /dev/null @@ -1,40 +0,0 @@ -//! If visibility is assumed, a transmutation should be accepted even if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }> - // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^ - {} -} - -mod src { - #[repr(C)] pub(self) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(self) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - // unreachable type - #[repr(C)] pub(self) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR `Dst` is private -} diff --git a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.stderr deleted file mode 100644 index cf94d72b883..00000000000 --- a/tests/ui/transmutability/visibility/assume/should_accept_if_dst_has_unreachable_ty.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0603]: struct `Dst` is private - --> $DIR/should_accept_if_dst_has_unreachable_ty.rs:39:46 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^ private struct - | -note: the struct `Dst` is defined here - --> $DIR/should_accept_if_dst_has_unreachable_ty.rs:32:16 - | -LL | #[repr(C)] pub(self) struct Dst { - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs deleted file mode 100644 index 22392c53905..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_private_field.rs +++ /dev/null @@ -1,37 +0,0 @@ -//@ check-pass -//! The presence of a private field in the source type does not affect -//! transmutability. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(self) field: Zst, // <- private field - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs deleted file mode 100644 index 876db7c6589..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ check-pass -//! The presence of a private variant in the source type does not affect -//! transmutability. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[derive(Copy, Clone)] - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) union Src { - pub(self) field: Zst, // <- private variant - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs deleted file mode 100644 index 8b6db9ff150..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.rs +++ /dev/null @@ -1,39 +0,0 @@ -//@ check-pass - -//! The presence of an unreachable field in the source type (e.g., a public -//! field with a private type does not affect transmutability. (This rule is -//! distinct from type privacy, which still may forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(self) struct Zst; // <- unreachable type - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, //~ WARNING type `src::Zst` is more private than the item `Src::field` - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr deleted file mode 100644 index 55fb3392305..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_field.stderr +++ /dev/null @@ -1,15 +0,0 @@ -warning: type `src::Zst` is more private than the item `Src::field` - --> $DIR/should_accept_if_src_has_unreachable_field.rs:24:9 - | -LL | pub(in super) field: Zst, - | ^^^^^^^^^^^^^^^^^^^^^^^^ field `Src::field` is reachable at visibility `pub(crate)` - | -note: but type `src::Zst` is only usable at visibility `pub(self)` - --> $DIR/should_accept_if_src_has_unreachable_field.rs:21:16 - | -LL | #[repr(C)] pub(self) struct Zst; // <- unreachable type - | ^^^^^^^^^^^^^^^^^^^^ - = note: `#[warn(private_interfaces)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs deleted file mode 100644 index acf9f230250..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! The presence of an unreachable source type (i.e., the source type is -//! private) does not affect transmutability. (This rule is distinct from type -//! privacy, which still may forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - // unreachable type - #[repr(C)] pub(self) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR `Src` is private -} diff --git a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr deleted file mode 100644 index 57ceac61f16..00000000000 --- a/tests/ui/transmutability/visibility/should_accept_if_src_has_unreachable_ty.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0603]: struct `Src` is private - --> $DIR/should_accept_if_src_has_unreachable_ty.rs:37:36 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^ private struct - | -note: the struct `Src` is defined here - --> $DIR/should_accept_if_src_has_unreachable_ty.rs:22:16 - | -LL | #[repr(C)] pub(self) struct Src { - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs deleted file mode 100644 index e8c3fbc9a04..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains a private field. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Dst { - pub(self) field: Zst, // <- private field - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR cannot be safely transmuted -} diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr deleted file mode 100644 index cb2e7ec29a5..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` - --> $DIR/should_reject_if_dst_has_private_field.rs:35:41 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope - | -note: required by a bound in `is_transmutable` - --> $DIR/should_reject_if_dst_has_private_field.rs:13:14 - | -LL | pub fn is_transmutable<Src, Dst, Context>() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs deleted file mode 100644 index 47bca27abaa..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains a private variant. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - #[derive(Copy, Clone)] - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) union Dst { - pub(self) field: Zst, // <- private variant - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR cannot be safely transmuted -} diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr deleted file mode 100644 index 434c3fcd278..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` - --> $DIR/should_reject_if_dst_has_private_variant.rs:36:41 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope - | -note: required by a bound in `is_transmutable` - --> $DIR/should_reject_if_dst_has_private_variant.rs:13:14 - | -LL | pub fn is_transmutable<Src, Dst, Context>() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs b/tests/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs deleted file mode 100644 index 9b7b940ca69..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_tricky_unreachable_field.rs +++ /dev/null @@ -1,51 +0,0 @@ -//@ check-pass -//! NOTE: This test documents a known-bug in the implementation of the -//! transmutability trait. Once fixed, the above "check-pass" header should be -//! removed, and an "ERROR cannot be safely transmuted" annotation should be added at the end -//! of the line starting with `assert::is_transmutable`. -//! -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) -//! -//! This test exercises a tricky-to-implement instance of this principle: the -//! "pub-in-priv trick". In the below example, the type `dst::private::Zst` is -//! unreachable from `Context`. Consequently, the transmute from `Src` to `Dst` -//! SHOULD be rejected. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - mod private { - #[repr(C)] pub struct Zst; // <- unreachable type - } - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: private::Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); -} diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs deleted file mode 100644 index d7e21676fd3..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.rs +++ /dev/null @@ -1,38 +0,0 @@ -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(self) struct Zst; // <- unreachable type - - #[repr(C)] pub(in super) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR cannot be safely transmuted -} diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr deleted file mode 100644 index e987aa595b9..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` - --> $DIR/should_reject_if_dst_has_unreachable_field.rs:37:41 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope - | -note: required by a bound in `is_transmutable` - --> $DIR/should_reject_if_dst_has_unreachable_field.rs:15:14 - | -LL | pub fn is_transmutable<Src, Dst, Context>() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs deleted file mode 100644 index c7b59f15b99..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Unless visibility is assumed, a transmutation should be rejected if the -//! destination type contains an unreachable field (e.g., a public field with a -//! private type). (This rule is distinct from type privacy, which still may -//! forbid naming such types.) - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::BikeshedIntrinsicFrom; - - pub fn is_transmutable<Src, Dst, Context>() - where - Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - {} -} - -mod src { - #[repr(C)] pub(in super) struct Zst; - - #[repr(C)] pub(in super) struct Src { - pub(in super) field: Zst, - } -} - -mod dst { - #[repr(C)] pub(in super) struct Zst; - - // unreachable type - #[repr(C)] pub(self) struct Dst { - pub(in super) field: Zst, - } -} - -fn test() { - struct Context; - assert::is_transmutable::<src::Src, dst::Dst, Context>(); - //~^ ERROR `Dst` is private - //~| ERROR cannot be safely transmuted -} diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr deleted file mode 100644 index ea488980cdd..00000000000 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0603]: struct `Dst` is private - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:38:46 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^ private struct - | -note: the struct `Dst` is defined here - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:31:16 - | -LL | #[repr(C)] pub(self) struct Dst { - | ^^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `test::Context` - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:38:41 - | -LL | assert::is_transmutable::<src::Src, dst::Dst, Context>(); - | ^^^^^^^^ `Dst` is or contains a type or field that is not visible in that scope - | -note: required by a bound in `is_transmutable` - --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:15:14 - | -LL | pub fn is_transmutable<Src, Dst, Context>() - | --------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, Context> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0603. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs index b2842df150a..4b5f455e381 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs @@ -11,6 +11,7 @@ fn foo<'a, 'b>() -> Tait<'a> { } let x: Tait<'a> = (); x + //~^ ERROR concrete type differs from previous defining opaque type use } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr index e5cee49cf29..6f5be5467f7 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr @@ -1,4 +1,16 @@ error: concrete type differs from previous defining opaque type use + --> $DIR/different_defining_uses_never_type-2.rs:13:5 + | +LL | x + | ^ expected `i32`, got `()` + | +note: previous use here + --> $DIR/different_defining_uses_never_type-2.rs:8:31 + | +LL | let y: Tait<'b> = 1i32; + | ^^^^ + +error: concrete type differs from previous defining opaque type use --> $DIR/different_defining_uses_never_type-2.rs:8:31 | LL | let y: Tait<'b> = 1i32; @@ -10,5 +22,5 @@ note: previous use here LL | if { return } { | ^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr b/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr index 4acc47eaef2..9d38e8f36b1 100644 --- a/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr +++ b/tests/ui/type-alias-impl-trait/itiat-allow-nested-closures.bad.stderr @@ -8,6 +8,9 @@ LL | let _: i32 = closure(); | --- ^^^^^^^^^ expected `i32`, found opaque type | | | expected due to this + | + = note: expected type `i32` + found opaque type `<() as Foo>::Assoc` error[E0308]: mismatched types --> $DIR/itiat-allow-nested-closures.rs:22:9 diff --git a/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.rs b/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.rs new file mode 100644 index 00000000000..7a923179d3b --- /dev/null +++ b/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.rs @@ -0,0 +1,11 @@ +struct What<W = usize, X = Vec<W>>(W, X); + +fn main() { + let mut b: What<usize> = What(5, vec![1, 2, 3]); + let c: What<usize, String> = What(1, String::from("meow")); + b = c; //~ ERROR mismatched types + + let mut f: What<usize, Vec<String>> = What(1, vec![String::from("meow")]); + let e: What<usize> = What(5, vec![1, 2, 3]); + f = e; //~ ERROR mismatched types +} diff --git a/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.stderr b/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.stderr new file mode 100644 index 00000000000..d2b3397fbcb --- /dev/null +++ b/tests/ui/type/clarify-error-for-generics-with-default-issue-120785.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/clarify-error-for-generics-with-default-issue-120785.rs:6:9 + | +LL | let mut b: What<usize> = What(5, vec![1, 2, 3]); + | ----------- expected due to this type +LL | let c: What<usize, String> = What(1, String::from("meow")); +LL | b = c; + | ^ expected `What`, found `What<usize, String>` + | + = note: expected struct `What<_, Vec<usize>>` + found struct `What<_, String>` + +error[E0308]: mismatched types + --> $DIR/clarify-error-for-generics-with-default-issue-120785.rs:10:9 + | +LL | let mut f: What<usize, Vec<String>> = What(1, vec![String::from("meow")]); + | ------------------------ expected due to this type +LL | let e: What<usize> = What(5, vec![1, 2, 3]); +LL | f = e; + | ^ expected `What<usize, Vec<String>>`, found `What` + | + = note: expected struct `What<_, Vec<String>>` + found struct `What<_, Vec<usize>>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/invalid-stashed-level-issue-121812.rs b/tests/ui/typeck/invalid-stashed-level-issue-121812.rs new file mode 100644 index 00000000000..4b61f4f2c63 --- /dev/null +++ b/tests/ui/typeck/invalid-stashed-level-issue-121812.rs @@ -0,0 +1,8 @@ +union U { + a: u16, + b: [u8; 3], +} + +fn main() { + _ = U { b: [()] }; //~ ERROR mismatched types +} diff --git a/tests/ui/typeck/invalid-stashed-level-issue-121812.stderr b/tests/ui/typeck/invalid-stashed-level-issue-121812.stderr new file mode 100644 index 00000000000..9465935c8c2 --- /dev/null +++ b/tests/ui/typeck/invalid-stashed-level-issue-121812.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/invalid-stashed-level-issue-121812.rs:7:17 + | +LL | _ = U { b: [()] }; + | ^^ expected `u8`, found `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed index b53d9d61d67..9b935b16678 100644 --- a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed +++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.fixed @@ -8,6 +8,8 @@ trait Trait { type Assoc where u32: Copy; // Fine. type Assoc2 where u32: Copy, i32: Copy; + // + type Assoc3; } impl Trait for u32 { @@ -17,6 +19,8 @@ impl Trait for u32 { // Not fine, suggests moving `u32: Copy` type Assoc2 = () where i32: Copy, u32: Copy; //~^ WARNING where clause not allowed here + type Assoc3 = () where; + //~^ WARNING where clause not allowed here } impl Trait for i32 { @@ -25,6 +29,8 @@ impl Trait for i32 { // Not fine, suggests moving both. type Assoc2 = () where u32: Copy, i32: Copy; //~^ WARNING where clause not allowed here + type Assoc3 = () where; + //~^ WARNING where clause not allowed here } fn main() {} diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs index 18955dd8bcc..b7a8ab3d4f7 100644 --- a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs +++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs @@ -8,6 +8,8 @@ trait Trait { type Assoc where u32: Copy; // Fine. type Assoc2 where u32: Copy, i32: Copy; + // + type Assoc3; } impl Trait for u32 { @@ -17,6 +19,8 @@ impl Trait for u32 { // Not fine, suggests moving `u32: Copy` type Assoc2 where u32: Copy = () where i32: Copy; //~^ WARNING where clause not allowed here + type Assoc3 where = (); + //~^ WARNING where clause not allowed here } impl Trait for i32 { @@ -25,6 +29,8 @@ impl Trait for i32 { // Not fine, suggests moving both. type Assoc2 where u32: Copy, i32: Copy = (); //~^ WARNING where clause not allowed here + type Assoc3 where = () where; + //~^ WARNING where clause not allowed here } fn main() {} diff --git a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr index 6ff9d2dd73b..5809ff8f803 100644 --- a/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr +++ b/tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.stderr @@ -1,5 +1,5 @@ warning: where clause not allowed here - --> $DIR/where-clause-placement-assoc-type-in-impl.rs:15:16 + --> $DIR/where-clause-placement-assoc-type-in-impl.rs:17:16 | LL | type Assoc where u32: Copy = (); | ^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL + type Assoc = () where u32: Copy; | warning: where clause not allowed here - --> $DIR/where-clause-placement-assoc-type-in-impl.rs:18:17 + --> $DIR/where-clause-placement-assoc-type-in-impl.rs:20:17 | LL | type Assoc2 where u32: Copy = () where i32: Copy; | ^^^^^^^^^^^^^^^ @@ -26,7 +26,20 @@ LL + type Assoc2 = () where i32: Copy, u32: Copy; | warning: where clause not allowed here - --> $DIR/where-clause-placement-assoc-type-in-impl.rs:26:17 + --> $DIR/where-clause-placement-assoc-type-in-impl.rs:22:17 + | +LL | type Assoc3 where = (); + | ^^^^^ + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information +help: move it to the end of the type declaration + | +LL - type Assoc3 where = (); +LL + type Assoc3 = () where; + | + +warning: where clause not allowed here + --> $DIR/where-clause-placement-assoc-type-in-impl.rs:30:17 | LL | type Assoc2 where u32: Copy, i32: Copy = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,5 +51,13 @@ LL - type Assoc2 where u32: Copy, i32: Copy = (); LL + type Assoc2 = () where u32: Copy, i32: Copy; | -warning: 3 warnings emitted +warning: where clause not allowed here + --> $DIR/where-clause-placement-assoc-type-in-impl.rs:32:17 + | +LL | type Assoc3 where = () where; + | ^^^^^ help: remove this `where` + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information + +warning: 5 warnings emitted |
