diff options
Diffstat (limited to 'tests')
48 files changed, 660 insertions, 135 deletions
diff --git a/tests/assembly/riscv-soft-abi-with-float-features.rs b/tests/assembly/riscv-soft-abi-with-float-features.rs index 6d6001af084..8ccfa72a7b6 100644 --- a/tests/assembly/riscv-soft-abi-with-float-features.rs +++ b/tests/assembly/riscv-soft-abi-with-float-features.rs @@ -2,7 +2,7 @@ //@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d //@ needs-llvm-components: riscv //@ revisions: LLVM-PRE-20 LLVM-POST-20 -//@ [LLVM-PRE-20] ignore-llvm-version: 20 - 99 +//@ [LLVM-PRE-20] max-llvm-major-version: 19 //@ [LLVM-POST-20] min-llvm-version: 20 #![feature(no_core, lang_items, f16)] diff --git a/tests/assembly/x86_64-cmp.rs b/tests/assembly/x86_64-cmp.rs index 67b7ff99ae2..8cccab7d40d 100644 --- a/tests/assembly/x86_64-cmp.rs +++ b/tests/assembly/x86_64-cmp.rs @@ -1,7 +1,7 @@ //@ revisions: DEBUG LLVM-PRE-20-OPTIM LLVM-20-OPTIM //@ [DEBUG] compile-flags: -C opt-level=0 //@ [LLVM-PRE-20-OPTIM] compile-flags: -C opt-level=3 -//@ [LLVM-PRE-20-OPTIM] ignore-llvm-version: 20 - 99 +//@ [LLVM-PRE-20-OPTIM] max-llvm-major-version: 19 //@ [LLVM-20-OPTIM] compile-flags: -C opt-level=3 //@ [LLVM-20-OPTIM] min-llvm-version: 20 //@ assembly-output: emit-asm diff --git a/tests/codegen/branch-protection-old-llvm.rs b/tests/codegen/branch-protection-old-llvm.rs index bb3c7a4b70c..1846f35479d 100644 --- a/tests/codegen/branch-protection-old-llvm.rs +++ b/tests/codegen/branch-protection-old-llvm.rs @@ -7,7 +7,7 @@ //@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf //@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key //@ compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-llvm-version: 19 - 99 +//@ max-llvm-major-version: 18 #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen/call-metadata.rs b/tests/codegen/call-metadata.rs index 73c4b33e2cf..b986b4467fa 100644 --- a/tests/codegen/call-metadata.rs +++ b/tests/codegen/call-metadata.rs @@ -2,7 +2,7 @@ // scalar value. //@ compile-flags: -O -C no-prepopulate-passes -//@ ignore-llvm-version: 19 - 99 +//@ max-llvm-major-version: 18 #![crate_type = "lib"] diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen/integer-cmp.rs index 8df68d8d490..9bbf243946d 100644 --- a/tests/codegen/integer-cmp.rs +++ b/tests/codegen/integer-cmp.rs @@ -3,7 +3,7 @@ //@ revisions: llvm-pre-20 llvm-20 //@ [llvm-20] min-llvm-version: 20 -//@ [llvm-pre-20] ignore-llvm-version: 20 - 99 +//@ [llvm-pre-20] max-llvm-major-version: 19 //@ compile-flags: -C opt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index b68ecce869e..36a0d9066c8 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -2,8 +2,7 @@ //@ only-x86_64 // FIXME: Remove the `min-llvm-version`. //@ revisions: NINETEEN TWENTY -//@[NINETEEN] min-llvm-version: 19 -//@[NINETEEN] ignore-llvm-version: 20-99 +//@[NINETEEN] exact-llvm-major-version: 19 //@[TWENTY] min-llvm-version: 20 //@ min-llvm-version: 19 diff --git a/tests/rustdoc-js-std/deduplication.js b/tests/rustdoc-js-std/deduplication.js index 51279dd5ed4..95049d0a174 100644 --- a/tests/rustdoc-js-std/deduplication.js +++ b/tests/rustdoc-js-std/deduplication.js @@ -5,6 +5,5 @@ const EXPECTED = { 'others': [ { 'path': 'std::f32', 'name': 'is_nan' }, { 'path': 'std::f64', 'name': 'is_nan' }, - { 'path': 'std::option::Option', 'name': 'is_none' }, ], }; diff --git a/tests/rustdoc-js-std/path-maxeditdistance.js b/tests/rustdoc-js-std/path-maxeditdistance.js index 632df658f75..af71713f055 100644 --- a/tests/rustdoc-js-std/path-maxeditdistance.js +++ b/tests/rustdoc-js-std/path-maxeditdistance.js @@ -3,16 +3,8 @@ const FILTER_CRATE = "std"; const EXPECTED = [ { query: 'vec::intoiterator', - others: [ - // trait std::iter::IntoIterator is not the first result - { 'path': 'std::vec', 'name': 'IntoIter' }, - { 'path': 'std::vec::Vec', 'name': 'into_iter' }, - { 'path': 'std::vec::Drain', 'name': 'into_iter' }, - { 'path': 'std::vec::IntoIter', 'name': 'into_iter' }, - { 'path': 'std::vec::ExtractIf', 'name': 'into_iter' }, - { 'path': 'std::vec::Splice', 'name': 'into_iter' }, - { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'into_iter' }, - ], + // trait std::iter::IntoIterator is not the first result + others: [], }, { query: 'vec::iter', diff --git a/tests/rustdoc-js-std/write.js b/tests/rustdoc-js-std/write.js new file mode 100644 index 00000000000..4a9475102a5 --- /dev/null +++ b/tests/rustdoc-js-std/write.js @@ -0,0 +1,24 @@ +const EXPECTED = [ + { + 'query': 'write', + 'others': [ + { 'path': 'std::fmt', 'name': 'write' }, + { 'path': 'std::fs', 'name': 'write' }, + { 'path': 'std::ptr', 'name': 'write' }, + { 'path': 'std::fmt', 'name': 'Write' }, + { 'path': 'std::io', 'name': 'Write' }, + { 'path': 'std::hash::Hasher', 'name': 'write' }, + ], + }, + { + 'query': 'Write', + 'others': [ + { 'path': 'std::fmt', 'name': 'Write' }, + { 'path': 'std::io', 'name': 'Write' }, + { 'path': 'std::fmt', 'name': 'write' }, + { 'path': 'std::fs', 'name': 'write' }, + { 'path': 'std::ptr', 'name': 'write' }, + { 'path': 'std::hash::Hasher', 'name': 'write' }, + ], + }, +]; diff --git a/tests/rustdoc-js/case.js b/tests/rustdoc-js/case.js new file mode 100644 index 00000000000..22b970eb139 --- /dev/null +++ b/tests/rustdoc-js/case.js @@ -0,0 +1,17 @@ +const EXPECTED = [ + { + 'query': 'Foo', + 'others': [ + { 'path': 'case', 'name': 'Foo', 'desc': 'Docs for Foo' }, + { 'path': 'case', 'name': 'foo', 'desc': 'Docs for foo' }, + ], + }, + { + 'query': 'foo', + 'others': [ + // https://github.com/rust-lang/rust/issues/133017 + { 'path': 'case', 'name': 'Foo', 'desc': 'Docs for Foo' }, + { 'path': 'case', 'name': 'foo', 'desc': 'Docs for foo' }, + ], + }, +]; diff --git a/tests/rustdoc-js/case.rs b/tests/rustdoc-js/case.rs new file mode 100644 index 00000000000..532edd55f1d --- /dev/null +++ b/tests/rustdoc-js/case.rs @@ -0,0 +1,7 @@ +#![allow(nonstandard_style)] + +/// Docs for Foo +pub struct Foo; + +/// Docs for foo +pub struct foo; diff --git a/tests/rustdoc-js/non-english-identifier.js b/tests/rustdoc-js/non-english-identifier.js index 6a2c4cc637c..f2180b4c755 100644 --- a/tests/rustdoc-js/non-english-identifier.js +++ b/tests/rustdoc-js/non-english-identifier.js @@ -133,22 +133,34 @@ const EXPECTED = [ path: "non_english_identifier", href: "../non_english_identifier/trait.加法.html", desc: "Add" - }, + }], + in_args: [{ + name: "加上", + path: "non_english_identifier::加法", + href: "../non_english_identifier/trait.加法.html#tymethod.加上", + }], + returned: [], + }, + { // levensthein and substring checking only kick in at three characters + query: '加法宏', + others: [ { name: "中文名称的加法宏", path: "non_english_identifier", href: "../non_english_identifier/macro.中文名称的加法宏.html", - }, + }], + in_args: [], + returned: [], + }, + { // levensthein and substring checking only kick in at three characters + query: '加法A', + others: [ { name: "中文名称的加法API", path: "non_english_identifier", href: "../non_english_identifier/fn.中文名称的加法API.html", }], - in_args: [{ - name: "加上", - path: "non_english_identifier::加法", - href: "../non_english_identifier/trait.加法.html#tymethod.加上", - }], + in_args: [], returned: [], }, { // Extensive type-based search is still buggy, experimental & work-in-progress. diff --git a/tests/rustdoc-js/path-maxeditdistance.js b/tests/rustdoc-js/path-maxeditdistance.js index 73b24a6dddf..cf700193ac4 100644 --- a/tests/rustdoc-js/path-maxeditdistance.js +++ b/tests/rustdoc-js/path-maxeditdistance.js @@ -14,21 +14,38 @@ const EXPECTED = [ ], }, { - // swap br/rb; that's edit distance 2, where maxPathEditDistance = 3 (11 / 3) + // swap br/rb; that's edit distance 1, where maxPathEditDistance = 2 'query': 'arbacadarba::hocuspocusprestidigitation', 'others': [ { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' }, ], }, { - // truncate 5 chars, where maxEditDistance = 7 (21 / 3) - 'query': 'abracadarba::hocusprestidigitation', + // swap p/o o/p, that's also edit distance 1 + 'query': 'abracadabra::hocusopcusprestidigitation', 'others': [ { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' }, ], }, { - // truncate 9 chars, where maxEditDistance = 5 (17 / 3) + // swap p/o o/p and gi/ig, that's edit distance 2 + 'query': 'abracadabra::hocusopcusprestidiigtation', + 'others': [ + { 'path': 'abracadabra', 'name': 'HocusPocusPrestidigitation' }, + ], + }, + { + // swap p/o o/p, gi/ig, and ti/it, that's edit distance 3 and not shown (we stop at 2) + 'query': 'abracadabra::hocusopcusprestidiigtaiton', + 'others': [], + }, + { + // truncate 5 chars, where maxEditDistance = 2 + 'query': 'abracadarba::hocusprestidigitation', + 'others': [], + }, + { + // truncate 9 chars, where maxEditDistance = 2 'query': 'abracadarba::hprestidigitation', 'others': [], }, diff --git a/tests/rustdoc-js/prototype.js b/tests/rustdoc-js/prototype.js index da72fdce3db..0862acd8ffa 100644 --- a/tests/rustdoc-js/prototype.js +++ b/tests/rustdoc-js/prototype.js @@ -9,7 +9,9 @@ const EXPECTED = [ }, { 'query': '__proto__', - 'others': [], + 'others': [ + {"path": "", "name": "prototype"}, + ], 'returned': [], 'in_args': [], }, diff --git a/tests/rustdoc/decl_macro.rs b/tests/rustdoc/decl_macro.rs index da471e7c224..040859baffb 100644 --- a/tests/rustdoc/decl_macro.rs +++ b/tests/rustdoc/decl_macro.rs @@ -48,6 +48,8 @@ mod a { } mod c { //@ has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {' + // Regression test for <https://github.com/rust-lang/rust/issues/83000>: + //@ has - '//pre[@class="rust item-decl"]//a[@class="mod"]/@href' '../../index.html' pub(in a) macro by_example_vis_named { ($foo:expr) => {} } diff --git a/tests/rustdoc/footnote-ids.rs b/tests/rustdoc/footnote-ids.rs new file mode 100644 index 00000000000..d3a8435bb47 --- /dev/null +++ b/tests/rustdoc/footnote-ids.rs @@ -0,0 +1,41 @@ +// This test ensures that footnotes ID are not duplicated across an item page. +// This is a regression test for <https://github.com/rust-lang/rust/issues/131901>. + +#![crate_name = "foo"] + +//@ has 'foo/struct.Foo.html' + +pub struct Foo; + +impl Foo { + //@ has - '//a[@href="#fn1"]' '1' + //@ has - '//li[@id="fn1"]' 'Hiya' + //@ has - '//a[@href="#fn2"]' '2' + //@ has - '//li[@id="fn2"]' 'Tiya' + /// Link 1 [^1] + /// Link 1.1 [^2] + /// + /// [^1]: Hiya + /// [^2]: Tiya + pub fn l1(){} + + //@ has - '//a[@href="#fn3"]' '1' + //@ has - '//li[@id="fn3"]' 'Yiya' + //@ has - '//a[@href="#fn4"]' '2' + //@ has - '//li[@id="fn4"]' 'Biya' + /// Link 2 [^1] + /// Link 3 [^2] + /// + /// [^1]: Yiya + /// [^2]: Biya + pub fn l2() {} +} + +impl Foo { + //@ has - '//a[@href="#fn5"]' '1' + //@ has - '//li[@id="fn5"]' 'Ciya' + /// Link 3 [^1] + /// + /// [^1]: Ciya + pub fn l3(){} +} diff --git a/tests/rustdoc/footnote-reference-in-footnote-def.rs b/tests/rustdoc/footnote-reference-in-footnote-def.rs new file mode 100644 index 00000000000..db3f9a59ef8 --- /dev/null +++ b/tests/rustdoc/footnote-reference-in-footnote-def.rs @@ -0,0 +1,20 @@ +// Checks that footnote references in footnote definitions are correctly generated. +// Regression test for <https://github.com/rust-lang/rust/issues/131946>. + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +//@ has - '//*[@class="docblock"]/p/sup[@id="fnref1"]/a[@href="#fn1"]' '1' +//@ has - '//li[@id="fn1"]/p' 'meow' +//@ has - '//li[@id="fn1"]/p/sup[@id="fnref2"]/a[@href="#fn2"]' '2' +//@ has - '//li[@id="fn1"]//a[@href="#fn2"]' '2' +//@ has - '//li[@id="fn2"]/p' 'uwu' +//@ has - '//li[@id="fn2"]/p/sup[@id="fnref1"]/a[@href="#fn1"]' '1' +//@ has - '//li[@id="fn2"]//a[@href="#fn1"]' '1' + +//! # footnote-hell +//! +//! Hello [^a]. +//! +//! [^a]: meow [^b] +//! [^b]: uwu [^a] diff --git a/tests/rustdoc/macro_rules-matchers.rs b/tests/rustdoc/macro_rules-matchers.rs index c3ee8febdf5..2c9fb50539a 100644 --- a/tests/rustdoc/macro_rules-matchers.rs +++ b/tests/rustdoc/macro_rules-matchers.rs @@ -3,29 +3,17 @@ #![crate_name = "foo"] -//@ has 'foo/macro.todo.html' -//@ has - '//span[@class="macro"]' 'macro_rules!' -//@ hasraw - ' todo {' - -//@ hasraw - '{ () => { ... }; ($(' -//@ has - '//span[@class="macro-nonterminal"]' '$' -//@ has - '//span[@class="macro-nonterminal"]' 'arg' -//@ hasraw - ':tt)+' -//@ hasraw - ') => { ... }; }' +//@ has 'foo/macro.todo.html' '//pre' 'macro_rules! todo { \ +// () => { ... }; \ +// ($($arg:tt)+) => { ... }; \ +// }' pub use std::todo; mod mod1 { - //@ has 'foo/macro.macro1.html' - //@ hasraw - 'macro_rules!' - //@ hasraw - 'macro1' - //@ hasraw - '{ () => { ... }; ($(' - //@ has - '//span[@class="macro-nonterminal"]' '$' - //@ has - '//span[@class="macro-nonterminal"]' 'arg' - //@ hasraw - ':' - //@ hasraw - 'expr' - //@ hasraw - '),' - //@ hasraw - '+' - //@ hasraw - ') => { ... }; }' + //@ has 'foo/macro.macro1.html' '//pre' 'macro_rules! macro1 { \ + // () => { ... }; \ + // ($($arg:expr),+) => { ... }; \ + // }' #[macro_export] macro_rules! macro1 { () => {}; diff --git a/tests/ui/asan-odr-win/asan_odr_windows.rs b/tests/ui/asan-odr-win/asan_odr_windows.rs new file mode 100644 index 00000000000..c618ac02a66 --- /dev/null +++ b/tests/ui/asan-odr-win/asan_odr_windows.rs @@ -0,0 +1,18 @@ +//! Check that crates can be linked together with `-Z sanitizer=address` on msvc. +//! See <https://github.com/rust-lang/rust/issues/124390>. + +//@ run-pass +//@ compile-flags:-Zsanitizer=address +//@ aux-build: asan_odr_win-2.rs +//@ only-windows-msvc + +extern crate othercrate; + +fn main() { + let result = std::panic::catch_unwind(|| { + println!("hello!"); + }); + assert!(result.is_ok()); + + othercrate::exposed_func(); +} diff --git a/tests/ui/asan-odr-win/auxiliary/asan_odr_win-2.rs b/tests/ui/asan-odr-win/auxiliary/asan_odr_win-2.rs new file mode 100644 index 00000000000..75488a29e5e --- /dev/null +++ b/tests/ui/asan-odr-win/auxiliary/asan_odr_win-2.rs @@ -0,0 +1,11 @@ +//@ no-prefer-dynamic +//@ compile-flags: -Z sanitizer=address +#![crate_name = "othercrate"] +#![crate_type = "rlib"] + +pub fn exposed_func() { + let result = std::panic::catch_unwind(|| { + println!("hello!"); + }); + assert!(result.is_ok()); +} diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr index 347fa3fa892..4cfe51eccac 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-multi-variant-diagnostics.stderr @@ -11,10 +11,6 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t | LL | if let MultiVariant::Point(ref mut x, _) = point { | ^^^^^ -help: consider mutably borrowing `c` - | -LL | let a = &mut c; - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr index c9b27e76879..2ed611d6b52 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-single-variant-diagnostics.stderr @@ -11,10 +11,6 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t | LL | let SingleVariant::Point(ref mut x, _) = point; | ^^^^^ -help: consider mutably borrowing `c` - | -LL | let b = &mut c; - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr index 079a9abedf9..47db2c76a2f 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-struct-diagnostics.stderr @@ -11,10 +11,6 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t | LL | x.y.a += 1; | ^^^^^ -help: consider mutably borrowing `hello` - | -LL | let b = &mut hello; - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr index 0bf717404ce..9db64ec04b9 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics-1.stderr @@ -11,10 +11,6 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t | LL | x.0 += 1; | ^^^ -help: consider mutably borrowing `hello` - | -LL | let b = &mut hello; - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.rs b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.rs new file mode 100644 index 00000000000..346ef64a8a6 --- /dev/null +++ b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.rs @@ -0,0 +1,21 @@ +// Regression test for #132955 checking that we handle anon consts with +// inference variables in their generic arguments correctly. +// +// This arose via diagnostics where we would have some failing goal such +// as `[u8; AnonConst<Self>]: PartialEq<Self::A>`, then as part of diagnostics +// we would replace all generic parameters with inference vars which would yield +// a self type of `[u8; AnonConst<?x>]` and then attempt to normalize `AnonConst<?x>`. + +pub trait T { + type A; + const P: Self::A; + + fn a() { + [0u8; std::mem::size_of::<Self::A>()] == Self::P; + //~^ ERROR: can't compare + //~| ERROR: constant expression depends on a generic parameter + //~| ERROR: constant expression depends on a generic parameter + } +} + +fn main() {} diff --git a/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr new file mode 100644 index 00000000000..12de4f1dc30 --- /dev/null +++ b/tests/ui/const-generics/failing_goal_with_repeat_expr_anon_const.stderr @@ -0,0 +1,31 @@ +error: constant expression depends on a generic parameter + --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:15 + | +LL | [0u8; std::mem::size_of::<Self::A>()] == Self::P; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this may fail depending on what value the parameter takes + +error: constant expression depends on a generic parameter + --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:47 + | +LL | [0u8; std::mem::size_of::<Self::A>()] == Self::P; + | ^^ + | + = note: this may fail depending on what value the parameter takes + +error[E0277]: can't compare `[u8; std::mem::size_of::<Self::A>()]` with `<Self as T>::A` + --> $DIR/failing_goal_with_repeat_expr_anon_const.rs:14:47 + | +LL | [0u8; std::mem::size_of::<Self::A>()] == Self::P; + | ^^ no implementation for `[u8; std::mem::size_of::<Self::A>()] == <Self as T>::A` + | + = help: the trait `PartialEq<<Self as T>::A>` is not implemented for `[u8; std::mem::size_of::<Self::A>()]` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | pub trait T where [u8; std::mem::size_of::<Self::A>()]: PartialEq<<Self as T>::A> { + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/extern-flag/auxiliary/panic_handler.rs b/tests/ui/extern-flag/auxiliary/panic_handler.rs index 5ca32fa992b..9140ceed229 100644 --- a/tests/ui/extern-flag/auxiliary/panic_handler.rs +++ b/tests/ui/extern-flag/auxiliary/panic_handler.rs @@ -1,14 +1,10 @@ -#![feature(lang_items)] +#![feature(lang_items, panic_unwind)] #![no_std] -// Since `rustc` generally passes `-nodefaultlibs` to the linker, -// Rust programs link necessary system libraries via `#[link()]` -// attributes in the `libc` crate. `libc` is a dependency of `std`, -// but as we are `#![no_std]`, we need to include it manually. -// Except on windows-msvc. -#![feature(rustc_private)] -#[cfg(not(all(windows, target_env = "msvc")))] -extern crate libc; +// Since the `unwind` crate is a dependency of the `std` crate, and we have +// `#![no_std]`, the unwinder is not included in the link command by default. +// We need to include crate `unwind` manually. +extern crate unwind; #[panic_handler] pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! { diff --git a/tests/ui/inline-const/cross_const_control_flow.rs b/tests/ui/inline-const/cross_const_control_flow.rs new file mode 100644 index 00000000000..109764a1812 --- /dev/null +++ b/tests/ui/inline-const/cross_const_control_flow.rs @@ -0,0 +1,46 @@ +//@edition:2021 + +fn foo() { + const { return } + //~^ ERROR: return statement outside of function body +} + +fn labelled_block_break() { + 'a: { const { break 'a } } + //~^ ERROR: `break` outside of a loop or labeled block + //~| ERROR: use of unreachable label +} + +fn loop_break() { + loop { + const { break } + //~^ ERROR: `break` outside of a loop or labeled block + } +} + +fn continue_to_labelled_block() { + 'a: { const { continue 'a } } + //~^ ERROR: `continue` outside of a loop + //~| ERROR: use of unreachable label +} + +fn loop_continue() { + loop { + const { continue } + //~^ ERROR: `continue` outside of a loop + } +} + +async fn await_across_const_block() { + const { async {}.await } + //~^ ERROR: `await` is only allowed inside `async` functions and blocks +} + +fn reference_to_non_constant_in_const_block() { + let x = 1; + const { &x }; + //~^ ERROR: attempt to use a non-constant value in a constant +} + + +fn main() {} diff --git a/tests/ui/inline-const/cross_const_control_flow.stderr b/tests/ui/inline-const/cross_const_control_flow.stderr new file mode 100644 index 00000000000..ecfa921edd2 --- /dev/null +++ b/tests/ui/inline-const/cross_const_control_flow.stderr @@ -0,0 +1,78 @@ +error[E0767]: use of unreachable label `'a` + --> $DIR/cross_const_control_flow.rs:9:25 + | +LL | 'a: { const { break 'a } } + | -- ^^ unreachable label `'a` + | | + | unreachable label defined here + | + = note: labels are unreachable through functions, closures, async blocks and modules + +error[E0767]: use of unreachable label `'a` + --> $DIR/cross_const_control_flow.rs:22:28 + | +LL | 'a: { const { continue 'a } } + | -- ^^ unreachable label `'a` + | | + | unreachable label defined here + | + = note: labels are unreachable through functions, closures, async blocks and modules + +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/cross_const_control_flow.rs:41:14 + | +LL | const { &x }; + | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL | const x: /* Type */ = 1; + | ~~~~~ ++++++++++++ + +error[E0728]: `await` is only allowed inside `async` functions and blocks + --> $DIR/cross_const_control_flow.rs:35:22 + | +LL | const { async {}.await } + | -----------^^^^^-- + | | | + | | only allowed inside `async` functions and blocks + | this is not `async` + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/cross_const_control_flow.rs:9:19 + | +LL | 'a: { const { break 'a } } + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/cross_const_control_flow.rs:16:17 + | +LL | const { break } + | ^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `continue` outside of a loop + --> $DIR/cross_const_control_flow.rs:22:19 + | +LL | 'a: { const { continue 'a } } + | ^^^^^^^^^^^ cannot `continue` outside of a loop + +error[E0268]: `continue` outside of a loop + --> $DIR/cross_const_control_flow.rs:29:17 + | +LL | const { continue } + | ^^^^^^^^ cannot `continue` outside of a loop + +error[E0572]: return statement outside of function body + --> $DIR/cross_const_control_flow.rs:4:13 + | +LL | / fn foo() { +LL | | const { return } + | | --^^^^^^-- the return is part of this body... +LL | | +LL | | } + | |_- ...not the enclosing function body + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0268, E0435, E0572, E0728, E0767. +For more information about an error, try `rustc --explain E0268`. diff --git a/tests/ui/moves/auxiliary/suggest-borrow-for-generic-arg-aux.rs b/tests/ui/moves/auxiliary/suggest-borrow-for-generic-arg-aux.rs new file mode 100644 index 00000000000..c71238ba072 --- /dev/null +++ b/tests/ui/moves/auxiliary/suggest-borrow-for-generic-arg-aux.rs @@ -0,0 +1,20 @@ +//! auxiliary definitons for suggest-borrow-for-generic-arg.rs, to ensure the suggestion works on +//! functions defined in other crates. + +use std::io::{self, Read, Write}; +use std::iter::Sum; + +pub fn write_stuff<W: Write>(mut writer: W) -> io::Result<()> { + writeln!(writer, "stuff") +} + +pub fn read_and_discard<R: Read>(mut reader: R) -> io::Result<()> { + let mut buf = Vec::new(); + reader.read_to_end(&mut buf).map(|_| ()) +} + +pub fn sum_three<I: IntoIterator>(iter: I) -> <I as IntoIterator>::Item + where <I as IntoIterator>::Item: Sum +{ + iter.into_iter().take(3).sum() +} diff --git a/tests/ui/moves/borrow-closures-instead-of-move.rs b/tests/ui/moves/borrow-closures-instead-of-move.rs index e4bca54e995..869aa654ef7 100644 --- a/tests/ui/moves/borrow-closures-instead-of-move.rs +++ b/tests/ui/moves/borrow-closures-instead-of-move.rs @@ -1,4 +1,4 @@ -fn takes_fn(f: impl Fn()) { //~ HELP if `impl Fn()` implemented `Clone` +fn takes_fn(f: impl Fn()) { loop { takes_fnonce(f); //~^ ERROR use of moved value diff --git a/tests/ui/moves/borrow-closures-instead-of-move.stderr b/tests/ui/moves/borrow-closures-instead-of-move.stderr index ab6ff417efb..ea145f365c2 100644 --- a/tests/ui/moves/borrow-closures-instead-of-move.stderr +++ b/tests/ui/moves/borrow-closures-instead-of-move.stderr @@ -8,21 +8,6 @@ LL | loop { LL | takes_fnonce(f); | ^ value moved here, in previous iteration of loop | -note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary - --> $DIR/borrow-closures-instead-of-move.rs:34:20 - | -LL | fn takes_fnonce(_: impl FnOnce()) {} - | ------------ ^^^^^^^^^^^^^ this parameter takes ownership of the value - | | - | in this function -help: if `impl Fn()` implemented `Clone`, you could clone the value - --> $DIR/borrow-closures-instead-of-move.rs:1:16 - | -LL | fn takes_fn(f: impl Fn()) { - | ^^^^^^^^^ consider constraining this type parameter with `Clone` -LL | loop { -LL | takes_fnonce(f); - | - you could clone this value help: consider borrowing `f` | LL | takes_fnonce(&f); @@ -40,13 +25,6 @@ LL | takes_fnonce(m); LL | takes_fnonce(m); | ^ value used here after move | -note: consider changing this parameter type in function `takes_fnonce` to borrow instead if owning the value isn't necessary - --> $DIR/borrow-closures-instead-of-move.rs:34:20 - | -LL | fn takes_fnonce(_: impl FnOnce()) {} - | ------------ ^^^^^^^^^^^^^ this parameter takes ownership of the value - | | - | in this function help: if `impl FnMut()` implemented `Clone`, you could clone the value --> $DIR/borrow-closures-instead-of-move.rs:9:20 | diff --git a/tests/ui/moves/moved-value-on-as-ref-arg.stderr b/tests/ui/moves/moved-value-on-as-ref-arg.stderr index 4004b7a43bc..a99bdb4fe9d 100644 --- a/tests/ui/moves/moved-value-on-as-ref-arg.stderr +++ b/tests/ui/moves/moved-value-on-as-ref-arg.stderr @@ -8,7 +8,7 @@ LL | foo(bar); LL | let _baa = bar; | ^^^ value used here after move | -help: borrow the value to avoid moving it +help: consider borrowing `bar` | LL | foo(&bar); | + @@ -31,7 +31,7 @@ LL | struct Bar; ... LL | qux(bar); | --- you could clone this value -help: borrow the value to avoid moving it +help: consider mutably borrowing `bar` | LL | qux(&mut bar); | ++++ @@ -46,7 +46,7 @@ LL | bat(bar); LL | let _baa = bar; | ^^^ value used here after move | -help: borrow the value to avoid moving it +help: consider borrowing `bar` | LL | bat(&bar); | + @@ -69,7 +69,7 @@ LL | struct Bar; ... LL | baz(bar); | --- you could clone this value -help: borrow the value to avoid moving it +help: consider mutably borrowing `bar` | LL | baz(&mut bar); | ++++ diff --git a/tests/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/tests/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index a8473bb8198..a4c8401ce57 100644 --- a/tests/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/tests/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -24,10 +24,6 @@ LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) { | ^ consider constraining this type parameter with `Clone` LL | let mut r = R {c: Box::new(f)}; | - you could clone this value -help: consider mutably borrowing `f` - | -LL | let mut r = R {c: Box::new(&mut f)}; - | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/moves/suggest-borrow-for-generic-arg.fixed b/tests/ui/moves/suggest-borrow-for-generic-arg.fixed new file mode 100644 index 00000000000..b5e0b468aa6 --- /dev/null +++ b/tests/ui/moves/suggest-borrow-for-generic-arg.fixed @@ -0,0 +1,46 @@ +//! Test suggetions to borrow generic arguments instead of moving. Tests for other instances of this +//! can be found in `moved-value-on-as-ref-arg.rs` and `borrow-closures-instead-of-move.rs` +//@ run-rustfix +//@ aux-crate:aux=suggest-borrow-for-generic-arg-aux.rs +//@ edition: 2021 + +#![allow(unused_mut)] +use std::io::{self, Write}; + +// test for `std::io::Write` (#131413) +fn test_write() -> io::Result<()> { + let mut stdout = io::stdout(); + aux::write_stuff(&stdout)?; //~ HELP consider borrowing `stdout` + writeln!(stdout, "second line")?; //~ ERROR borrow of moved value: `stdout` + + let mut buf = Vec::new(); + aux::write_stuff(&mut buf.clone())?; //~ HELP consider mutably borrowing `buf` + //~^ HELP consider cloning the value + writeln!(buf, "second_line") //~ ERROR borrow of moved value: `buf` +} + +/// test for `std::io::Read` (#131413) +fn test_read() -> io::Result<()> { + let stdin = io::stdin(); + aux::read_and_discard(&stdin)?; //~ HELP consider borrowing `stdin` + aux::read_and_discard(stdin)?; //~ ERROR use of moved value: `stdin` + + let mut bytes = std::collections::VecDeque::from([1, 2, 3, 4, 5, 6]); + aux::read_and_discard(&mut bytes.clone())?; //~ HELP consider mutably borrowing `bytes` + //~^ HELP consider cloning the value + aux::read_and_discard(bytes) //~ ERROR use of moved value: `bytes` +} + +/// test that suggestions work with projection types in the callee's signature +fn test_projections() { + let mut iter = [1, 2, 3, 4, 5, 6].into_iter(); + let _six: usize = aux::sum_three(&mut iter.clone()); //~ HELP consider mutably borrowing `iter` + //~^ HELP consider cloning the value + let _fifteen: usize = aux::sum_three(iter); //~ ERROR use of moved value: `iter` +} + +fn main() { + test_write().unwrap(); + test_read().unwrap(); + test_projections(); +} diff --git a/tests/ui/moves/suggest-borrow-for-generic-arg.rs b/tests/ui/moves/suggest-borrow-for-generic-arg.rs new file mode 100644 index 00000000000..e08978db63a --- /dev/null +++ b/tests/ui/moves/suggest-borrow-for-generic-arg.rs @@ -0,0 +1,46 @@ +//! Test suggetions to borrow generic arguments instead of moving. Tests for other instances of this +//! can be found in `moved-value-on-as-ref-arg.rs` and `borrow-closures-instead-of-move.rs` +//@ run-rustfix +//@ aux-crate:aux=suggest-borrow-for-generic-arg-aux.rs +//@ edition: 2021 + +#![allow(unused_mut)] +use std::io::{self, Write}; + +// test for `std::io::Write` (#131413) +fn test_write() -> io::Result<()> { + let mut stdout = io::stdout(); + aux::write_stuff(stdout)?; //~ HELP consider borrowing `stdout` + writeln!(stdout, "second line")?; //~ ERROR borrow of moved value: `stdout` + + let mut buf = Vec::new(); + aux::write_stuff(buf)?; //~ HELP consider mutably borrowing `buf` + //~^ HELP consider cloning the value + writeln!(buf, "second_line") //~ ERROR borrow of moved value: `buf` +} + +/// test for `std::io::Read` (#131413) +fn test_read() -> io::Result<()> { + let stdin = io::stdin(); + aux::read_and_discard(stdin)?; //~ HELP consider borrowing `stdin` + aux::read_and_discard(stdin)?; //~ ERROR use of moved value: `stdin` + + let mut bytes = std::collections::VecDeque::from([1, 2, 3, 4, 5, 6]); + aux::read_and_discard(bytes)?; //~ HELP consider mutably borrowing `bytes` + //~^ HELP consider cloning the value + aux::read_and_discard(bytes) //~ ERROR use of moved value: `bytes` +} + +/// test that suggestions work with projection types in the callee's signature +fn test_projections() { + let mut iter = [1, 2, 3, 4, 5, 6].into_iter(); + let _six: usize = aux::sum_three(iter); //~ HELP consider mutably borrowing `iter` + //~^ HELP consider cloning the value + let _fifteen: usize = aux::sum_three(iter); //~ ERROR use of moved value: `iter` +} + +fn main() { + test_write().unwrap(); + test_read().unwrap(); + test_projections(); +} diff --git a/tests/ui/moves/suggest-borrow-for-generic-arg.stderr b/tests/ui/moves/suggest-borrow-for-generic-arg.stderr new file mode 100644 index 00000000000..07e24f566cb --- /dev/null +++ b/tests/ui/moves/suggest-borrow-for-generic-arg.stderr @@ -0,0 +1,93 @@ +error[E0382]: borrow of moved value: `stdout` + --> $DIR/suggest-borrow-for-generic-arg.rs:14:14 + | +LL | let mut stdout = io::stdout(); + | ---------- move occurs because `stdout` has type `Stdout`, which does not implement the `Copy` trait +LL | aux::write_stuff(stdout)?; + | ------ value moved here +LL | writeln!(stdout, "second line")?; + | ^^^^^^ value borrowed here after move + | +help: consider borrowing `stdout` + | +LL | aux::write_stuff(&stdout)?; + | + + +error[E0382]: borrow of moved value: `buf` + --> $DIR/suggest-borrow-for-generic-arg.rs:19:14 + | +LL | let mut buf = Vec::new(); + | ------- move occurs because `buf` has type `Vec<u8>`, which does not implement the `Copy` trait +LL | aux::write_stuff(buf)?; + | --- value moved here +LL | +LL | writeln!(buf, "second_line") + | ^^^ value borrowed here after move + | +help: consider mutably borrowing `buf` + | +LL | aux::write_stuff(&mut buf)?; + | ++++ +help: consider cloning the value if the performance cost is acceptable + | +LL | aux::write_stuff(buf.clone())?; + | ++++++++ + +error[E0382]: use of moved value: `stdin` + --> $DIR/suggest-borrow-for-generic-arg.rs:26:27 + | +LL | let stdin = io::stdin(); + | ----- move occurs because `stdin` has type `Stdin`, which does not implement the `Copy` trait +LL | aux::read_and_discard(stdin)?; + | ----- value moved here +LL | aux::read_and_discard(stdin)?; + | ^^^^^ value used here after move + | +help: consider borrowing `stdin` + | +LL | aux::read_and_discard(&stdin)?; + | + + +error[E0382]: use of moved value: `bytes` + --> $DIR/suggest-borrow-for-generic-arg.rs:31:27 + | +LL | let mut bytes = std::collections::VecDeque::from([1, 2, 3, 4, 5, 6]); + | --------- move occurs because `bytes` has type `VecDeque<u8>`, which does not implement the `Copy` trait +LL | aux::read_and_discard(bytes)?; + | ----- value moved here +LL | +LL | aux::read_and_discard(bytes) + | ^^^^^ value used here after move + | +help: consider mutably borrowing `bytes` + | +LL | aux::read_and_discard(&mut bytes)?; + | ++++ +help: consider cloning the value if the performance cost is acceptable + | +LL | aux::read_and_discard(bytes.clone())?; + | ++++++++ + +error[E0382]: use of moved value: `iter` + --> $DIR/suggest-borrow-for-generic-arg.rs:39:42 + | +LL | let mut iter = [1, 2, 3, 4, 5, 6].into_iter(); + | -------- move occurs because `iter` has type `std::array::IntoIter<usize, 6>`, which does not implement the `Copy` trait +LL | let _six: usize = aux::sum_three(iter); + | ---- value moved here +LL | +LL | let _fifteen: usize = aux::sum_three(iter); + | ^^^^ value used here after move + | +help: consider mutably borrowing `iter` + | +LL | let _six: usize = aux::sum_three(&mut iter); + | ++++ +help: consider cloning the value if the performance cost is acceptable + | +LL | let _six: usize = aux::sum_three(iter.clone()); + | ++++++++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/not-copy-closure.stderr b/tests/ui/not-copy-closure.stderr index 50e25a24d81..60cb1352313 100644 --- a/tests/ui/not-copy-closure.stderr +++ b/tests/ui/not-copy-closure.stderr @@ -11,10 +11,6 @@ note: closure cannot be moved more than once as it is not `Copy` due to moving t | LL | a += 1; | ^ -help: consider mutably borrowing `hello` - | -LL | let b = &mut hello; - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/parser/unnecessary-let.stderr b/tests/ui/parser/unnecessary-let.stderr index c6ac0d562f8..05ac1faafd4 100644 --- a/tests/ui/parser/unnecessary-let.stderr +++ b/tests/ui/parser/unnecessary-let.stderr @@ -2,12 +2,12 @@ error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:2:9 | LL | for let x of [1, 2, 3] {} - | ^^^ + | ^^^^ | help: remove the unnecessary `let` keyword | LL - for let x of [1, 2, 3] {} -LL + for x of [1, 2, 3] {} +LL + for x of [1, 2, 3] {} | error: missing `in` in `for` loop @@ -25,12 +25,12 @@ error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:7:9 | LL | let 1 => {} - | ^^^ + | ^^^^ | help: remove the unnecessary `let` keyword | LL - let 1 => {} -LL + 1 => {} +LL + 1 => {} | error: aborting due to 3 previous errors diff --git a/tests/ui/simd-abi-checks-empty-list.rs b/tests/ui/simd-abi-checks-empty-list.rs new file mode 100644 index 00000000000..c1785051e5a --- /dev/null +++ b/tests/ui/simd-abi-checks-empty-list.rs @@ -0,0 +1,19 @@ +//@ needs-llvm-components: sparc +//@ compile-flags: --target=sparc-unknown-none-elf --crate-type=rlib +//@ build-pass +//@ ignore-pass (test emits codegen-time warnings) +#![no_core] +#![feature(no_core, lang_items, repr_simd)] +#![allow(improper_ctypes_definitions)] +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[repr(simd)] +pub struct SimdVec([i32; 4]); + +pub extern "C" fn pass_by_vec(_: SimdVec) {} +//~^ this function definition uses a SIMD vector type that is not currently supported with the chosen ABI +//~| WARNING this was previously accepted by the compiler diff --git a/tests/ui/simd-abi-checks-empty-list.stderr b/tests/ui/simd-abi-checks-empty-list.stderr new file mode 100644 index 00000000000..d7ce52eab80 --- /dev/null +++ b/tests/ui/simd-abi-checks-empty-list.stderr @@ -0,0 +1,12 @@ +warning: this function definition uses a SIMD vector type that is not currently supported with the chosen ABI + --> $DIR/simd-abi-checks-empty-list.rs:17:1 + | +LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function 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 #116558 <https://github.com/rust-lang/rust/issues/116558> + = note: `#[warn(abi_unsupported_vector_types)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/simd-abi-checks.rs b/tests/ui/simd-abi-checks.rs index 094c89930b7..9e3af26e9c4 100644 --- a/tests/ui/simd-abi-checks.rs +++ b/tests/ui/simd-abi-checks.rs @@ -12,19 +12,19 @@ use std::arch::x86_64::*; struct Wrapper(__m256); unsafe extern "C" fn w(_: Wrapper) { - //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn f(_: __m256) { - //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn g() -> __m256 { - //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } @@ -53,16 +53,16 @@ unsafe fn test() { fn main() { unsafe { f(g()); - //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller - //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } unsafe { gavx(favx()); - //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller - //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } @@ -73,8 +73,8 @@ fn main() { unsafe { w(Wrapper(g())); - //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller - //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } diff --git a/tests/ui/simd-abi-checks.stderr b/tests/ui/simd-abi-checks.stderr index aa7e9400169..7d2915f7dea 100644 --- a/tests/ui/simd-abi-checks.stderr +++ b/tests/ui/simd-abi-checks.stderr @@ -1,4 +1,4 @@ -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:55:11 | LL | f(g()); @@ -9,7 +9,7 @@ LL | f(g()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) = note: `#[warn(abi_unsupported_vector_types)]` on by default -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:55:9 | LL | f(g()); @@ -19,7 +19,7 @@ LL | f(g()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:63:14 | LL | gavx(favx()); @@ -29,7 +29,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:63:9 | LL | gavx(favx()); @@ -39,7 +39,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:75:19 | LL | w(Wrapper(g())); @@ -49,7 +49,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:75:9 | LL | w(Wrapper(g())); @@ -59,7 +59,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled +warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:26:1 | LL | unsafe extern "C" fn g() -> __m256 { @@ -69,7 +69,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled +warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:20:1 | LL | unsafe extern "C" fn f(_: __m256) { @@ -79,7 +79,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled +warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:14:1 | LL | unsafe extern "C" fn w(_: Wrapper) { diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-abi-checks.rs index d2afd38fcc8..c453e91d11b 100644 --- a/tests/ui/sse-abi-checks.rs +++ b/tests/ui/sse-abi-checks.rs @@ -19,6 +19,6 @@ pub struct SseVector([i64; 2]); #[no_mangle] pub unsafe extern "C" fn f(_: SseVector) { - //~^ ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled + //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler } diff --git a/tests/ui/sse-abi-checks.stderr b/tests/ui/sse-abi-checks.stderr index 77c4e1fc07a..7dd13af5091 100644 --- a/tests/ui/sse-abi-checks.stderr +++ b/tests/ui/sse-abi-checks.stderr @@ -1,4 +1,4 @@ -warning: ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled +warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled --> $DIR/sse-abi-checks.rs:21:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.stderr b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr index 5554f0ccc0a..ef636811fd5 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.stderr +++ b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr @@ -1,5 +1,5 @@ warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/normalize-self-type-constrains-trait-args.rs:5:12 + --> $DIR/normalize-self-type-constrains-trait-args.rs:8:12 | LL | #![feature(lazy_type_alias)] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr new file mode 100644 index 00000000000..ef636811fd5 --- /dev/null +++ b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr @@ -0,0 +1,11 @@ +warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/normalize-self-type-constrains-trait-args.rs:8:12 + | +LL | #![feature(lazy_type_alias)] + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs index 0ece8f8321c..c2a01671346 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs +++ b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass // This goal is also possible w/ a GAT, but lazy_type_alias |
