diff options
Diffstat (limited to 'tests')
320 files changed, 2129 insertions, 829 deletions
diff --git a/tests/crashes/121363.rs b/tests/crashes/121363.rs index 2a5b6274496..38796342284 100644 --- a/tests/crashes/121363.rs +++ b/tests/crashes/121363.rs @@ -1,5 +1,5 @@ //@ known-bug: #121363 -//@ compile-flags: -Zmir-opt-level=5 --crate-type lib +//@ compile-flags: -Zmir-enable-passes=+GVN --crate-type lib #![feature(trivial_bounds)] diff --git a/tests/crashes/128094.rs b/tests/crashes/128094.rs index 105a1c84a65..5f0ae108f8f 100644 --- a/tests/crashes/128094.rs +++ b/tests/crashes/128094.rs @@ -1,5 +1,5 @@ //@ known-bug: rust-lang/rust#128094 -//@ compile-flags: -Zmir-opt-level=5 --edition=2018 +//@ compile-flags: -Zmir-enable-passes=+GVN --edition=2018 pub enum Request { TestSome(T), diff --git a/tests/crashes/129095.rs b/tests/crashes/129095.rs index ea70c0565fc..d82474e18e7 100644 --- a/tests/crashes/129095.rs +++ b/tests/crashes/129095.rs @@ -1,5 +1,5 @@ //@ known-bug: rust-lang/rust#129095 -//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir +//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] { BYTES diff --git a/tests/crashes/129109.rs b/tests/crashes/129109.rs index 8b9ebdf03c7..0db53b98a71 100644 --- a/tests/crashes/129109.rs +++ b/tests/crashes/129109.rs @@ -1,5 +1,5 @@ //@ known-bug: rust-lang/rust#129109 -//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir +//@ compile-flags: -Zmir-enable-passes=+GVN -Zvalidate-mir extern "C" { pub static mut symbol: [i8]; diff --git a/tests/crashes/130970.rs b/tests/crashes/130970.rs index e1f59c155a5..698c2b478e1 100644 --- a/tests/crashes/130970.rs +++ b/tests/crashes/130970.rs @@ -1,5 +1,5 @@ //@ known-bug: #130970 -//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir +//@ compile-flags: -Zmir-enable-passes=+GVN -Zvalidate-mir fn main() { extern "C" { diff --git a/tests/crashes/131227.rs b/tests/crashes/131227.rs deleted file mode 100644 index f46185b5b4a..00000000000 --- a/tests/crashes/131227.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #131227 -//@ compile-flags: -Zmir-opt-level=3 - -static mut G: () = (); - -fn myfunc() -> i32 { - let var = &raw mut G; - if var.is_null() { - return 0; - } - 0 -} - -fn main() { - myfunc(); -} diff --git a/tests/crashes/131347.rs b/tests/crashes/131347.rs index 15f367d79e2..08f7d068e25 100644 --- a/tests/crashes/131347.rs +++ b/tests/crashes/131347.rs @@ -1,5 +1,5 @@ //@ known-bug: #131347 -//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir +//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir struct S; static STUFF: [i8] = [0; S::N]; diff --git a/tests/crashes/131451.rs b/tests/crashes/131451.rs new file mode 100644 index 00000000000..cd5b44bad8a --- /dev/null +++ b/tests/crashes/131451.rs @@ -0,0 +1,9 @@ +//@ known-bug: #131451 +//@ needs-rustc-debug-assertions +//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+JumpThreading --crate-type=lib + +pub fn fun(terminate: bool) { + while true {} + + while !terminate {} +} diff --git a/tests/crashes/131507.rs b/tests/crashes/131507.rs index d402fb8afc3..05b5e76bed7 100644 --- a/tests/crashes/131507.rs +++ b/tests/crashes/131507.rs @@ -1,5 +1,5 @@ //@ known-bug: #131507 -//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir +//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir #![feature(non_lifetime_binders)] fn brick() diff --git a/tests/incremental/circular-dependencies.rs b/tests/incremental/circular-dependencies.rs index 320edad3fde..c7b5b931fbb 100644 --- a/tests/incremental/circular-dependencies.rs +++ b/tests/incremental/circular-dependencies.rs @@ -6,10 +6,12 @@ //@ [cfail2] compile-flags: --test --extern aux={{build-base}}/circular-dependencies/auxiliary/libcircular_dependencies_aux.rmeta -L dependency={{build-base}}/circular-dependencies pub struct Foo; -//[cfail2]~^ NOTE `Foo` is defined in the current crate -//[cfail2]~| NOTE `Foo` is defined in the current crate -//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` -//[cfail2]~| NOTE `circular_dependencies::Foo` is defined in crate `circular_dependencies` +//[cfail2]~^ NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations +//[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations +//[cfail2]~| NOTE this is the expected type `Foo` +//[cfail2]~| NOTE this is the expected type `circular_dependencies::Foo` +//[cfail2]~| NOTE this is the found type `Foo` +//[cfail2]~| NOTE this is the found type `circular_dependencies::Foo` pub fn consume_foo(_: Foo) {} //[cfail2]~^ NOTE function defined here @@ -24,14 +26,12 @@ fn test() { //[cfail2]~^ ERROR mismatched types [E0308] //[cfail2]~| NOTE expected `circular_dependencies::Foo`, found `Foo` //[cfail2]~| NOTE arguments to this function are incorrect - //[cfail2]~| NOTE `Foo` and `circular_dependencies::Foo` have similar names, but are actually distinct types - //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations //[cfail2]~| NOTE function defined here + //[cfail2]~| NOTE one version of crate `circular_dependencies` used here, as a dependency of crate `circular_dependencies_aux` + //[cfail2]~| NOTE one version of crate `circular_dependencies` used here, as a dependency of crate `circular_dependencies_aux` consume_foo(aux::produce_foo()); //[cfail2]~^ ERROR mismatched types [E0308] //[cfail2]~| NOTE expected `Foo`, found `circular_dependencies::Foo` //[cfail2]~| NOTE arguments to this function are incorrect - //[cfail2]~| NOTE `circular_dependencies::Foo` and `Foo` have similar names, but are actually distinct types - //[cfail2]~| NOTE the crate `circular_dependencies` is compiled multiple times, possibly with different configurations } diff --git a/tests/run-make/crate-loading-crate-depends-on-itself/foo.stderr b/tests/run-make/crate-loading-crate-depends-on-itself/foo.stderr index 36379429530..7f131153540 100644 --- a/tests/run-make/crate-loading-crate-depends-on-itself/foo.stderr +++ b/tests/run-make/crate-loading-crate-depends-on-itself/foo.stderr @@ -8,7 +8,7 @@ note: there are multiple different versions of crate `foo` in the dependency gra --> foo-current.rs:7:1 | 4 | extern crate foo; - | ----------------- one version of crate `foo` is used here, as a direct dependency of the current crate + | ----------------- one version of crate `foo` used here, as a direct dependency of the current crate 5 | 6 | pub struct Struct; | ----------------- this type implements the required trait diff --git a/tests/run-make/crate-loading/multiple-dep-versions-1.rs b/tests/run-make/crate-loading/multiple-dep-versions-1.rs index d81462504dd..bfeabccf5c1 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-1.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-1.rs @@ -5,8 +5,11 @@ pub trait Trait { fn foo(&self); fn bar(); } +pub trait Trait2 {} impl Trait for Type { fn foo(&self) {} fn bar() {} } pub fn do_something<X: Trait>(_: X) {} +pub fn do_something_type(_: Type) {} +pub fn do_something_trait(_: Box<dyn Trait2>) {} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-2.rs b/tests/run-make/crate-loading/multiple-dep-versions-2.rs index 0a566fe2c60..682d1ff64b8 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-2.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-2.rs @@ -5,8 +5,12 @@ pub trait Trait { fn foo(&self); fn bar(); } +pub trait Trait2 {} +impl Trait2 for Type {} impl Trait for Type { fn foo(&self) {} fn bar() {} } pub fn do_something<X: Trait>(_: X) {} +pub fn do_something_type(_: Type) {} +pub fn do_something_trait(_: Box<dyn Trait2>) {} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-3.rs b/tests/run-make/crate-loading/multiple-dep-versions-3.rs index f5c4d1baa81..07444511472 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-3.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-3.rs @@ -2,7 +2,7 @@ #![crate_type = "rlib"] extern crate dependency; -pub use dependency::Type; +pub use dependency::{Trait2, Type, do_something_trait, do_something_type}; pub struct OtherType; impl dependency::Trait for OtherType { fn foo(&self) {} diff --git a/tests/run-make/crate-loading/multiple-dep-versions.rs b/tests/run-make/crate-loading/multiple-dep-versions.rs index c68a9e6489f..3a4a20d38fc 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions.rs @@ -1,11 +1,13 @@ extern crate dep_2_reexport; extern crate dependency; -use dep_2_reexport::{OtherType, Type}; -use dependency::{Trait, do_something}; +use dep_2_reexport::{OtherType, Trait2, Type}; +use dependency::{Trait, do_something, do_something_trait, do_something_type}; fn main() { do_something(Type); Type.foo(); Type::bar(); do_something(OtherType); + do_something_type(Type); + do_something_trait(Box::new(Type) as Box<dyn Trait2>); } diff --git a/tests/run-make/crate-loading/multiple-dep-versions.stderr b/tests/run-make/crate-loading/multiple-dep-versions.stderr index 5888aad8f37..6e1d6111b58 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions.stderr +++ b/tests/run-make/crate-loading/multiple-dep-versions.stderr @@ -17,9 +17,9 @@ LL | pub trait Trait { ::: replaced | LL | extern crate dep_2_reexport; - | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo` + | ---------------------------- one version of crate `dependency` used here, as a dependency of crate `foo` LL | extern crate dependency; - | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate + | ------------------------ one version of crate `dependency` used here, as a direct dependency of the current crate | ::: replaced | @@ -51,7 +51,7 @@ LL | fn foo(&self); | ::: replaced | -LL | use dependency::{Trait, do_something}; +LL | use dependency::{Trait, do_something, do_something_trait, do_something_type}; | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency` | ::: replaced @@ -76,7 +76,7 @@ LL | fn bar(); | ::: replaced | -LL | use dependency::{Trait, do_something}; +LL | use dependency::{Trait, do_something, do_something_trait, do_something_type}; | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency` | ::: replaced @@ -101,9 +101,9 @@ LL | pub trait Trait { ::: replaced | LL | extern crate dep_2_reexport; - | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo` + | ---------------------------- one version of crate `dependency` used here, as a dependency of crate `foo` LL | extern crate dependency; - | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate + | ------------------------ one version of crate `dependency` used here, as a direct dependency of the current crate | ::: replaced | @@ -121,7 +121,71 @@ note: required by a bound in `do_something` LL | pub fn do_something<X: Trait>(_: X) {} | ^^^^^ required by this bound in `do_something` -error: aborting due to 4 previous errors +error[E0308]: mismatched types + --> replaced + | +LL | do_something_type(Type); + | ----------------- ^^^^ expected `dependency::Type`, found `dep_2_reexport::Type` + | | + | arguments to this function are incorrect + | +note: two different versions of crate `dependency` are being used; two types coming from two different versions of the same crate are different types even if they look the same + --> replaced + | +LL | pub struct Type(pub i32); + | ^^^^^^^^^^^^^^^ this is the expected type `dependency::Type` + | + ::: replaced + | +LL | pub struct Type; + | ^^^^^^^^^^^^^^^ this is the found type `dep_2_reexport::Type` + | + ::: replaced + | +LL | extern crate dep_2_reexport; + | ---------------------------- one version of crate `dependency` used here, as a dependency of crate `foo` +LL | extern crate dependency; + | ------------------------ one version of crate `dependency` used here, as a direct dependency of the current crate + = help: you can use `cargo tree` to explore your dependency tree +note: function defined here + --> replaced + | +LL | pub fn do_something_type(_: Type) {} + | ^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> replaced + | +LL | do_something_trait(Box::new(Type) as Box<dyn Trait2>); + | ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `dependency::Trait2`, found trait `dep_2_reexport::Trait2` + | | + | arguments to this function are incorrect + | +note: two different versions of crate `dependency` are being used; two types coming from two different versions of the same crate are different types even if they look the same + --> replaced + | +LL | pub trait Trait2 {} + | ^^^^^^^^^^^^^^^^ this is the expected trait `dependency::Trait2` + | + ::: replaced + | +LL | pub trait Trait2 {} + | ^^^^^^^^^^^^^^^^ this is the found trait `dep_2_reexport::Trait2` + | + ::: replaced + | +LL | extern crate dep_2_reexport; + | ---------------------------- one version of crate `dependency` used here, as a dependency of crate `foo` +LL | extern crate dependency; + | ------------------------ one version of crate `dependency` used here, as a direct dependency of the current crate + = help: you can use `cargo tree` to explore your dependency tree +note: function defined here + --> replaced + | +LL | pub fn do_something_trait(_: Box<dyn Trait2>) {} + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0277, E0599. +Some errors have detailed explanations: E0277, E0308, E0599. For more information about an error, try `rustc --explain E0277`. \ No newline at end of file diff --git a/tests/run-make/libs-through-symlinks/Makefile b/tests/run-make/libs-through-symlinks/Makefile index 592eae663a4..c6ff566a0e8 100644 --- a/tests/run-make/libs-through-symlinks/Makefile +++ b/tests/run-make/libs-through-symlinks/Makefile @@ -3,10 +3,20 @@ include ../tools.mk # ignore-windows +# The option -n for the AIX ln command has a different purpose than it does +# on Linux. On Linux, the -n option is used to treat the destination path as +# normal file if it is a symbolic link to a directory, which is the default +# behavior of the AIX ln command. +ifeq ($(UNAME),AIX) +LN_FLAGS := -sf +else +LN_FLAGS := -nsf +endif + NAME := $(shell $(RUSTC) --print file-names foo.rs) all: mkdir -p $(TMPDIR)/outdir $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) - ln -nsf outdir/$(NAME) $(TMPDIR) + ln $(LN_FLAGS) outdir/$(NAME) $(TMPDIR) RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/run-make/missing-unstable-trait-bound/missing-bound.rs b/tests/run-make/missing-unstable-trait-bound/missing-bound.rs new file mode 100644 index 00000000000..65d0745f494 --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/missing-bound.rs @@ -0,0 +1,4 @@ +pub fn baz<T>(t: std::ops::Range<T>) { + for _ in t {} +} +fn main() {} diff --git a/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr new file mode 100644 index 00000000000..7196a1a6fed --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/missing-bound.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `T: Step` is not satisfied + --> missing-bound.rs:2:14 + | +2 | for _ in t {} + | ^ the trait `Step` is not implemented for `T` + | + = note: required for `std::ops::Range<T>` to implement `Iterator` + = note: required for `std::ops::Range<T>` to implement `IntoIterator` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/run-make/missing-unstable-trait-bound/rmake.rs b/tests/run-make/missing-unstable-trait-bound/rmake.rs new file mode 100644 index 00000000000..20f77f7c9aa --- /dev/null +++ b/tests/run-make/missing-unstable-trait-bound/rmake.rs @@ -0,0 +1,24 @@ +//@ only-linux +//@ ignore-wasm32 +//@ ignore-wasm64 +// ignore-tidy-linelength + +// Ensure that on stable we don't suggest restricting with an unsafe trait and we continue +// mentioning the rest of the obligation chain. + +use run_make_support::{diff, rust_lib_name, rustc}; + +fn main() { + let out = rustc() + .env("RUSTC_BOOTSTRAP", "-1") + .input("missing-bound.rs") + .run_fail() + .assert_stderr_not_contains("help: consider restricting type parameter `T`") + .assert_stderr_contains( + r#" + = note: required for `std::ops::Range<T>` to implement `Iterator` + = note: required for `std::ops::Range<T>` to implement `IntoIterator`"#, + ) + .stderr_utf8(); + diff().expected_file("missing-bound.stderr").actual_text("(stable rustc)", &out).run() +} diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs index 19d53f84cb6..ec35b52e33b 100644 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs @@ -2,6 +2,7 @@ //@ compile-flags: --document-private-items //@ build-pass //@ only-linux +// https://github.com/rust-lang/rust/issues/107918 #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs index 5a896167083..4fa60f8878d 100644 --- a/tests/rustdoc-ui/issues/issue-110900.rs +++ b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/110900 #![crate_type="lib"] diff --git a/tests/rustdoc-ui/issues/issue-106213.rs b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs index 5c3a8390252..c954162589d 100644 --- a/tests/rustdoc-ui/issues/issue-106213.rs +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs @@ -1,5 +1,6 @@ //@ compile-flags: --document-private-items //@ edition:2021 +// https://github.com/rust-lang/rust/issues/106213 fn use_avx() -> dyn { //~^ ERROR at least one trait is required for an object type diff --git a/tests/rustdoc-ui/issues/issue-106213.stderr b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr index fa79fe2e71c..b029fee510e 100644 --- a/tests/rustdoc-ui/issues/issue-106213.stderr +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr @@ -1,5 +1,5 @@ error[E0224]: at least one trait is required for an object type - --> $DIR/issue-106213.rs:4:17 + --> $DIR/ice-bare-dyn-106213.rs:5:17 | LL | fn use_avx() -> dyn { | ^^^ diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs index bd8ec4e8b58..027574923c7 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Znormalize-docs +// https://github.com/rust-lang/rust/issues/105742 use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr index 0f09d637f38..06a1cf6b118 100644 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -1,11 +1,11 @@ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -15,13 +15,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -127,13 +127,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 + --> $DIR/ice-generic-type-alias-105742.rs:5:40 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -143,13 +143,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<'_> = T, Output = T>) { | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 + --> $DIR/ice-generic-type-alias-105742.rs:5:40 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -159,13 +159,13 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<T> = T, Output = T>) { | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -176,13 +176,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -193,13 +193,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -210,13 +210,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -227,13 +227,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -244,13 +244,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -261,13 +261,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -278,13 +278,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -295,13 +295,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0038]: the trait `SVec` cannot be made into an object - --> $DIR/issue-105742.rs:4:31 + --> $DIR/ice-generic-type-alias-105742.rs:5:31 | LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object | note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $DIR/issue-105742.rs:14:17 + --> $DIR/ice-generic-type-alias-105742.rs:15:17 | LL | pub trait SVec: Index< | ____________----__^ @@ -329,13 +329,13 @@ LL | pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) { | ~~~~ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -346,13 +346,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -363,13 +363,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -380,13 +380,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -397,13 +397,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -414,13 +414,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -431,13 +431,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -448,13 +448,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -465,13 +465,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -482,13 +482,13 @@ LL | <Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 + --> $DIR/ice-generic-type-alias-105742.rs:16:21 | LL | <Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -499,13 +499,13 @@ LL | <Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -516,13 +516,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 + --> $DIR/ice-generic-type-alias-105742.rs:27:37 | LL | Output = <Index<<Self as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -533,13 +533,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -550,13 +550,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 + --> $DIR/ice-generic-type-alias-105742.rs:38:30 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -567,13 +567,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -584,13 +584,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 + --> $DIR/ice-generic-type-alias-105742.rs:38:46 | LL | Output = <Self as SVec>::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - @@ -601,13 +601,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<T>, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 + --> $DIR/ice-generic-type-alias-105742.rs:62:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -617,13 +617,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 + --> $DIR/ice-generic-type-alias-105742.rs:62:38 | LL | fn len(&self) -> <Self as SVec>::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 + --> $DIR/ice-generic-type-alias-105742.rs:60:10 | LL | type Item<'a, T>; | ^^^^ - diff --git a/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs new file mode 100644 index 00000000000..651fd9ab4b8 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/105737 +impl Vec<lol> {} +//~^ ERROR + +pub fn lol() {} diff --git a/tests/rustdoc-ui/issues/issue-105737.stderr b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr index 2c63c345e46..49cbebc91d9 100644 --- a/tests/rustdoc-ui/issues/issue-105737.stderr +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr @@ -1,5 +1,5 @@ error[E0747]: constant provided when a type was expected - --> $DIR/issue-105737.rs:1:10 + --> $DIR/ice-impl-fn-generic-105737.rs:2:10 | LL | impl Vec<lol> {} | ^^^ diff --git a/tests/rustdoc-ui/issues/issue-101076.rs b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs index f9b93c408fd..0c9a8b9175b 100644 --- a/tests/rustdoc-ui/issues/issue-101076.rs +++ b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/101076 const _: () = { #[macro_export] diff --git a/tests/rustdoc-ui/issues/issue-106226.rs b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs index 71b497a9adc..71b497a9adc 100644 --- a/tests/rustdoc-ui/issues/issue-106226.rs +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs diff --git a/tests/rustdoc-ui/issues/issue-106226.stderr b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr index 4d063b46188..e9080925450 100644 --- a/tests/rustdoc-ui/issues/issue-106226.stderr +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr @@ -1,5 +1,5 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases - --> $DIR/issue-106226.rs:2:11 + --> $DIR/ice-placeholder-type-alias-106226.rs:2:11 | LL | type F = [_; ()]; | ^ not allowed in type signatures diff --git a/tests/rustdoc-ui/issues/ice-raw-str-105334.rs b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs new file mode 100644 index 00000000000..f18f0456fdd --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs @@ -0,0 +1,3 @@ +// https://github.com/rust-lang/rust/issues/105334 +impl Vec< br##"*.."## > {} +//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105334.stderr b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr index d992b219b3b..2096757fbb9 100644 --- a/tests/rustdoc-ui/issues/issue-105334.stderr +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr @@ -1,5 +1,5 @@ error[E0747]: constant provided when a type was expected - --> $DIR/issue-105334.rs:1:11 + --> $DIR/ice-raw-str-105334.rs:2:11 | LL | impl Vec< br##"*.."## > {} | ^^^^^^^^^^^ diff --git a/tests/rustdoc-ui/issues/issue-102986.rs b/tests/rustdoc-ui/issues/ice-typeof-102986.rs index 001784ac285..8fcbfffe172 100644 --- a/tests/rustdoc-ui/issues/issue-102986.rs +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/102986 struct Struct { y: (typeof("hey"),), //~^ `typeof` is a reserved keyword but unimplemented diff --git a/tests/rustdoc-ui/issues/issue-102986.stderr b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr index d91f93f394a..20dbb2661bc 100644 --- a/tests/rustdoc-ui/issues/issue-102986.stderr +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr @@ -1,5 +1,5 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-102986.rs:2:9 + --> $DIR/ice-typeof-102986.rs:3:9 | LL | y: (typeof("hey"),), | ^^^^^^^^^^^^^ reserved keyword diff --git a/tests/rustdoc-ui/issues/issue-103997.rs b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs index ebd1d2e4447..b6ba4e48cff 100644 --- a/tests/rustdoc-ui/issues/issue-103997.rs +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/103997 pub fn foo() {} diff --git a/tests/rustdoc-ui/issues/issue-103997.stderr b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr index c06db91496f..9cb64079c61 100644 --- a/tests/rustdoc-ui/issues/issue-103997.stderr +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr @@ -1,5 +1,5 @@ warning: unresolved link to `Self::foo` - --> $DIR/issue-103997.rs:5:13 + --> $DIR/ice-unresolved-self-103997.rs:6:13 | LL | /// [`foo`](Self::foo) | ^^^^^^^^^ no item named `Self` in scope diff --git a/tests/rustdoc-ui/issues/issue-105334.rs b/tests/rustdoc-ui/issues/issue-105334.rs deleted file mode 100644 index ee1adc6a029..00000000000 --- a/tests/rustdoc-ui/issues/issue-105334.rs +++ /dev/null @@ -1,2 +0,0 @@ -impl Vec< br##"*.."## > {} -//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105737.rs b/tests/rustdoc-ui/issues/issue-105737.rs deleted file mode 100644 index 154f069d8ff..00000000000 --- a/tests/rustdoc-ui/issues/issue-105737.rs +++ /dev/null @@ -1,4 +0,0 @@ -impl Vec<lol> {} -//~^ ERROR - -pub fn lol() {} diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr index 9aba0332164..40dc1cc0e70 100644 --- a/tests/rustdoc-ui/issues/issue-96287.stderr +++ b/tests/rustdoc-ui/issues/issue-96287.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `V` LL | pub type Foo<V> = impl Trait<V::Assoc>; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; | ++++++++++++++++ @@ -16,7 +16,7 @@ LL | pub type Foo<V> = impl Trait<V::Assoc>; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; | ++++++++++++++++ diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr index d87e769b505..045516d7d2f 100644 --- a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied LL | pub struct Structure<C: Tec> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `Bar` | LL | pub struct Structure<C: Tec + Bar<5>> { | ++++++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `C: Bar<5>` is not satisfied LL | _field: C::BarType, | ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `Bar` | LL | pub struct Structure<C: Tec + Bar<5>> { | ++++++++ diff --git a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs index f273bbc99a8..656cfca1ed1 100644 --- a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs +++ b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs @@ -15,16 +15,16 @@ extern crate rustc_span; extern crate rustc_symbol_mangling; extern crate rustc_target; +use std::any::Any; + use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::{CodegenResults, CrateInfo}; use rustc_data_structures::fx::FxIndexMap; -use rustc_errors::ErrorGuaranteed; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::ty::TyCtxt; -use rustc_session::config::OutputFilenames; use rustc_session::Session; -use std::any::Any; +use rustc_session::config::OutputFilenames; struct TheBackend; @@ -60,17 +60,12 @@ impl CodegenBackend for TheBackend { (*codegen_results, FxIndexMap::default()) } - fn link( - &self, - sess: &Session, - codegen_results: CodegenResults, - outputs: &OutputFilenames, - ) -> Result<(), ErrorGuaranteed> { - use rustc_session::{ - config::{CrateType, OutFileName}, - output::out_filename, - }; + fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) { use std::io::Write; + + use rustc_session::config::{CrateType, OutFileName}; + use rustc_session::output::out_filename; + let crate_name = codegen_results.crate_info.local_crate_name; for &crate_type in sess.opts.crate_types.iter() { if crate_type != CrateType::Rlib { @@ -88,7 +83,6 @@ impl CodegenBackend for TheBackend { } } } - Ok(()) } } diff --git a/tests/ui-fulldeps/compiler-calls.rs b/tests/ui-fulldeps/compiler-calls.rs index f6c10add290..5fb47c87e50 100644 --- a/tests/ui-fulldeps/compiler-calls.rs +++ b/tests/ui-fulldeps/compiler-calls.rs @@ -12,7 +12,7 @@ extern crate rustc_interface; use rustc_interface::interface; struct TestCalls<'a> { - count: &'a mut u32 + count: &'a mut u32, } impl rustc_driver::Callbacks for TestCalls<'_> { @@ -24,8 +24,9 @@ impl rustc_driver::Callbacks for TestCalls<'_> { fn main() { let mut count = 1; let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; - rustc_driver::catch_fatal_errors(|| { - rustc_driver::RunCompiler::new(&args, &mut TestCalls { count: &mut count }).run().ok(); + rustc_driver::catch_fatal_errors(|| -> interface::Result<()> { + rustc_driver::RunCompiler::new(&args, &mut TestCalls { count: &mut count }).run(); + Ok(()) }) .ok(); assert_eq!(count, 2); diff --git a/tests/ui-fulldeps/lexer/unicode-version.rs b/tests/ui-fulldeps/lexer/unicode-version.rs new file mode 100644 index 00000000000..cd02b952895 --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.rs @@ -0,0 +1,27 @@ +// This test is used to validate which version of Unicode is used for parsing +// identifiers. If the Unicode version changes, it should also be updated in +// the reference at +// https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. + +//@ run-pass +//@ check-run-results +//@ ignore-cross-compile +//@ reference: ident.unicode +//@ reference: ident.normalization + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_lexer; +extern crate rustc_parse; + +fn main() { + println!("Checking if Unicode version changed."); + println!( + "If the Unicode version changes are intentional, \ + it should also be updated in the reference at \ + https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md." + ); + println!("Unicode XID version is: {:?}", rustc_lexer::UNICODE_XID_VERSION); + println!("Unicode normalization version is: {:?}", rustc_parse::UNICODE_NORMALIZATION_VERSION); +} diff --git a/tests/ui-fulldeps/lexer/unicode-version.run.stdout b/tests/ui-fulldeps/lexer/unicode-version.run.stdout new file mode 100644 index 00000000000..f32c8365cdf --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.run.stdout @@ -0,0 +1,4 @@ +Checking if Unicode version changed. +If the Unicode version changes are intentional, it should also be updated in the reference at https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +Unicode XID version is: (16, 0, 0) +Unicode normalization version is: (16, 0, 0) diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs index af98f93297b..8ea2ac61971 100644 --- a/tests/ui-fulldeps/obtain-borrowck.rs +++ b/tests/ui-fulldeps/obtain-borrowck.rs @@ -47,7 +47,8 @@ fn main() { rustc_args.push("-Zpolonius".to_owned()); let mut callbacks = CompilerCalls::default(); // Call the Rust compiler with our callbacks. - rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks).run() + rustc_driver::RunCompiler::new(&rustc_args, &mut callbacks).run(); + Ok(()) }); std::process::exit(exit_code); } diff --git a/tests/ui-fulldeps/run-compiler-twice.rs b/tests/ui-fulldeps/run-compiler-twice.rs index cce4eac0d7c..d4c9fd019b0 100644 --- a/tests/ui-fulldeps/run-compiler-twice.rs +++ b/tests/ui-fulldeps/run-compiler-twice.rs @@ -17,8 +17,7 @@ extern crate rustc_span; use std::path::{Path, PathBuf}; -use rustc_interface::Linker; -use rustc_interface::interface; +use rustc_interface::{Linker, interface}; use rustc_session::config::{Input, Options, OutFileName, OutputType, OutputTypes}; use rustc_span::FileName; @@ -79,11 +78,11 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path interface::run_compiler(config, |compiler| { let linker = compiler.enter(|queries| { - queries.global_ctxt()?.enter(|tcx| { - tcx.analysis(())?; + queries.global_ctxt().enter(|tcx| { + let _ = tcx.analysis(()); Linker::codegen_and_build_linker(tcx, &*compiler.codegen_backend) }) }); - linker.unwrap().link(&compiler.sess, &*compiler.codegen_backend).unwrap(); + linker.link(&compiler.sess, &*compiler.codegen_backend); }); } diff --git a/tests/ui/assign-imm-local-twice.rs b/tests/ui/assign-imm-local-twice.rs deleted file mode 100644 index b2dfeb564d9..00000000000 --- a/tests/ui/assign-imm-local-twice.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn test() { - let v: isize; - //~^ HELP consider making this binding mutable - //~| SUGGESTION mut - v = 1; //~ NOTE first assignment - println!("v={}", v); - v = 2; //~ ERROR cannot assign twice to immutable variable - //~| NOTE cannot assign twice to immutable - println!("v={}", v); -} - -fn main() { -} diff --git a/tests/ui/assoc-lang-items.rs b/tests/ui/assoc-lang-items.rs deleted file mode 100644 index 23453d201a7..00000000000 --- a/tests/ui/assoc-lang-items.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(lang_items)] - -trait Foo { - #[lang = "dummy_lang_item_1"] //~ ERROR definition - fn foo() {} - - #[lang = "dummy_lang_item_2"] //~ ERROR definition - fn bar(); - - #[lang = "dummy_lang_item_3"] //~ ERROR definition - type MyType; -} - -struct Bar; - -impl Bar { - #[lang = "dummy_lang_item_4"] //~ ERROR definition - fn test() {} -} - -fn main() {} diff --git a/tests/ui/assoc-oddities-3.rs b/tests/ui/assoc-oddities-3.rs deleted file mode 100644 index ffde2ccf786..00000000000 --- a/tests/ui/assoc-oddities-3.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass - -fn that_odd_parse(c: bool, n: usize) -> u32 { - let x = 2; - let a = [1, 2, 3, 4]; - let b = [5, 6, 7, 7]; - x + if c { a } else { b }[n] -} - -fn main() { - assert_eq!(4, that_odd_parse(true, 1)); - assert_eq!(8, that_odd_parse(false, 1)); -} diff --git a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr index 9713051d973..4f951ee4b4e 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh<T>(foo: <T as Get>::Value) {} | ^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Get` | LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {} | +++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh<T>(foo: <T as Get>::Value) {} | ^^ the trait `Get` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Get` | LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {} | +++++ diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 9c0ae59ae43..61247cee1f3 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar` | LL | type Bar: Clone = Vec<T>; | ^^^^^ required by this bound in `Foo::Bar` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | trait Foo<T: std::clone::Clone> { | +++++++++++++++++++ @@ -132,7 +132,7 @@ LL | Self::Baz: Clone, ... LL | type Baz = T; | --- required by a bound in this associated type -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 9c0ae59ae43..61247cee1f3 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -47,7 +47,7 @@ note: required by a bound in `Foo::Bar` | LL | type Bar: Clone = Vec<T>; | ^^^^^ required by this bound in `Foo::Bar` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | trait Foo<T: std::clone::Clone> { | +++++++++++++++++++ @@ -132,7 +132,7 @@ LL | Self::Baz: Clone, ... LL | type Baz = T; | --- required by a bound in this associated type -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr index 5278bdb7a5c..b2a86bb7f75 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'b> T: X<'b, T>` is not satisfied LL | impl<S, T> X<'_, T> for (S,) { | ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `X` | LL | impl<S, T: for<'b> X<'b, T>> X<'_, T> for (S,) { | ++++++++++++++++++ diff --git a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr index 70bf90150b8..0815bdce16f 100644 --- a/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr +++ b/tests/ui/associated-types/issue-27675-unchecked-bounds.stderr @@ -9,7 +9,7 @@ note: required by a bound in `copy` | LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T { | +++++++++++++++++++ diff --git a/tests/ui/associated-types/issue-43784-associated-type.stderr b/tests/ui/associated-types/issue-43784-associated-type.stderr index 529fc1f119a..ba4e683194f 100644 --- a/tests/ui/associated-types/issue-43784-associated-type.stderr +++ b/tests/ui/associated-types/issue-43784-associated-type.stderr @@ -14,7 +14,7 @@ note: required by a bound in `Complete::Assoc` | LL | type Assoc: Partial<Self>; | ^^^^^^^^^^^^^ required by this bound in `Complete::Assoc` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Complete for T { | +++++++++++++++++++ diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr index 6c77ee6044f..ec2890cc8e7 100644 --- a/tests/ui/associated-types/issue-59324.stderr +++ b/tests/ui/associated-types/issue-59324.stderr @@ -7,7 +7,7 @@ LL | | LL | | Service<AssocType = <Bug as Foo>::OnlyFoo> | |______________________________________________^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ @@ -24,7 +24,7 @@ LL | | LL | | } | |_^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ @@ -38,7 +38,7 @@ LL | | &self, LL | | ) -> Self::AssocType; | |_________________________^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ @@ -61,7 +61,7 @@ error[E0277]: the trait bound `Bug: Foo` is not satisfied LL | ) -> Self::AssocType; | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug` | -help: consider further restricting this bound +help: consider further restricting type parameter `Bug` with trait `Foo` | LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr index 317c04d2c74..8de6a825042 100644 --- a/tests/ui/async-await/issue-70818.stderr +++ b/tests/ui/async-await/issue-70818.stderr @@ -9,7 +9,7 @@ note: captured value is not `Send` | LL | async { (ty, ty1) } | ^^^ has type `U` which is not `Send` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Send` | LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { | +++++++++++++++++++ diff --git a/tests/ui/async-await/issue-86507.stderr b/tests/ui/async-await/issue-86507.stderr index f4cd7c42706..6385a8c975e 100644 --- a/tests/ui/async-await/issue-86507.stderr +++ b/tests/ui/async-await/issue-86507.stderr @@ -14,7 +14,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless LL | let x = x; | ^ has type `&T` which is not `Send`, because `T` is not `Sync` = note: required for the cast from `Pin<Box<{async block@$DIR/issue-86507.rs:18:17: 18:27}>>` to `Pin<Box<(dyn Future<Output = ()> + Send + 'async_trait)>>` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) | +++++++++++++++++++ diff --git a/tests/ui/atomic-from-mut-not-available.rs b/tests/ui/atomic-from-mut-not-available.rs deleted file mode 100644 index 8326187838a..00000000000 --- a/tests/ui/atomic-from-mut-not-available.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ only-x86 -//@ only-linux - -fn main() { - core::sync::atomic::AtomicU64::from_mut(&mut 0u64); - //~^ ERROR: no function or associated item named `from_mut` found for struct `AtomicU64` -} diff --git a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr index 4c1de72798c..27e38ce06a4 100644 --- a/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr +++ b/tests/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr @@ -30,7 +30,7 @@ LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) } | ^ - you could clone this value | | | consider constraining this type parameter with `Clone` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn copy<T: Magic + Copy>(x: T) -> (T, T) { (x, x) } | ++++++ diff --git a/tests/ui/binop/binop-consume-args.stderr b/tests/ui/binop/binop-consume-args.stderr index 1b59216b3c7..d9d92a44766 100644 --- a/tests/ui/binop/binop-consume-args.stderr +++ b/tests/ui/binop/binop-consume-args.stderr @@ -17,7 +17,7 @@ LL | lhs + rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -40,7 +40,7 @@ LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs + rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn add<A: Add<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -64,7 +64,7 @@ LL | lhs - rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -87,7 +87,7 @@ LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs - rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn sub<A: Sub<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -111,7 +111,7 @@ LL | lhs * rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -134,7 +134,7 @@ LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs * rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn mul<A: Mul<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -158,7 +158,7 @@ LL | lhs / rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -181,7 +181,7 @@ LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs / rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn div<A: Div<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -205,7 +205,7 @@ LL | lhs % rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -228,7 +228,7 @@ LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs % rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn rem<A: Rem<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -252,7 +252,7 @@ LL | lhs & rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -275,7 +275,7 @@ LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs & rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitand<A: BitAnd<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -299,7 +299,7 @@ LL | lhs | rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -322,7 +322,7 @@ LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs | rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitor<A: BitOr<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -346,7 +346,7 @@ LL | lhs ^ rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -369,7 +369,7 @@ LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs ^ rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn bitxor<A: BitXor<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -393,7 +393,7 @@ LL | lhs << rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -416,7 +416,7 @@ LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs << rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn shl<A: Shl<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ @@ -440,7 +440,7 @@ LL | lhs >> rhs; | --- you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with trait `Copy` | LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { | ++++++ @@ -463,7 +463,7 @@ LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) { | ^ consider constraining this type parameter with `Clone` LL | lhs >> rhs; | --- you could clone this value -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Copy` | LL | fn shr<A: Shr<B, Output=()>, B: Copy>(lhs: A, rhs: B) { | ++++++ diff --git a/tests/ui/binop/binop-move-semantics.stderr b/tests/ui/binop/binop-move-semantics.stderr index 45c7f110406..2e661c44abd 100644 --- a/tests/ui/binop/binop-move-semantics.stderr +++ b/tests/ui/binop/binop-move-semantics.stderr @@ -20,7 +20,7 @@ LL | x | - you could clone this value note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn double_move<T: Add<Output=()> + Copy>(x: T) { | ++++++ @@ -40,7 +40,7 @@ help: consider cloning the value if the performance cost is acceptable | LL | x.clone() | ++++++++ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) { | ++++++ diff --git a/tests/ui/binop/issue-93927.stderr b/tests/ui/binop/issue-93927.stderr index 9bcf2b17357..ff5ecf66be6 100644 --- a/tests/ui/binop/issue-93927.stderr +++ b/tests/ui/binop/issue-93927.stderr @@ -6,7 +6,7 @@ LL | val == val | | | MyType<T> | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Eq` | LL | fn cond<T: PartialEq + std::cmp::Eq>(val: MyType<T>) -> bool { | ++++++++++++++ diff --git a/tests/ui/borrowck/assign-imm-local-twice.fixed b/tests/ui/borrowck/assign-imm-local-twice.fixed new file mode 100644 index 00000000000..dca994141bb --- /dev/null +++ b/tests/ui/borrowck/assign-imm-local-twice.fixed @@ -0,0 +1,21 @@ +//! Check that we do not allow assigning twice to an immutable variable. This test also checks a +//! few pieces of borrowck diagnostics: +//! +//! - A multipart borrowck diagnostics that points out the first assignment to an immutable +//! variable, alongside violating assignments that follow subsequently. +//! - A suggestion diagnostics to make the immutable binding mutable. + +//@ run-rustfix + +fn main() { + let mut v: isize; + //~^ HELP consider making this binding mutable + //~| SUGGESTION mut + v = 1; + //~^ NOTE first assignment + println!("v={}", v); + v = 2; + //~^ ERROR cannot assign twice to immutable variable + //~| NOTE cannot assign twice to immutable + println!("v={}", v); +} diff --git a/tests/ui/borrowck/assign-imm-local-twice.rs b/tests/ui/borrowck/assign-imm-local-twice.rs new file mode 100644 index 00000000000..43437fa69fa --- /dev/null +++ b/tests/ui/borrowck/assign-imm-local-twice.rs @@ -0,0 +1,21 @@ +//! Check that we do not allow assigning twice to an immutable variable. This test also checks a +//! few pieces of borrowck diagnostics: +//! +//! - A multipart borrowck diagnostics that points out the first assignment to an immutable +//! variable, alongside violating assignments that follow subsequently. +//! - A suggestion diagnostics to make the immutable binding mutable. + +//@ run-rustfix + +fn main() { + let v: isize; + //~^ HELP consider making this binding mutable + //~| SUGGESTION mut + v = 1; + //~^ NOTE first assignment + println!("v={}", v); + v = 2; + //~^ ERROR cannot assign twice to immutable variable + //~| NOTE cannot assign twice to immutable + println!("v={}", v); +} diff --git a/tests/ui/assign-imm-local-twice.stderr b/tests/ui/borrowck/assign-imm-local-twice.stderr index fda3aa3de1b..0a2138d0b96 100644 --- a/tests/ui/assign-imm-local-twice.stderr +++ b/tests/ui/borrowck/assign-imm-local-twice.stderr @@ -1,9 +1,9 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/assign-imm-local-twice.rs:7:5 + --> $DIR/assign-imm-local-twice.rs:17:5 | LL | v = 1; | ----- first assignment to `v` -LL | println!("v={}", v); +... LL | v = 2; | ^^^^^ cannot assign twice to immutable variable | diff --git a/tests/ui/borrowck/clone-on-ref.stderr b/tests/ui/borrowck/clone-on-ref.stderr index d5d21296a3f..911c136086c 100644 --- a/tests/ui/borrowck/clone-on-ref.stderr +++ b/tests/ui/borrowck/clone-on-ref.stderr @@ -12,7 +12,7 @@ LL | LL | drop(cloned_items); | ------------ immutable borrow later used here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn foo<T: Default + Clone>(list: &mut Vec<T>) { | +++++++ @@ -39,7 +39,7 @@ LL | fn bar<T: std::fmt::Display>(x: T) { | ^ consider constraining this type parameter with `Clone` LL | let a = &x; | - you could clone this value -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn bar<T: std::fmt::Display + Clone>(x: T) { | +++++++ diff --git a/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr b/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr index 6997710ec89..e32a0c54dfe 100644 --- a/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr +++ b/tests/ui/borrowck/move-error-suggest-clone-panic-issue-127915.stderr @@ -15,7 +15,7 @@ LL | fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { ... LL | 6, a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g, | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn test<T: Copy, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { | ++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index 592aa4369ce..9915b772afa 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send+Sync { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { } | +++++++++++++++++++ @@ -27,7 +27,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send+Sync { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { } | +++++++++++++++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 251651df4f9..39a04186981 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -14,7 +14,7 @@ note: required by a bound in `RequiresRequiresShareAndSend` | LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } | ^^^^ required by this bound in `RequiresRequiresShareAndSend` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { } | +++++++++++++++++++ diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 4a25c42b583..dd273b875ae 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | trait Foo : Send { } | ^^^^ required by this bound in `Foo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | impl <T: Sync+'static + std::marker::Send> Foo for T { } | +++++++++++++++++++ diff --git a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index 8157590bd9e..9ceee477856 100644 --- a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` | LL | struct X<F> where F: FnOnce() + 'static + Send { | ^^^^ required by this bound in `X` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Send` | LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send { | +++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `X` | LL | struct X<F> where F: FnOnce() + 'static + Send { | ^^^^ required by this bound in `X` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Send` | LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send { | +++++++++++++++++++ diff --git a/tests/ui/closures/closure-bounds-subtype.stderr b/tests/ui/closures/closure-bounds-subtype.stderr index 42588668e8a..34c5e0299a7 100644 --- a/tests/ui/closures/closure-bounds-subtype.stderr +++ b/tests/ui/closures/closure-bounds-subtype.stderr @@ -15,7 +15,7 @@ help: use parentheses to call this type parameter | LL | take_const_owned(f()); | ++ -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Sync` | LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync { | +++++++++++++++++++ diff --git a/tests/ui/closures/issue-67123.stderr b/tests/ui/closures/issue-67123.stderr index bdafeaef15f..7db82845ea5 100644 --- a/tests/ui/closures/issue-67123.stderr +++ b/tests/ui/closures/issue-67123.stderr @@ -7,7 +7,7 @@ LL | || { t; t; }; | value moved here | = note: move occurs because `t` has type `T`, which does not implement the `Copy` trait -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn foo<T: Copy>(t: T) { | ++++++ diff --git a/tests/ui/assign-assign.rs b/tests/ui/codegen/assign-expr-unit-type.rs index 002393f5bff..b4268b5e09a 100644 --- a/tests/ui/assign-assign.rs +++ b/tests/ui/codegen/assign-expr-unit-type.rs @@ -1,5 +1,11 @@ +//! Regression test for [Using the result of an assignment expression results in an LLVM assert +//! #483][issue-483]. This test checks that assignment expressions produce a unit type, and is +//! properly lowered to LLVM IR such that it does not trigger an LLVM assertion. This test was added +//! *really* early, back in 2011. +//! +//! [issue-483]: https://github.com/rust-lang/rust/issues/483 + //@ run-pass -// Issue 483 - Assignment expressions result in nil fn test_assign() { let mut x: isize; @@ -27,4 +33,7 @@ fn test_assign_op() { assert_eq!(z, ()); } -pub fn main() { test_assign(); test_assign_op(); } +pub fn main() { + test_assign(); + test_assign_op(); +} diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr index 88de8023f6d..01b6eaf422e 100644 --- a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -41,7 +41,7 @@ note: required by a bound in `W` | LL | struct W<T: Trait>(*mut T); | ^^^^^ required by this bound in `W` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | impl<T: Trait> Trait for W<W<W<T>>> {} | +++++++ diff --git a/tests/ui/const-generics/issues/issue-61336-2.stderr b/tests/ui/const-generics/issues/issue-61336-2.stderr index b0864689f74..92a704da8b4 100644 --- a/tests/ui/const-generics/issues/issue-61336-2.stderr +++ b/tests/ui/const-generics/issues/issue-61336-2.stderr @@ -7,7 +7,7 @@ LL | [x; { N }] = note: the `Copy` trait is required because this value will be copied for each element of the array = help: consider using `core::array::from_fn` to initialize the array = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] { | +++++++++++++++++++ diff --git a/tests/ui/const-generics/issues/issue-61336.stderr b/tests/ui/const-generics/issues/issue-61336.stderr index 111afbda343..43e8f5c044a 100644 --- a/tests/ui/const-generics/issues/issue-61336.stderr +++ b/tests/ui/const-generics/issues/issue-61336.stderr @@ -7,7 +7,7 @@ LL | [x; N] = note: the `Copy` trait is required because this value will be copied for each element of the array = help: consider using `core::array::from_fn` to initialize the array = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] { | +++++++++++++++++++ diff --git a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr index 24572040b91..74ec052f6ec 100644 --- a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr +++ b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr @@ -12,7 +12,7 @@ LL | fn unsatisfied(self) LL | where LL | T: Bar<N>, | ^^^^^^ required by this bound in `Foo::<T, N>::unsatisfied` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Bar` | LL | impl<T: Bar<N>, const N: usize> Foo<T, N> { | ++++++++ diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index 11e13c3efdd..bb7ff76b125 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -212,10 +212,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(), - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:23:5 @@ -224,10 +220,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(), - | ++++++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:30:5 @@ -236,10 +228,6 @@ LL | f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | T: ~const FnOnce<()> + ~const FnOnce(), - | +++++++++++++++++ error: aborting due to 25 previous errors diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index 2bdec1bf41b..f40c1871e90 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -19,10 +19,6 @@ LL | Opt::None => f(), | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T { - | +++++++++++++++++ error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:60 diff --git a/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs new file mode 100644 index 00000000000..7a55e13d0ee --- /dev/null +++ b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs @@ -0,0 +1,19 @@ +//! Issue: <https://github.com/rust-lang/rust/issues/131227> +//! Test that constant propagation in SwitchInt does not crash +//! when encountering a ptr-to-int transmute. + +//@ check-pass +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-inline,+DataflowConstProp + +#![crate_type = "lib"] + +static mut G: i32 = 0; + +pub fn myfunc() -> i32 { + let var = &raw mut G; + let u: usize = unsafe { std::mem::transmute(var) }; + match u { + 0 => 0, + _ => 1, + } +} diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr index 4c4f0663eeb..58f8e97dea0 100644 --- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -12,17 +12,6 @@ error: functional record updates are not allowed in destructuring assignments LL | Struct { a, ..d } = Struct { a: 1, b: 2 }; | ^ help: consider removing the trailing pattern -error[E0797]: base expression required after `..` - --> $DIR/struct_destructure_fail.rs:15:19 - | -LL | Struct { a, .. }; - | ^ - | -help: add a base expression here - | -LL | Struct { a, ../* expr */ }; - | ++++++++++ - error[E0026]: struct `Struct` does not have a field named `c` --> $DIR/struct_destructure_fail.rs:10:20 | @@ -48,6 +37,17 @@ help: or always ignore missing fields here LL | Struct { a, .. } = Struct { a: 1, b: 2 }; | ~~~~~~ +error[E0797]: base expression required after `..` + --> $DIR/struct_destructure_fail.rs:15:19 + | +LL | Struct { a, .. }; + | ^ + | +help: add a base expression here + | +LL | Struct { a, ../* expr */ }; + | ++++++++++ + error: aborting due to 5 previous errors Some errors have detailed explanations: E0026, E0027, E0797. diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 3ef11e2c0bb..2caa779ffab 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` | ~~~~~~~~~~~~~~~~~~~~~~ @@ -25,7 +25,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` | ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr index 8138b86ddea..5851731e834 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad2.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad2.stderr @@ -9,7 +9,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Drop for DropMe<T> | +++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `DropMe` | LL | struct DropMe<T: Copy>(T); | ^^^^ required by this bound in `DropMe` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Drop for DropMe<T> | +++++++++++++++++++ diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr index 038f44e8b14..ab2536cc0c9 100644 --- a/tests/ui/error-codes/E0229.stderr +++ b/tests/ui/error-codes/E0229.stderr @@ -42,7 +42,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I` | -help: consider restricting type parameter `I` +help: consider restricting type parameter `I` with trait `Foo` | LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {} | +++++ @@ -53,7 +53,7 @@ error[E0277]: the trait bound `I: Foo` is not satisfied LL | fn baz<I>(x: &<I as Foo<A = Bar>>::A) {} | ^^ the trait `Foo` is not implemented for `I` | -help: consider restricting type parameter `I` +help: consider restricting type parameter `I` with trait `Foo` | LL | fn baz<I: Foo>(x: &<I as Foo<A = Bar>>::A) {} | +++++ diff --git a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr index 9228a047e87..b221195a7bd 100644 --- a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr +++ b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr @@ -25,7 +25,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -73,7 +73,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `Iterator` | LL | fn example<Q: std::iter::Iterator>(q: Q) { | +++++++++++++++++++++ @@ -100,7 +100,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `Iterator` | LL | fn example<Q: std::iter::Iterator>(q: Q) { | +++++++++++++++++++++ @@ -125,7 +125,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -150,7 +150,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -175,7 +175,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -200,7 +200,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -225,7 +225,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -248,7 +248,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -273,7 +273,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -296,7 +296,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -319,7 +319,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -342,7 +342,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -367,7 +367,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -392,7 +392,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ diff --git a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr index b6a24e12bcc..90380091c50 100644 --- a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr +++ b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr @@ -23,7 +23,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -53,7 +53,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -85,7 +85,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -117,7 +117,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -147,7 +147,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -172,7 +172,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T2` | LL | fn example<Q: T2>(q: Q) { | ++++ @@ -204,7 +204,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -236,7 +236,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -261,7 +261,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example<Q: T1>(q: Q) { | ++++ @@ -286,7 +286,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example<Q: T1>(q: Q) { | ++++ @@ -318,7 +318,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ @@ -343,7 +343,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example<Q: T1>(q: Q) { | ++++ @@ -370,7 +370,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T1` | LL | fn example<Q: T1>(q: Q) { | ++++ @@ -402,7 +402,7 @@ note: required by a bound in `want` | LL | fn want<V: T1>(_x: V) {} | ^^ required by this bound in `want` -help: consider restricting type parameter `Q` +help: consider restricting type parameter `Q` with trait `T3` | LL | fn example<Q: T3>(q: Q) { | ++++ diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.rs b/tests/ui/feature-gates/feature-gate-default-field-values.rs new file mode 100644 index 00000000000..d2e41a71602 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-default-field-values.rs @@ -0,0 +1,106 @@ +#![feature(generic_const_exprs)] +#![allow(unused_variables, dead_code, incomplete_features)] + +pub struct S; + +#[derive(Default)] +pub struct Foo { + pub bar: S = S, //~ ERROR default values on fields are experimental + pub baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental +} + +#[derive(Default)] +pub enum Bar { + #[default] + Foo { //~ ERROR the `#[default]` attribute may only be used on unit enum variants + bar: S = S, //~ ERROR default values on fields are experimental + baz: i32 = 42 + 3, //~ ERROR default values on fields are experimental + } +} + +#[derive(Default)] +pub struct Qux<A, const C: i32> { + bar: S = Qux::<A, C>::S, //~ ERROR default values on fields are experimental + baz: i32 = foo(), //~ ERROR default values on fields are experimental + bat: i32 = <Qux<A, C> as T>::K, //~ ERROR default values on fields are experimental + bay: i32 = C, //~ ERROR default values on fields are experimental + bak: Vec<A> = Vec::new(), //~ ERROR default values on fields are experimental +} + +impl<A, const C: i32> Qux<A, C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<A, const C: i32> T for Qux<A, C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +#[derive(Default)] +pub struct Opt { + mandatory: Option<()>, + optional: () = (), //~ ERROR default values on fields are experimental +} + +#[derive(Default)] +pub enum OptEnum { + #[default] + Variant { //~ ERROR the `#[default]` attribute may only be used on unit enum variants + mandatory: Option<()>, + optional: () = (), //~ ERROR default values on fields are experimental + } +} + +fn main () { + let x = Foo { .. }; //~ ERROR base expression required after `..` + let y = Foo::default(); + let z = Foo { baz: 1, .. }; //~ ERROR base expression required after `..` + + assert_eq!(45, x.baz); + assert_eq!(45, y.baz); + assert_eq!(1, z.baz); + + let x = Bar::Foo { .. }; //~ ERROR base expression required after `..` + let y = Bar::default(); + let z = Bar::Foo { baz: 1, .. }; //~ ERROR base expression required after `..` + + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, x)); + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, y)); + assert!(matches!(Bar::Foo { bar: S, baz: 1 }, z)); + + let x = Qux::<i32, 4> { .. }; //~ ERROR base expression required after `..` + assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, .. }, x)); + //~^ ERROR base expression required after `..` + assert!(x.bak.is_empty()); + let y = Opt { mandatory: None, .. }; + //~^ ERROR base expression required after `..` + assert!(matches!(Opt::default(), y)); + let z = Opt::default(); + assert!(matches!(Opt { mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { optional: (), .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + let y = OptEnum::Variant { mandatory: None, .. }; + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::default(), y)); + let z = OptEnum::default(); + assert!(matches!(OptEnum::Variant { mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { optional: (), .. }, z)); + //~^ ERROR base expression required after `..` + assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); + //~^ ERROR base expression required after `..` +} diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.stderr b/tests/ui/feature-gates/feature-gate-default-field-values.stderr new file mode 100644 index 00000000000..d882c322c8e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-default-field-values.stderr @@ -0,0 +1,318 @@ +error: the `#[default]` attribute may only be used on unit enum variants + --> $DIR/feature-gate-default-field-values.rs:15:5 + | +LL | Foo { + | ^^^ + | + = help: consider a manual implementation of `Default` + +error: the `#[default]` attribute may only be used on unit enum variants + --> $DIR/feature-gate-default-field-values.rs:55:5 + | +LL | Variant { + | ^^^^^^^ + | + = help: consider a manual implementation of `Default` + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:8:15 + | +LL | pub bar: S = S, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:9:17 + | +LL | pub baz: i32 = 42 + 3, + | ^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:16:15 + | +LL | bar: S = S, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:17:17 + | +LL | baz: i32 = 42 + 3, + | ^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:23:11 + | +LL | bar: S = Qux::<A, C>::S, + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:24:13 + | +LL | baz: i32 = foo(), + | ^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:25:13 + | +LL | bat: i32 = <Qux<A, C> as T>::K, + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:26:13 + | +LL | bay: i32 = C, + | ^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:27:16 + | +LL | bak: Vec<A> = Vec::new(), + | ^^^^^^^^^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:49:17 + | +LL | optional: () = (), + | ^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: default values on fields are experimental + --> $DIR/feature-gate-default-field-values.rs:57:21 + | +LL | optional: () = (), + | ^^^^^ + | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:62:21 + | +LL | let x = Foo { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Foo { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:64:29 + | +LL | let z = Foo { baz: 1, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let z = Foo { baz: 1, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:70:26 + | +LL | let x = Bar::Foo { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Bar::Foo { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:72:34 + | +LL | let z = Bar::Foo { baz: 1, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let z = Bar::Foo { baz: 1, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:78:31 + | +LL | let x = Qux::<i32, 4> { .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let x = Qux::<i32, 4> { ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:79:73 + | +LL | assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, .. }, x)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, bay: 4, ../* expr */ }, x)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:82:38 + | +LL | let y = Opt { mandatory: None, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let y = Opt { mandatory: None, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:86:47 + | +LL | assert!(matches!(Opt { mandatory: None, .. }, z)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(Opt { mandatory: None, ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:88:30 + | +LL | assert!(matches!(Opt { .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(Opt { ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:90:44 + | +LL | assert!(matches!(Opt { optional: (), .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(Opt { optional: (), ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:92:61 + | +LL | assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); + | ^ + | +help: remove the `..` as all the fields are already present + | +LL - assert!(matches!(Opt { optional: (), mandatory: None, .. }, z)); +LL + assert!(matches!(Opt { optional: (), mandatory: None, }, z)); + | + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:94:51 + | +LL | let y = OptEnum::Variant { mandatory: None, .. }; + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | let y = OptEnum::Variant { mandatory: None, ../* expr */ }; + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:98:60 + | +LL | assert!(matches!(OptEnum::Variant { mandatory: None, .. }, z)); + | ^ + | + = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { mandatory: None, ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:100:43 + | +LL | assert!(matches!(OptEnum::Variant { .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:102:57 + | +LL | assert!(matches!(OptEnum::Variant { optional: (), .. }, z)); + | ^ + | +help: add a base expression here + | +LL | assert!(matches!(OptEnum::Variant { optional: (), ../* expr */ }, z)); + | ++++++++++ + +error[E0797]: base expression required after `..` + --> $DIR/feature-gate-default-field-values.rs:104:74 + | +LL | assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); + | ^ + | +help: remove the `..` as all the fields are already present + | +LL - assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, .. }, z)); +LL + assert!(matches!(OptEnum::Variant { optional: (), mandatory: None, }, z)); + | + +error: aborting due to 29 previous errors + +Some errors have detailed explanations: E0658, E0797. +For more information about an error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-guard-patterns.rs b/tests/ui/feature-gates/feature-gate-guard-patterns.rs new file mode 100644 index 00000000000..929e8ef3181 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-guard-patterns.rs @@ -0,0 +1,46 @@ +fn match_guards_still_work() { + match 0 { + 0 if guard(0) => {}, + _ => {}, + } +} + +fn other_guards_dont() { + match 0 { + (0 if guard(0)) => {}, + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + _ => {}, + } + + match 0 { + (0 if guard(0)) | 1 => {}, + //~^ ERROR: guard patterns are experimental + _ => {}, + } + + let ((x if guard(x)) | x) = 0; + //~^ ERROR: guard patterns are experimental + //~| ERROR: cannot find value `x` + + if let (x if guard(x)) = 0 {} + //~^ ERROR: guard patterns are experimental + //~| WARN: irrefutable + + while let (x if guard(x)) = 0 {} + //~^ ERROR: guard patterns are experimental + //~| WARN: irrefutable + + #[cfg(FALSE)] + while let (x if guard(x)) = 0 {} + //~^ ERROR: guard patterns are experimental +} + +fn even_as_function_parameters(((x if guard(x), _) | (_, x)): (i32, i32)) {} +//~^ ERROR: guard patterns are experimental +//~| ERROR: cannot find value `x` + +fn guard<T>(x: T) -> bool { + unimplemented!() +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-guard-patterns.stderr b/tests/ui/feature-gates/feature-gate-guard-patterns.stderr new file mode 100644 index 00000000000..0613b5c95a4 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-guard-patterns.stderr @@ -0,0 +1,119 @@ +error: unexpected parentheses surrounding `match` arm pattern + --> $DIR/feature-gate-guard-patterns.rs:10:9 + | +LL | (0 if guard(0)) => {}, + | ^ ^ + | +help: remove parentheses surrounding the pattern + | +LL - (0 if guard(0)) => {}, +LL + 0 if guard(0) => {}, + | + +error[E0425]: cannot find value `x` in this scope + --> $DIR/feature-gate-guard-patterns.rs:21:22 + | +LL | let ((x if guard(x)) | x) = 0; + | ^ not found in this scope + +error[E0425]: cannot find value `x` in this scope + --> $DIR/feature-gate-guard-patterns.rs:38:45 + | +LL | fn even_as_function_parameters(((x if guard(x), _) | (_, x)): (i32, i32)) {} + | ^ + | +help: the binding `x` is available in a different scope in the same function + --> $DIR/feature-gate-guard-patterns.rs:21:11 + | +LL | let ((x if guard(x)) | x) = 0; + | ^ + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:16:15 + | +LL | (0 if guard(0)) | 1 => {}, + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:21:16 + | +LL | let ((x if guard(x)) | x) = 0; + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:25:18 + | +LL | if let (x if guard(x)) = 0 {} + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:29:21 + | +LL | while let (x if guard(x)) = 0 {} + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:34:21 + | +LL | while let (x if guard(x)) = 0 {} + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +error[E0658]: guard patterns are experimental + --> $DIR/feature-gate-guard-patterns.rs:38:39 + | +LL | fn even_as_function_parameters(((x if guard(x), _) | (_, x)): (i32, i32)) {} + | ^^^^^^^^ + | + = note: see issue #129967 <https://github.com/rust-lang/rust/issues/129967> for more information + = help: add `#![feature(guard_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider using match arm guards + +warning: irrefutable `if let` pattern + --> $DIR/feature-gate-guard-patterns.rs:25:8 + | +LL | if let (x if guard(x)) = 0 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this pattern will always match, so the `if let` is useless + = help: consider replacing the `if let` with a `let` + = note: `#[warn(irrefutable_let_patterns)]` on by default + +warning: irrefutable `while let` pattern + --> $DIR/feature-gate-guard-patterns.rs:29:11 + | +LL | while let (x if guard(x)) = 0 {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this pattern will always match, so the loop will never exit + = help: consider instead using a `loop { ... }` with a `let` inside it + +error: aborting due to 9 previous errors; 2 warnings emitted + +Some errors have detailed explanations: E0425, E0658. +For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/generic-associated-types/generic-associated-types-where.stderr b/tests/ui/generic-associated-types/generic-associated-types-where.stderr index 9a745c099c0..7dce34650d7 100644 --- a/tests/ui/generic-associated-types/generic-associated-types-where.stderr +++ b/tests/ui/generic-associated-types/generic-associated-types-where.stderr @@ -5,7 +5,7 @@ LL | type Assoc2<T> = Vec<T>; | ^^^^^^ `T` cannot be formatted with the default formatter | = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Display` | LL | type Assoc2<T: std::fmt::Display> = Vec<T>; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr index 261070d1db4..aa56505dd30 100644 --- a/tests/ui/generic-associated-types/impl_bounds.stderr +++ b/tests/ui/generic-associated-types/impl_bounds.stderr @@ -41,7 +41,7 @@ LL | trait Foo { LL | type C where Self: Clone; | ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Foo for Fooy<T> { | +++++++++++++++++++ @@ -66,7 +66,7 @@ LL | trait Foo { LL | fn d() where Self: Clone; | ^ this trait's method doesn't have the requirement `Fooy<T>: Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Foo for Fooy<T> { | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr b/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr index 55901cf450b..ac91bdcf3e9 100644 --- a/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr +++ b/tests/ui/generic-associated-types/issue-68641-check-gat-bounds.stderr @@ -9,7 +9,7 @@ note: required by a bound in `UnsafeCopy::Item` | LL | type Item<'a>: Copy; | ^^^^ required by this bound in `UnsafeCopy::Item` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> UnsafeCopy for T { | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 3929e66a25a..d98071efe83 100644 --- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl<T: Fn()> Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr index 662726b8993..cd4c06a8660 100644 --- a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl<T: Fn()> Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 34278249e35..12f9949a0d3 100644 --- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl<T: Fn()> Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index dafe1c1d395..8b23f609530 100644 --- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Fun::F` | LL | type F<'a>: Fn() -> u32; | ^^^^^^^^^^^ required by this bound in `Fun::F` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Fn` | LL | impl<T: Fn()> Fun for T { | ++++++ diff --git a/tests/ui/generic-associated-types/issue-74824.current.stderr b/tests/ui/generic-associated-types/issue-74824.current.stderr index 231136612a0..3a72db27097 100644 --- a/tests/ui/generic-associated-types/issue-74824.current.stderr +++ b/tests/ui/generic-associated-types/issue-74824.current.stderr @@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy` | LL | type Copy<T>: Copy = Box<T>; | ^^^^ required by this bound in `UnsafeCopy::Copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | type Copy<T: std::clone::Clone>: Copy = Box<T>; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/issue-74824.next.stderr b/tests/ui/generic-associated-types/issue-74824.next.stderr index 231136612a0..3a72db27097 100644 --- a/tests/ui/generic-associated-types/issue-74824.next.stderr +++ b/tests/ui/generic-associated-types/issue-74824.next.stderr @@ -23,7 +23,7 @@ note: required by a bound in `UnsafeCopy::Copy` | LL | type Copy<T>: Copy = Box<T>; | ^^^^ required by this bound in `UnsafeCopy::Copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | type Copy<T: std::clone::Clone>: Copy = Box<T>; | +++++++++++++++++++ diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index 1d7d80d1b07..6e0700639e9 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -71,7 +71,7 @@ LL | Self(self.0 + rhs.0) | | | B | -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Add` | LL | impl<B: std::ops::Add<Output = B>> Add for D<B> { | +++++++++++++++++++++++++++ diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr index cf3e4cc85b9..025fcc5e170 100644 --- a/tests/ui/higher-ranked/structually-relate-aliases.stderr +++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr @@ -5,7 +5,7 @@ error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `ToUnit` | LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} | ++++++++++++++++++++ diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr index e10da26665e..da6013a4af3 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr @@ -13,7 +13,7 @@ LL | fn want_bar_for_any_ccx<B>(b: &B) | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Bar` | LL | where B : Qux + for<'ccx> Bar<'ccx> | +++++++++++++++++++++ diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr index e60531a876b..5080d35bdde 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `SomeTrait` | LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() { | +++++++++++++++++++++++ @@ -15,7 +15,7 @@ error[E0277]: the trait bound `for<'a> T: SomeTrait<'a>` is not satisfied LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `SomeTrait` | LL | fn give_me_ice<T: for<'a> SomeTrait<'a>>() { | +++++++++++++++++++++++ diff --git a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr index 38c7a9ea16e..1ddbd75142f 100644 --- a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr +++ b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr @@ -17,7 +17,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F { | ------- ^^^^^^^^^^^ ^ | | | unsatisfied trait bound introduced here -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback<Self::CallbackArg> + MyFn<i32>, | +++++++++++ @@ -43,7 +43,7 @@ LL | fn autobatch<F>(self) -> impl Trait ... LL | F: Callback<Self::CallbackArg>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `<Sender as ChannelSender>::autobatch` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback<Self::CallbackArg> + MyFn<i32>, | +++++++++++ @@ -68,7 +68,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F { | | | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback<Self::CallbackArg> + MyFn<i32>, | +++++++++++ @@ -121,7 +121,7 @@ LL | impl<A, F: MyFn<A>> Callback<A> for F { | | | unsatisfied trait bound introduced here = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback<Self::CallbackArg> + MyFn<i32>, | +++++++++++ @@ -137,7 +137,7 @@ note: required by a bound in `Callback` | LL | trait Callback<A>: MyFn<A, Output = Self::Ret> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Callback` -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `MyFn` | LL | F: Callback<Self::CallbackArg> + MyFn<i32>, | +++++++++++ diff --git a/tests/ui/impl-trait/issue-55872-1.stderr b/tests/ui/impl-trait/issue-55872-1.stderr index 2ccca0b562c..81759760bf1 100644 --- a/tests/ui/impl-trait/issue-55872-1.stderr +++ b/tests/ui/impl-trait/issue-55872-1.stderr @@ -17,7 +17,7 @@ LL | (S::default(), T::default()) | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Copy` | LL | impl<S: Default + std::marker::Copy> Bar for S { | +++++++++++++++++++ @@ -32,7 +32,7 @@ LL | (S::default(), T::default()) | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn foo<T: Default + std::marker::Copy>() -> Self::E { | +++++++++++++++++++ diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index 203fbfc1d2c..1dd84f10ad8 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -33,10 +33,6 @@ LL | fun(filter_positive()); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) { - | ++++++++++++++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-6738.stderr b/tests/ui/issues/issue-6738.stderr index 9c25c0fd9a1..f22d6a2e468 100644 --- a/tests/ui/issues/issue-6738.stderr +++ b/tests/ui/issues/issue-6738.stderr @@ -6,7 +6,7 @@ LL | self.x += v.x; | | | cannot use `+=` on type `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `AddAssign` | LL | impl<T: std::ops::AddAssign> Foo<T> { | +++++++++++++++++++++ diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr index da9a8e5532c..a0a4ef09216 100644 --- a/tests/ui/kindck/kindck-impl-type-params.stderr +++ b/tests/ui/kindck/kindck-impl-type-params.stderr @@ -12,7 +12,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S<T>` to `&dyn Gettable<T>` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn f<T: std::marker::Send>(val: T) { | +++++++++++++++++++ @@ -31,7 +31,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S<T>` to `&dyn Gettable<T>` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn f<T: std::marker::Copy>(val: T) { | +++++++++++++++++++ @@ -50,7 +50,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S<T>` to `&dyn Gettable<T>` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn g<T: std::marker::Send>(val: T) { | +++++++++++++++++++ @@ -69,7 +69,7 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {} | | | unsatisfied trait bound introduced here = note: required for the cast from `&S<T>` to `&dyn Gettable<T>` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn g<T: std::marker::Copy>(val: T) { | +++++++++++++++++++ diff --git a/tests/ui/lang-items/assoc-lang-items.rs b/tests/ui/lang-items/assoc-lang-items.rs new file mode 100644 index 00000000000..460d3ed2326 --- /dev/null +++ b/tests/ui/lang-items/assoc-lang-items.rs @@ -0,0 +1,35 @@ +//! Check that associated items can be marked as lang items, so that they don't have to be looked up +//! by name or by definition order indirectly. +//! +//! This test is not *quite* high-fidelity: it checks that you can use lang items on associated +//! items by looking at the error message *as a proxy*. That is, the error message is about +//! undefined lang items and not invalid attribute target, indicating that it has reached lang item +//! machinery (which is relying on knowing the implementation detail). However, it's annoying to +//! write a full-fidelity test for this, so I think this is acceptable even though it's not *great*. +//! +//! This was implemented in <https://github.com/rust-lang/rust/pull/72559> to help with +//! <https://github.com/rust-lang/rust/issues/70718>, which is itself relevant for e.g. `Fn::Output` +//! or `Future::Output` or specific use cases like [Use `T`'s discriminant type in +//! `mem::Discriminant<T>` instead of `u64`](https://github.com/rust-lang/rust/pull/70705). + +#![feature(lang_items)] + +trait Foo { + #[lang = "dummy_lang_item_1"] //~ ERROR definition + fn foo() {} + + #[lang = "dummy_lang_item_2"] //~ ERROR definition + fn bar(); + + #[lang = "dummy_lang_item_3"] //~ ERROR definition + type MyType; +} + +struct Bar; + +impl Bar { + #[lang = "dummy_lang_item_4"] //~ ERROR definition + fn test() {} +} + +fn main() {} diff --git a/tests/ui/assoc-lang-items.stderr b/tests/ui/lang-items/assoc-lang-items.stderr index 59aec8e3fdc..7e61fea449b 100644 --- a/tests/ui/assoc-lang-items.stderr +++ b/tests/ui/lang-items/assoc-lang-items.stderr @@ -1,23 +1,23 @@ error[E0522]: definition of an unknown lang item: `dummy_lang_item_1` - --> $DIR/assoc-lang-items.rs:4:5 + --> $DIR/assoc-lang-items.rs:18:5 | LL | #[lang = "dummy_lang_item_1"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_1` error[E0522]: definition of an unknown lang item: `dummy_lang_item_2` - --> $DIR/assoc-lang-items.rs:7:5 + --> $DIR/assoc-lang-items.rs:21:5 | LL | #[lang = "dummy_lang_item_2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_2` error[E0522]: definition of an unknown lang item: `dummy_lang_item_3` - --> $DIR/assoc-lang-items.rs:10:5 + --> $DIR/assoc-lang-items.rs:24:5 | LL | #[lang = "dummy_lang_item_3"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_3` error[E0522]: definition of an unknown lang item: `dummy_lang_item_4` - --> $DIR/assoc-lang-items.rs:17:5 + --> $DIR/assoc-lang-items.rs:31:5 | LL | #[lang = "dummy_lang_item_4"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_4` diff --git a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr index 206a6801065..3b051ef9a88 100644 --- a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr +++ b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr @@ -6,7 +6,7 @@ LL | impl<A, B> FnOnce<A> for CachedFun<A, B> | note: required by a bound in `FnOnce` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -19,7 +19,7 @@ LL | impl<A, B> FnMut<A> for CachedFun<A, B> | note: required by a bound in `FnMut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A` | -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -41,7 +41,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A` | -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ @@ -56,7 +56,7 @@ LL | self.call_mut(a) | note: required by a bound in `call_mut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -help: consider further restricting this bound +help: consider further restricting type parameter `A` with unstable trait `Tuple` | LL | A: Eq + Hash + Clone + std::marker::Tuple, | ++++++++++++++++++++ diff --git a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr index bd8095224a7..d0d4d04e28a 100644 --- a/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr +++ b/tests/ui/lazy-type-alias/unsatisfied-bounds-type-alias-body.stderr @@ -4,7 +4,7 @@ error[E0277]: cannot multiply `T` by `T` LL | type Alias<T> = <T as std::ops::Mul>::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T * T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Mul` | LL | type Alias<T: std::ops::Mul> = <T as std::ops::Mul>::Output; | +++++++++++++++ diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs index 0d927117d81..0d927117d81 100644 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs index 49a46b202e4..49a46b202e4 100644 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-1.rs b/tests/ui/link-native-libs/empty-kind-1.rs index d9b8d8a7f7d..d9b8d8a7f7d 100644 --- a/tests/ui/native-library-link-flags/empty-kind-1.rs +++ b/tests/ui/link-native-libs/empty-kind-1.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-1.stderr b/tests/ui/link-native-libs/empty-kind-1.stderr index 3e5b0549339..3e5b0549339 100644 --- a/tests/ui/native-library-link-flags/empty-kind-1.stderr +++ b/tests/ui/link-native-libs/empty-kind-1.stderr diff --git a/tests/ui/native-library-link-flags/empty-kind-2.rs b/tests/ui/link-native-libs/empty-kind-2.rs index 16cb3b917e4..16cb3b917e4 100644 --- a/tests/ui/native-library-link-flags/empty-kind-2.rs +++ b/tests/ui/link-native-libs/empty-kind-2.rs diff --git a/tests/ui/native-library-link-flags/empty-kind-2.stderr b/tests/ui/link-native-libs/empty-kind-2.stderr index 3e5b0549339..3e5b0549339 100644 --- a/tests/ui/native-library-link-flags/empty-kind-2.stderr +++ b/tests/ui/link-native-libs/empty-kind-2.stderr diff --git a/tests/ui/linkage-attr/issue-109144.rs b/tests/ui/link-native-libs/issue-109144.rs index 2f740e55389..2f740e55389 100644 --- a/tests/ui/linkage-attr/issue-109144.rs +++ b/tests/ui/link-native-libs/issue-109144.rs diff --git a/tests/ui/linkage-attr/issue-109144.stderr b/tests/ui/link-native-libs/issue-109144.stderr index 0748d94189c..0748d94189c 100644 --- a/tests/ui/linkage-attr/issue-109144.stderr +++ b/tests/ui/link-native-libs/issue-109144.stderr diff --git a/tests/ui/issues/issue-43925.rs b/tests/ui/link-native-libs/issue-43925.rs index 1a210887154..1a210887154 100644 --- a/tests/ui/issues/issue-43925.rs +++ b/tests/ui/link-native-libs/issue-43925.rs diff --git a/tests/ui/issues/issue-43925.stderr b/tests/ui/link-native-libs/issue-43925.stderr index 7cc347c6163..7cc347c6163 100644 --- a/tests/ui/issues/issue-43925.stderr +++ b/tests/ui/link-native-libs/issue-43925.stderr diff --git a/tests/ui/issues/issue-43926.rs b/tests/ui/link-native-libs/issue-43926.rs index 6d3003552dc..6d3003552dc 100644 --- a/tests/ui/issues/issue-43926.rs +++ b/tests/ui/link-native-libs/issue-43926.rs diff --git a/tests/ui/issues/issue-43926.stderr b/tests/ui/link-native-libs/issue-43926.stderr index 7c5c50a38a9..7c5c50a38a9 100644 --- a/tests/ui/issues/issue-43926.stderr +++ b/tests/ui/link-native-libs/issue-43926.stderr diff --git a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs index 9c60affbccd..9c60affbccd 100644 --- a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs +++ b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs diff --git a/tests/ui/issues/issue-70093/issue-70093.rs b/tests/ui/link-native-libs/issue-70093/issue-70093.rs index 86974239338..86974239338 100644 --- a/tests/ui/issues/issue-70093/issue-70093.rs +++ b/tests/ui/link-native-libs/issue-70093/issue-70093.rs diff --git a/tests/ui/linkage-attr/kind-framework.rs b/tests/ui/link-native-libs/kind-framework.rs index c2f90809e03..c2f90809e03 100644 --- a/tests/ui/linkage-attr/kind-framework.rs +++ b/tests/ui/link-native-libs/kind-framework.rs diff --git a/tests/ui/linkage-attr/kind-framework.stderr b/tests/ui/link-native-libs/kind-framework.stderr index 93dacd68e29..93dacd68e29 100644 --- a/tests/ui/linkage-attr/kind-framework.stderr +++ b/tests/ui/link-native-libs/kind-framework.stderr diff --git a/tests/ui/native-library-link-flags/link-arg-error.rs b/tests/ui/link-native-libs/link-arg-error.rs index 4defb108178..4defb108178 100644 --- a/tests/ui/native-library-link-flags/link-arg-error.rs +++ b/tests/ui/link-native-libs/link-arg-error.rs diff --git a/tests/ui/native-library-link-flags/link-arg-error.stderr b/tests/ui/link-native-libs/link-arg-error.stderr index e1d01e14152..e1d01e14152 100644 --- a/tests/ui/native-library-link-flags/link-arg-error.stderr +++ b/tests/ui/link-native-libs/link-arg-error.stderr diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.rs b/tests/ui/link-native-libs/link-arg-from-rs.rs index 4a6017fea33..4a6017fea33 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.rs +++ b/tests/ui/link-native-libs/link-arg-from-rs.rs diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr b/tests/ui/link-native-libs/link-arg-from-rs.stderr index f31e15f1da6..f31e15f1da6 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr +++ b/tests/ui/link-native-libs/link-arg-from-rs.stderr diff --git a/tests/ui/linkage-attr/link-attr-validation-early.rs b/tests/ui/link-native-libs/link-attr-validation-early.rs index b9a835fb5e9..b9a835fb5e9 100644 --- a/tests/ui/linkage-attr/link-attr-validation-early.rs +++ b/tests/ui/link-native-libs/link-attr-validation-early.rs diff --git a/tests/ui/linkage-attr/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr index 24ad9d825f8..24ad9d825f8 100644 --- a/tests/ui/linkage-attr/link-attr-validation-early.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr diff --git a/tests/ui/linkage-attr/link-attr-validation-late.rs b/tests/ui/link-native-libs/link-attr-validation-late.rs index 34f720dd2d3..34f720dd2d3 100644 --- a/tests/ui/linkage-attr/link-attr-validation-late.rs +++ b/tests/ui/link-native-libs/link-attr-validation-late.rs diff --git a/tests/ui/linkage-attr/link-attr-validation-late.stderr b/tests/ui/link-native-libs/link-attr-validation-late.stderr index 1ad5fbaf7de..1ad5fbaf7de 100644 --- a/tests/ui/linkage-attr/link-attr-validation-late.stderr +++ b/tests/ui/link-native-libs/link-attr-validation-late.stderr diff --git a/tests/ui/linkage-attr/link-cfg-works.rs b/tests/ui/link-native-libs/link-cfg-works.rs index 7b936bc43b1..7b936bc43b1 100644 --- a/tests/ui/linkage-attr/link-cfg-works.rs +++ b/tests/ui/link-native-libs/link-cfg-works.rs diff --git a/tests/ui/manual/manual-link-bad-form.rs b/tests/ui/link-native-libs/manual-link-bad-form.rs index 0f5723adec9..0f5723adec9 100644 --- a/tests/ui/manual/manual-link-bad-form.rs +++ b/tests/ui/link-native-libs/manual-link-bad-form.rs diff --git a/tests/ui/manual/manual-link-bad-form.stderr b/tests/ui/link-native-libs/manual-link-bad-form.stderr index 7fd7a1066b4..7fd7a1066b4 100644 --- a/tests/ui/manual/manual-link-bad-form.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-form.stderr diff --git a/tests/ui/manual/manual-link-bad-kind.rs b/tests/ui/link-native-libs/manual-link-bad-kind.rs index d070faa6574..d070faa6574 100644 --- a/tests/ui/manual/manual-link-bad-kind.rs +++ b/tests/ui/link-native-libs/manual-link-bad-kind.rs diff --git a/tests/ui/manual/manual-link-bad-kind.stderr b/tests/ui/link-native-libs/manual-link-bad-kind.stderr index 647c4c61e02..647c4c61e02 100644 --- a/tests/ui/manual/manual-link-bad-kind.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-kind.stderr diff --git a/tests/ui/manual/manual-link-bad-search-path.rs b/tests/ui/link-native-libs/manual-link-bad-search-path.rs index c9ced4734fc..c9ced4734fc 100644 --- a/tests/ui/manual/manual-link-bad-search-path.rs +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.rs diff --git a/tests/ui/manual/manual-link-bad-search-path.stderr b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr index 2c0649ea152..2c0649ea152 100644 --- a/tests/ui/manual/manual-link-bad-search-path.stderr +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr diff --git a/tests/ui/manual/manual-link-framework.rs b/tests/ui/link-native-libs/manual-link-framework.rs index 43cdda0a4e6..43cdda0a4e6 100644 --- a/tests/ui/manual/manual-link-framework.rs +++ b/tests/ui/link-native-libs/manual-link-framework.rs diff --git a/tests/ui/manual/manual-link-framework.stderr b/tests/ui/link-native-libs/manual-link-framework.stderr index 38d2302a48d..38d2302a48d 100644 --- a/tests/ui/manual/manual-link-framework.stderr +++ b/tests/ui/link-native-libs/manual-link-framework.stderr diff --git a/tests/ui/manual/manual-link-unsupported-kind.rs b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs index b5b9e3e6577..b5b9e3e6577 100644 --- a/tests/ui/manual/manual-link-unsupported-kind.rs +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs diff --git a/tests/ui/manual/manual-link-unsupported-kind.stderr b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr index ae4a1ec9a95..ae4a1ec9a95 100644 --- a/tests/ui/manual/manual-link-unsupported-kind.stderr +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr b/tests/ui/link-native-libs/modifiers-bad.blank.stderr index ea36af0b4cf..ea36af0b4cf 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.blank.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr index ea36af0b4cf..ea36af0b4cf 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr index 1e701374688..1e701374688 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-bad.rs b/tests/ui/link-native-libs/modifiers-bad.rs index 185201e0d84..185201e0d84 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.rs +++ b/tests/ui/link-native-libs/modifiers-bad.rs diff --git a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr index 75950ad9c64..75950ad9c64 100644 --- a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr +++ b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.rs b/tests/ui/link-native-libs/modifiers-override-2.rs index a462a741ac6..a462a741ac6 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-2.rs +++ b/tests/ui/link-native-libs/modifiers-override-2.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.stderr b/tests/ui/link-native-libs/modifiers-override-2.stderr index aa5b59c5b6f..aa5b59c5b6f 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-2.stderr +++ b/tests/ui/link-native-libs/modifiers-override-2.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.rs b/tests/ui/link-native-libs/modifiers-override-3.rs index d05735ad616..d05735ad616 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-3.rs +++ b/tests/ui/link-native-libs/modifiers-override-3.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.stderr b/tests/ui/link-native-libs/modifiers-override-3.stderr index 3eb9459f6f3..3eb9459f6f3 100644 --- a/tests/ui/native-library-link-flags/modifiers-override-3.stderr +++ b/tests/ui/link-native-libs/modifiers-override-3.stderr diff --git a/tests/ui/native-library-link-flags/modifiers-override.rs b/tests/ui/link-native-libs/modifiers-override.rs index cd2d003664a..cd2d003664a 100644 --- a/tests/ui/native-library-link-flags/modifiers-override.rs +++ b/tests/ui/link-native-libs/modifiers-override.rs diff --git a/tests/ui/native-library-link-flags/modifiers-override.stderr b/tests/ui/link-native-libs/modifiers-override.stderr index 64427651e9f..64427651e9f 100644 --- a/tests/ui/native-library-link-flags/modifiers-override.stderr +++ b/tests/ui/link-native-libs/modifiers-override.stderr diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs b/tests/ui/link-native-libs/msvc-non-utf8-output.rs index 659a832247a..659a832247a 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.rs diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr index 7f3ef376447..7f3ef376447 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs b/tests/ui/link-native-libs/suggest-libname-only-1.rs index 328181fb5cb..328181fb5cb 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs +++ b/tests/ui/link-native-libs/suggest-libname-only-1.rs diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr b/tests/ui/link-native-libs/suggest-libname-only-1.stderr index e142835a9d6..e142835a9d6 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-1.stderr diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs b/tests/ui/link-native-libs/suggest-libname-only-2.rs index 7ed106e4ab4..7ed106e4ab4 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs +++ b/tests/ui/link-native-libs/suggest-libname-only-2.rs diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr b/tests/ui/link-native-libs/suggest-libname-only-2.stderr index 392d2f01f61..392d2f01f61 100644 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-2.stderr diff --git a/tests/ui/linkage-attr/uikit-framework.rs b/tests/ui/link-native-libs/uikit-framework.rs index fca0332384a..fca0332384a 100644 --- a/tests/ui/linkage-attr/uikit-framework.rs +++ b/tests/ui/link-native-libs/uikit-framework.rs diff --git a/tests/ui/lint/improper_ctypes_definitions_ice_134060.rs b/tests/ui/lint/improper_ctypes_definitions_ice_134060.rs new file mode 100644 index 00000000000..b30be996736 --- /dev/null +++ b/tests/ui/lint/improper_ctypes_definitions_ice_134060.rs @@ -0,0 +1,15 @@ +//! Regression test for <https://github.com/rust-lang/rust/issues/134060> due to impl bug from +//! <https://github.com/rust-lang/rust/pull/131669>. This test should be adjusted in favor of more +//! comprehensive coverage when the changes are to be relanded, as this is a basic sanity check to +//! check that the fuzzed example from #134060 doesn't ICE. + +//@ check-pass + +#![crate_type = "lib"] + +pub trait Foo { + extern "C" fn foo_(&self, _: ()) -> i64 { + //~^ WARN `extern` fn uses type `()`, which is not FFI-safe + 0 + } +} diff --git a/tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr b/tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr new file mode 100644 index 00000000000..f6ac9a92cd5 --- /dev/null +++ b/tests/ui/lint/improper_ctypes_definitions_ice_134060.stderr @@ -0,0 +1,12 @@ +warning: `extern` fn uses type `()`, which is not FFI-safe + --> $DIR/improper_ctypes_definitions_ice_134060.rs:11:34 + | +LL | extern "C" fn foo_(&self, _: ()) -> i64 { + | ^^ not FFI-safe + | + = help: consider using a struct instead + = note: tuples have unspecified layout + = note: `#[warn(improper_ctypes_definitions)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/methods/filter-relevant-fn-bounds.stderr b/tests/ui/methods/filter-relevant-fn-bounds.stderr index b737c0ab11f..0e00adf6ea6 100644 --- a/tests/ui/methods/filter-relevant-fn-bounds.stderr +++ b/tests/ui/methods/filter-relevant-fn-bounds.stderr @@ -8,7 +8,7 @@ LL | | where LL | | F: for<'a> FnOnce(<F as Output<'a>>::Type), | |___________________________________________________^ the trait `for<'a> Output<'a>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>, | ++++++++++++++++++++ @@ -19,7 +19,7 @@ error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied LL | fn do_something_wrapper<O, F>(self, _: F) | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>, | ++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied LL | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>, | ++++++++++++ @@ -41,7 +41,7 @@ error[E0277]: the trait bound `F: Output<'_>` is not satisfied LL | F: for<'a> FnOnce(<F as Output<'a>>::Type), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Output<'_>` is not implemented for `F` | -help: consider further restricting this bound +help: consider further restricting type parameter `F` with trait `Output` | LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + Output<'_>, | ++++++++++++ diff --git a/tests/ui/mir/validate/validate-unsize-cast.stderr b/tests/ui/mir/validate/validate-unsize-cast.stderr index cfb47b34e98..8449c6a24bd 100644 --- a/tests/ui/mir/validate/validate-unsize-cast.stderr +++ b/tests/ui/mir/validate/validate-unsize-cast.stderr @@ -10,7 +10,7 @@ note: required by a bound in `CastTo` | LL | pub trait CastTo<U: ?Sized>: Unsize<U> {} | ^^^^^^^^^ required by this bound in `CastTo` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with unstable trait `Unsize` | LL | impl<T: ?Sized + std::marker::Unsize<U>, U: ?Sized> CastTo<U> for T {} | ++++++++++++++++++++++++ diff --git a/tests/ui/mismatched_types/similar_paths_primitive.rs b/tests/ui/mismatched_types/similar_paths_primitive.rs index 98890a15d98..a58fe68b863 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.rs +++ b/tests/ui/mismatched_types/similar_paths_primitive.rs @@ -1,14 +1,22 @@ #![allow(non_camel_case_types)] -struct bool; -struct str; +struct bool; //~ NOTE the other `bool` is defined in the current crate +struct str; //~ NOTE the other `str` is defined in the current crate -fn foo(_: bool) {} -fn bar(_: &str) {} +fn foo(_: bool) {} //~ NOTE function defined here +fn bar(_: &str) {} //~ NOTE function defined here fn main() { foo(true); //~^ ERROR mismatched types [E0308] + //~| NOTE expected `bool`, found a different `bool` + //~| NOTE arguments to this function are incorrect + //~| NOTE `bool` and `bool` have similar names, but are actually distinct types + //~| NOTE one `bool` is a primitive defined by the language bar("hello"); //~^ ERROR mismatched types [E0308] + //~| NOTE expected `str`, found a different `str` + //~| NOTE arguments to this function are incorrect + //~| NOTE `str` and `str` have similar names, but are actually distinct types + //~| NOTE one `str` is a primitive defined by the language } diff --git a/tests/ui/mismatched_types/similar_paths_primitive.stderr b/tests/ui/mismatched_types/similar_paths_primitive.stderr index 0530bf5863e..cf26234dba8 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.stderr +++ b/tests/ui/mismatched_types/similar_paths_primitive.stderr @@ -6,9 +6,9 @@ LL | foo(true); | | | arguments to this function are incorrect | - = note: bool and `bool` have similar names, but are actually distinct types - = note: bool is a primitive defined by the language -note: `bool` is defined in the current crate + = note: `bool` and `bool` have similar names, but are actually distinct types + = note: one `bool` is a primitive defined by the language +note: the other `bool` is defined in the current crate --> $DIR/similar_paths_primitive.rs:3:1 | LL | struct bool; @@ -20,16 +20,16 @@ LL | fn foo(_: bool) {} | ^^^ ------- error[E0308]: mismatched types - --> $DIR/similar_paths_primitive.rs:12:9 + --> $DIR/similar_paths_primitive.rs:16:9 | LL | bar("hello"); | --- ^^^^^^^ expected `str`, found a different `str` | | | arguments to this function are incorrect | - = note: str and `str` have similar names, but are actually distinct types - = note: str is a primitive defined by the language -note: `str` is defined in the current crate + = note: `str` and `str` have similar names, but are actually distinct types + = note: one `str` is a primitive defined by the language +note: the other `str` is defined in the current crate --> $DIR/similar_paths_primitive.rs:4:1 | LL | struct str; diff --git a/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr b/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr index b3089cecfbb..80b003bbcc5 100644 --- a/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr +++ b/tests/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr @@ -6,7 +6,7 @@ LL | let _ = s == t; | | | &[T] | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `PartialEq` | LL | pub fn foo<T: std::cmp::PartialEq>(s: &[T], t: &[T]) { | +++++++++++++++++++++ diff --git a/tests/ui/moves/issue-34721.stderr b/tests/ui/moves/issue-34721.stderr index 94780a04c1f..9834d009d22 100644 --- a/tests/ui/moves/issue-34721.stderr +++ b/tests/ui/moves/issue-34721.stderr @@ -18,7 +18,7 @@ note: `Foo::zero` takes ownership of the receiver `self`, which moves `x` | LL | fn zero(self) -> Self; | ^^^^ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | pub fn baz<T: Foo + Copy>(x: T) -> T { | ++++++ diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed index bfb855c7fb1..a5e0dd819b4 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed @@ -48,7 +48,7 @@ fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where { fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>) where T: A + Copy + Trait, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting { (t, t) //~ use of moved value: `t` } @@ -56,14 +56,14 @@ where fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>) where T: A + Copy + Trait, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting T: B, { (t, t) //~ use of moved value: `t` } fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) -//~^ HELP consider further restricting this bound +//~^ HELP consider further restricting where T: B, { diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs index fbe5a1d74c3..60ca03ed698 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs @@ -48,7 +48,7 @@ fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where { fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>) where T: A, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting { (t, t) //~ use of moved value: `t` } @@ -56,14 +56,14 @@ where fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>) where T: A, - //~^ HELP consider further restricting this bound + //~^ HELP consider further restricting T: B, { (t, t) //~ use of moved value: `t` } fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>) -//~^ HELP consider further restricting this bound +//~^ HELP consider further restricting where T: B, { diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index c03204c7b9f..784945dbbae 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -17,7 +17,7 @@ LL | fn duplicate_t<T>(t: T) -> (T, T) { ... LL | (t, t) | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) { | ++++++ @@ -33,7 +33,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_opt<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) { | ++++++ @@ -49,7 +49,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn duplicate_tup1<T: Copy>(t: (T,)) -> ((T,), (T,)) { | ++++++ @@ -81,7 +81,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ @@ -97,7 +97,7 @@ LL | (t, t) | | | value moved here | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where { | ++++++++++++++ @@ -113,7 +113,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | T: A + Copy + Trait, | ++++++++++++++ @@ -129,7 +129,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | T: A + Copy + Trait, | ++++++++++++++ @@ -145,7 +145,7 @@ LL | (t, t) | | | value moved here | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) | ++++++++++++++ @@ -169,7 +169,7 @@ LL | fn existing_colon<T:>(t: T) { ... LL | [t, t]; | - you could clone this value -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn existing_colon<T: Copy>(t: T) { | ++++ @@ -193,7 +193,7 @@ LL | fn existing_colon_in_where<T>(t: T) ... LL | [t, t]; | - you could clone this value -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | T:, T: Copy | ~~~~~~~~~ diff --git a/tests/ui/parser/assoc/assoc-oddities-3.rs b/tests/ui/parser/assoc/assoc-oddities-3.rs new file mode 100644 index 00000000000..1a41c4be023 --- /dev/null +++ b/tests/ui/parser/assoc/assoc-oddities-3.rs @@ -0,0 +1,41 @@ +//! Check that braces has the expected precedence in relation to index op and some arithmetic +//! bin-ops involving nested braces. +//! +//! This is a regression test for [Wrapping expr in curly braces changes the operator precedence +//! #28777](https://github.com/rust-lang/rust/issues/28777), which was fixed by +//! <https://github.com/rust-lang/rust/pull/30375>. + +//@ run-pass + +fn that_odd_parse(c: bool, n: usize) -> u32 { + let x = 2; + let a = [1, 2, 3, 4]; + let b = [5, 6, 7, 7]; + x + if c { a } else { b }[n] +} + +/// See [Wrapping expr in curly braces changes the operator precedence +/// #28777](https://github.com/rust-lang/rust/issues/28777). This was fixed by +/// <https://github.com/rust-lang/rust/pull/30375>. #30375 added the `that_odd_parse` example above, +/// but that is not *quite* the same original example as reported in #28777, so we also include the +/// original example here. +fn check_issue_28777() { + // Before #30375 fixed the precedence... + + // ... `v1` evaluated to 9, indicating a parse of `(1 + 2) * 3`, while + let v1 = { 1 + { 2 } * { 3 } }; + + // `v2` evaluated to 7, indicating a parse of `1 + (2 * 3)`. + let v2 = 1 + { 2 } * { 3 }; + + // Check that both now evaluate to 7, as was fixed by #30375. + assert_eq!(v1, 7); + assert_eq!(v2, 7); +} + +fn main() { + assert_eq!(4, that_odd_parse(true, 1)); + assert_eq!(8, that_odd_parse(false, 1)); + + check_issue_28777(); +} diff --git a/tests/ui/parser/issues/issue-72373.rs b/tests/ui/parser/issues/issue-72373.rs index 4da6061c27f..ed88d53539b 100644 --- a/tests/ui/parser/issues/issue-72373.rs +++ b/tests/ui/parser/issues/issue-72373.rs @@ -3,7 +3,7 @@ fn foo(c: &[u32], n: u32) -> u32 { [h, ..] if h > n => 0, [h, ..] if h == n => 1, [h, ref ts..] => foo(c, n - h) + foo(ts, n), - //~^ ERROR expected one of `,`, `@`, `]`, or `|`, found `..` + //~^ ERROR expected one of `,`, `@`, `]`, `if`, or `|`, found `..` [] => 0, } } diff --git a/tests/ui/parser/issues/issue-72373.stderr b/tests/ui/parser/issues/issue-72373.stderr index c596c6abda5..d566d6f5fd1 100644 --- a/tests/ui/parser/issues/issue-72373.stderr +++ b/tests/ui/parser/issues/issue-72373.stderr @@ -1,8 +1,8 @@ -error: expected one of `,`, `@`, `]`, or `|`, found `..` +error: expected one of `,`, `@`, `]`, `if`, or `|`, found `..` --> $DIR/issue-72373.rs:5:19 | LL | [h, ref ts..] => foo(c, n - h) + foo(ts, n), - | ^^ expected one of `,`, `@`, `]`, or `|` + | ^^ expected one of `,`, `@`, `]`, `if`, or `|` | help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@` | diff --git a/tests/ui/parser/misspelled-keywords/ref.stderr b/tests/ui/parser/misspelled-keywords/ref.stderr index b8b52702314..398d9d6bb99 100644 --- a/tests/ui/parser/misspelled-keywords/ref.stderr +++ b/tests/ui/parser/misspelled-keywords/ref.stderr @@ -1,8 +1,8 @@ -error: expected one of `)`, `,`, `@`, or `|`, found `list` +error: expected one of `)`, `,`, `@`, `if`, or `|`, found `list` --> $DIR/ref.rs:4:19 | LL | Some(refe list) => println!("{list:?}"), - | ^^^^ expected one of `)`, `,`, `@`, or `|` + | ^^^^ expected one of `)`, `,`, `@`, `if`, or `|` | help: there is a keyword `ref` with a similar name | diff --git a/tests/ui/parser/pat-lt-bracket-7.rs b/tests/ui/parser/pat-lt-bracket-7.rs index 327aef5ad15..abaeb4c83c0 100644 --- a/tests/ui/parser/pat-lt-bracket-7.rs +++ b/tests/ui/parser/pat-lt-bracket-7.rs @@ -3,7 +3,7 @@ fn main() { let foo = core::iter::empty(); for Thing(x[]) in foo {} - //~^ ERROR: expected one of `)`, `,`, `@`, or `|`, found `[` + //~^ ERROR: expected one of `)`, `,`, `@`, `if`, or `|`, found `[` } const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types diff --git a/tests/ui/parser/pat-lt-bracket-7.stderr b/tests/ui/parser/pat-lt-bracket-7.stderr index 004dcfb2a7b..cc457a4e64e 100644 --- a/tests/ui/parser/pat-lt-bracket-7.stderr +++ b/tests/ui/parser/pat-lt-bracket-7.stderr @@ -1,10 +1,10 @@ -error: expected one of `)`, `,`, `@`, or `|`, found `[` +error: expected one of `)`, `,`, `@`, `if`, or `|`, found `[` --> $DIR/pat-lt-bracket-7.rs:5:16 | LL | for Thing(x[]) in foo {} | ^ | | - | expected one of `)`, `,`, `@`, or `|` + | expected one of `)`, `,`, `@`, `if`, or `|` | help: missing `,` error[E0308]: mismatched types diff --git a/tests/ui/parser/recover/recover-pat-exprs.rs b/tests/ui/parser/recover/recover-pat-exprs.rs index e5e25df0c01..a78bb82828d 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.rs +++ b/tests/ui/parser/recover/recover-pat-exprs.rs @@ -27,7 +27,7 @@ fn array_indexing() { { let x[0, 1, 2]; } //~ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` { let x[0; 20]; } //~ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` { let x[]; } //~ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` - { let (x[]); } //~ error: expected one of `)`, `,`, `@`, or `|`, found `[` + { let (x[]); } //~ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `[` //~^ missing `,` } @@ -95,12 +95,12 @@ fn main() { f?() => (), //~^ error: expected a pattern, found an expression (_ + 1) => (), - //~^ error: expected one of `)`, `,`, or `|`, found `+` + //~^ error: expected one of `)`, `,`, `if`, or `|`, found `+` } let 1 + 1 = 2; //~^ error: expected a pattern, found an expression let b = matches!(x, (x * x | x.f()) | x[0]); - //~^ error: expected one of `)`, `,`, `@`, or `|`, found `*` + //~^ error: expected one of `)`, `,`, `@`, `if`, or `|`, found `*` } diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 041dfd647ad..281eeced402 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -213,13 +213,13 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` LL | { let x[]; } | ^ expected one of `:`, `;`, `=`, `@`, or `|` -error: expected one of `)`, `,`, `@`, or `|`, found `[` +error: expected one of `)`, `,`, `@`, `if`, or `|`, found `[` --> $DIR/recover-pat-exprs.rs:30:13 | LL | { let (x[]); } | ^ | | - | expected one of `)`, `,`, `@`, or `|` + | expected one of `)`, `,`, `@`, `if`, or `|` | help: missing `,` error: expected a pattern, found an expression @@ -611,11 +611,11 @@ LL | x.sqrt() @ .. => (), | = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x` -error: expected one of `)`, `,`, or `|`, found `+` +error: expected one of `)`, `,`, `if`, or `|`, found `+` --> $DIR/recover-pat-exprs.rs:97:12 | LL | (_ + 1) => (), - | ^ expected one of `)`, `,`, or `|` + | ^ expected one of `)`, `,`, `if`, or `|` error: expected a pattern, found an expression --> $DIR/recover-pat-exprs.rs:81:9 @@ -772,11 +772,11 @@ LL | let 1 + 1 = 2; | = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> -error: expected one of `)`, `,`, `@`, or `|`, found `*` +error: expected one of `)`, `,`, `@`, `if`, or `|`, found `*` --> $DIR/recover-pat-exprs.rs:104:28 | LL | let b = matches!(x, (x * x | x.f()) | x[0]); - | ^ expected one of `)`, `,`, `@`, or `|` + | ^ expected one of `)`, `,`, `@`, `if`, or `|` --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | = note: while parsing argument for this `pat` macro fragment diff --git a/tests/ui/parser/recover/recover-pat-wildcards.rs b/tests/ui/parser/recover/recover-pat-wildcards.rs index f506e2223d6..d4d28ce6358 100644 --- a/tests/ui/parser/recover/recover-pat-wildcards.rs +++ b/tests/ui/parser/recover/recover-pat-wildcards.rs @@ -8,7 +8,7 @@ fn a() { fn b() { match 2 { - (_ % 4) => () //~ error: expected one of `)`, `,`, or `|`, found `%` + (_ % 4) => () //~ error: expected one of `)`, `,`, `if`, or `|`, found `%` } } @@ -40,7 +40,7 @@ fn f() { fn g() { match 7 { - (_ * 0)..5 => () //~ error: expected one of `)`, `,`, or `|`, found `*` + (_ * 0)..5 => () //~ error: expected one of `)`, `,`, `if`, or `|`, found `*` } } diff --git a/tests/ui/parser/recover/recover-pat-wildcards.stderr b/tests/ui/parser/recover/recover-pat-wildcards.stderr index 81a9920f6a2..f939e513370 100644 --- a/tests/ui/parser/recover/recover-pat-wildcards.stderr +++ b/tests/ui/parser/recover/recover-pat-wildcards.stderr @@ -4,11 +4,11 @@ error: expected one of `=>`, `if`, or `|`, found `+` LL | _ + 1 => () | ^ expected one of `=>`, `if`, or `|` -error: expected one of `)`, `,`, or `|`, found `%` +error: expected one of `)`, `,`, `if`, or `|`, found `%` --> $DIR/recover-pat-wildcards.rs:11:12 | LL | (_ % 4) => () - | ^ expected one of `)`, `,`, or `|` + | ^ expected one of `)`, `,`, `if`, or `|` error: expected one of `=>`, `if`, or `|`, found `.` --> $DIR/recover-pat-wildcards.rs:17:10 @@ -47,11 +47,11 @@ error: expected one of `=>`, `if`, or `|`, found reserved identifier `_` LL | 0..._ => () | ^ expected one of `=>`, `if`, or `|` -error: expected one of `)`, `,`, or `|`, found `*` +error: expected one of `)`, `,`, `if`, or `|`, found `*` --> $DIR/recover-pat-wildcards.rs:43:12 | LL | (_ * 0)..5 => () - | ^ expected one of `)`, `,`, or `|` + | ^ expected one of `)`, `,`, `if`, or `|` error: expected one of `=>`, `if`, or `|`, found `(` --> $DIR/recover-pat-wildcards.rs:49:11 diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed b/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed deleted file mode 100644 index be6ed053c6e..00000000000 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.fixed +++ /dev/null @@ -1,35 +0,0 @@ -//@ run-rustfix -#![allow(dead_code)] - -enum E { - A, -} - -struct S { - field1: i32, //~ ERROR default values on `struct` fields aren't supported - field2: E, //~ ERROR default values on `struct` fields aren't supported - field3: i32, //~ ERROR default values on `struct` fields aren't supported - field4: i32, //~ ERROR default values on `struct` fields aren't supported - field5: E, //~ ERROR default values on `struct` fields aren't supported - field6: E, //~ ERROR default values on `struct` fields aren't supported -} - -struct S1 { - field1: i32, //~ ERROR expected `,`, or `}`, found `field2` - field2: E, //~ ERROR expected `,`, or `}`, found `field3` - field3: i32, //~ ERROR default values on `struct` fields aren't supported - field4: i32, //~ ERROR default values on `struct` fields aren't supported - field5: E, //~ ERROR default values on `struct` fields aren't supported - field6: E, //~ ERROR default values on `struct` fields aren't supported -} - -struct S2 { - field1 : i32, //~ ERROR expected `:`, found `=` - field2: E, //~ ERROR expected `:`, found `;` -} - -const fn foo(_: i32) -> E { - E::A -} - -fn main() {} diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs index 7900d397a5d..bb9de98bddb 100644 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.rs +++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.rs @@ -1,4 +1,3 @@ -//@ run-rustfix #![allow(dead_code)] enum E { @@ -6,21 +5,21 @@ enum E { } struct S { - field1: i32 = 42, //~ ERROR default values on `struct` fields aren't supported - field2: E = E::A, //~ ERROR default values on `struct` fields aren't supported - field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported - field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported - field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported - field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported + field1: i32 = 42, //~ ERROR default values on fields are experimental + field2: E = E::A, //~ ERROR default values on fields are experimental + field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental + field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental + field5: E = foo(42), //~ ERROR default values on fields are experimental + field6: E = { foo(42) }, //~ ERROR default values on fields are experimental } struct S1 { field1: i32 //~ ERROR expected `,`, or `}`, found `field2` field2: E //~ ERROR expected `,`, or `}`, found `field3` - field3: i32 = 1 + 2, //~ ERROR default values on `struct` fields aren't supported - field4: i32 = { 1 + 2 }, //~ ERROR default values on `struct` fields aren't supported - field5: E = foo(42), //~ ERROR default values on `struct` fields aren't supported - field6: E = { foo(42) }, //~ ERROR default values on `struct` fields aren't supported + field3: i32 = 1 + 2, //~ ERROR default values on fields are experimental + field4: i32 = { 1 + 2 }, //~ ERROR default values on fields are experimental + field5: E = foo(42), //~ ERROR default values on fields are experimental + field6: E = { foo(42) }, //~ ERROR default values on fields are experimental } struct S2 { diff --git a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr index 1fb57ab11f9..fdd9f0d6dce 100644 --- a/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr +++ b/tests/ui/parser/struct-default-values-and-missing-field-separator.stderr @@ -1,152 +1,133 @@ -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:9:16 +error: expected `,`, or `}`, found `field2` + --> $DIR/struct-default-values-and-missing-field-separator.rs:17:16 | -LL | field1: i32 = 42, - | ^^^^^ +LL | field1: i32 + | ^ help: try adding a comma: `,` + +error: expected `,`, or `}`, found `field3` + --> $DIR/struct-default-values-and-missing-field-separator.rs:18:14 + | +LL | field2: E + | ^ help: try adding a comma: `,` + +error: expected `:`, found `=` + --> $DIR/struct-default-values-and-missing-field-separator.rs:26:12 + | +LL | field1 = i32, + | ^ + | | + | expected `:` + | help: field names and their types are separated with `:` + +error: expected `:`, found `;` + --> $DIR/struct-default-values-and-missing-field-separator.rs:27:11 | -help: remove this unsupported default value +LL | field2; E, + | ^ + | | + | expected `:` + | help: field names and their types are separated with `:` + +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:8:16 | -LL - field1: i32 = 42, -LL + field1: i32, +LL | field1: i32 = 42, + | ^^^^^ | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:10:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:9:14 | LL | field2: E = E::A, | ^^^^^^^ | -help: remove this unsupported default value - | -LL - field2: E = E::A, -LL + field2: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:10:16 | LL | field3: i32 = 1 + 2, | ^^^^^^^^ | -help: remove this unsupported default value - | -LL - field3: i32 = 1 + 2, -LL + field3: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:12:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:11:16 | LL | field4: i32 = { 1 + 2 }, | ^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field4: i32 = { 1 + 2 }, -LL + field4: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:12:14 | LL | field5: E = foo(42), | ^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field5: E = foo(42), -LL + field5: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:14:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:13:14 | LL | field6: E = { foo(42) }, | ^^^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field6: E = { foo(42) }, -LL + field6: E, - | - -error: expected `,`, or `}`, found `field2` - --> $DIR/struct-default-values-and-missing-field-separator.rs:18:16 - | -LL | field1: i32 - | ^ help: try adding a comma: `,` - -error: expected `,`, or `}`, found `field3` - --> $DIR/struct-default-values-and-missing-field-separator.rs:19:14 - | -LL | field2: E - | ^ help: try adding a comma: `,` + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:19:16 | LL | field3: i32 = 1 + 2, | ^^^^^^^^ | -help: remove this unsupported default value - | -LL - field3: i32 = 1 + 2, -LL + field3: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:21:16 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:20:16 | LL | field4: i32 = { 1 + 2 }, | ^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field4: i32 = { 1 + 2 }, -LL + field4: i32, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:21:14 | LL | field5: E = foo(42), | ^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field5: E = foo(42), -LL + field5: E, - | + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: default values on `struct` fields aren't supported - --> $DIR/struct-default-values-and-missing-field-separator.rs:23:14 +error[E0658]: default values on fields are experimental + --> $DIR/struct-default-values-and-missing-field-separator.rs:22:14 | LL | field6: E = { foo(42) }, | ^^^^^^^^^^^^^^ | -help: remove this unsupported default value - | -LL - field6: E = { foo(42) }, -LL + field6: E, - | - -error: expected `:`, found `=` - --> $DIR/struct-default-values-and-missing-field-separator.rs:27:12 - | -LL | field1 = i32, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` - -error: expected `:`, found `;` - --> $DIR/struct-default-values-and-missing-field-separator.rs:28:11 - | -LL | field2; E, - | ^ - | | - | expected `:` - | help: field names and their types are separated with `:` + = note: see issue #132162 <https://github.com/rust-lang/rust/issues/132162> for more information + = help: add `#![feature(default_field_values)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 14 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr index da8f4ca5f0c..6ce8f6d31a0 100644 --- a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr +++ b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr @@ -6,11 +6,11 @@ LL | let a: u8 @ b = 0; | | | while parsing the type for `a` -error: expected one of `)`, `,`, `@`, or `|`, found `:` +error: expected one of `)`, `,`, `@`, `if`, or `|`, found `:` --> $DIR/nested-type-ascription-syntactically-invalid.rs:24:15 | LL | let a @ (b: u8); - | ^ expected one of `)`, `,`, `@`, or `|` + | ^ expected one of `)`, `,`, `@`, `if`, or `|` | = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> diff --git a/tests/ui/pattern/rfc-3637-guard-patterns/macro-rules.rs b/tests/ui/pattern/rfc-3637-guard-patterns/macro-rules.rs new file mode 100644 index 00000000000..76681f45bb3 --- /dev/null +++ b/tests/ui/pattern/rfc-3637-guard-patterns/macro-rules.rs @@ -0,0 +1,20 @@ +//@ run-pass +//! Tests that the addition of guard patterns does not change the behavior of the `pat` macro +//! fragment. +#![feature(guard_patterns)] +#![allow(incomplete_features)] + +macro_rules! has_guard { + ($p:pat) => { + false + }; + ($p:pat if $e:expr) => { + true + }; +} + +fn main() { + assert_eq!(has_guard!(Some(_)), false); + assert_eq!(has_guard!(Some(_) if true), true); + assert_eq!(has_guard!((Some(_) if true)), false); +} diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/phantom-auto-trait.stderr index 5af648f6a0c..ffd4c3a0e1a 100644 --- a/tests/ui/phantom-auto-trait.stderr +++ b/tests/ui/phantom-auto-trait.stderr @@ -23,7 +23,7 @@ note: required by a bound in `is_zen` | LL | fn is_zen<T: Zen>(_: T) {} | ^^^ required by this bound in `is_zen` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Sync` | LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) { | +++++++++++++++++++ @@ -58,7 +58,7 @@ note: required by a bound in `is_zen` | LL | fn is_zen<T: Zen>(_: T) {} | ^^^ required by this bound in `is_zen` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Sync` | LL | fn nested_not_sync<T: std::marker::Sync>(x: Nested<Guard<T>>) { | +++++++++++++++++++ diff --git a/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs index a1595685372..0c913f766b7 100644 --- a/tests/ui/range/issue-54505-no-std.rs +++ b/tests/ui/range/issue-54505-no-std.rs @@ -38,6 +38,7 @@ fn main() { take_range(..); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr index f15a0ae6138..2aa1d584046 100644 --- a/tests/ui/range/issue-54505-no-std.stderr +++ b/tests/ui/range/issue-54505-no-std.stderr @@ -53,13 +53,18 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds<i8>) {} | ^^^^^^^^^^ ------------------------- +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals when `#![feature(default_field_values)]` is enabled; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/issue-54505-no-std.rs:39:16 + | +LL | take_range(..); + | ^^ help: consider borrowing here | LL | take_range(&(..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:44:16 + --> $DIR/issue-54505-no-std.rs:45:16 | LL | take_range(0..=1); | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` @@ -79,7 +84,7 @@ LL | take_range(&(0..=1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:49:16 + --> $DIR/issue-54505-no-std.rs:50:16 | LL | take_range(..5); | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` @@ -99,7 +104,7 @@ LL | take_range(&(..5)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:54:16 + --> $DIR/issue-54505-no-std.rs:55:16 | LL | take_range(..=42); | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` diff --git a/tests/ui/range/issue-54505.fixed b/tests/ui/range/issue-54505.fixed index 054d3c2cf5e..08a2682140a 100644 --- a/tests/ui/range/issue-54505.fixed +++ b/tests/ui/range/issue-54505.fixed @@ -23,6 +23,7 @@ fn main() { take_range(&(..)); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505.rs b/tests/ui/range/issue-54505.rs index f5cec831760..0a9d7083e4f 100644 --- a/tests/ui/range/issue-54505.rs +++ b/tests/ui/range/issue-54505.rs @@ -23,6 +23,7 @@ fn main() { take_range(..); //~^ ERROR mismatched types [E0308] + //~| HELP you might have meant //~| HELP consider borrowing here //~| SUGGESTION &( diff --git a/tests/ui/range/issue-54505.stderr b/tests/ui/range/issue-54505.stderr index 0e959fc05e2..291e097e865 100644 --- a/tests/ui/range/issue-54505.stderr +++ b/tests/ui/range/issue-54505.stderr @@ -53,13 +53,18 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds<i8>) {} | ^^^^^^^^^^ ------------------------- +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals when `#![feature(default_field_values)]` is enabled; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/issue-54505.rs:24:16 + | +LL | take_range(..); + | ^^ help: consider borrowing here | LL | take_range(&(..)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:29:16 + --> $DIR/issue-54505.rs:30:16 | LL | take_range(0..=1); | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` @@ -79,7 +84,7 @@ LL | take_range(&(0..=1)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:34:16 + --> $DIR/issue-54505.rs:35:16 | LL | take_range(..5); | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` @@ -99,7 +104,7 @@ LL | take_range(&(..5)); | ++ + error[E0308]: mismatched types - --> $DIR/issue-54505.rs:39:16 + --> $DIR/issue-54505.rs:40:16 | LL | take_range(..=42); | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` diff --git a/tests/ui/recursion/issue-83150.rs b/tests/ui/recursion/issue-83150.rs index f91698d0637..e919a2d9309 100644 --- a/tests/ui/recursion/issue-83150.rs +++ b/tests/ui/recursion/issue-83150.rs @@ -1,8 +1,7 @@ -//~ ERROR overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>: Iterator` +//~ ERROR overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator` //@ build-fail //@ compile-flags: -Copt-level=0 //@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash" -//@ ignore-compare-mode-next-solver (hangs) fn main() { let mut iter = 0u8..1; diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index fb66436dbbd..92a39a44e4f 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-83150.rs:12:1 + --> $DIR/issue-83150.rs:11:1 | LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,12 +10,12 @@ LL | func(&mut iter.map(|x| x + 1)) = help: a `loop` may express intention better if this is on purpose = note: `#[warn(unconditional_recursion)]` on by default -error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>: Iterator` +error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>` to implement `Iterator` + = note: required for `&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator` = note: 65 redundant requirements hidden - = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>, {closure@$DIR/issue-83150.rs:14:24: 14:27}>` to implement `Iterator` + = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>, {closure@$DIR/issue-83150.rs:13:24: 13:27}>` to implement `Iterator` error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index b17d1e0ab11..87f0f47f240 100644 --- a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait2` | LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) | ++++++++++++++++++++++++ @@ -17,7 +17,7 @@ LL | | LL | | } | |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait2` | LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) | ++++++++++++++++++++++++ diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 4069b35a998..7d420126199 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -15,7 +15,7 @@ error[E0220]: associated type `Baa` not found for `T` LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Foo` | LL | T::Baa: std::fmt::Debug, T: Foo | ~~~~~~~~ diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs index 117f6134b4e..229408fb724 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs @@ -25,7 +25,14 @@ fn start(argc: isize, argv: *const *const u8) -> isize { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; assert_eq!(actual, expected, "actual and expected SIGPIPE disposition in child differs"); diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs index 3d93d50ca3f..d16a2b4d8c8 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/sigpipe-utils.rs @@ -20,7 +20,14 @@ pub fn assert_sigpipe_handler(expected_handler: SignalHandler) { let actual = unsafe { let mut actual: libc::sigaction = std::mem::zeroed(); libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); - actual.sa_sigaction + #[cfg(not(target_os = "aix"))] + { + actual.sa_sigaction + } + #[cfg(target_os = "aix")] + { + actual.sa_union.__su_sigaction as libc::sighandler_t + } }; let expected = match expected_handler { diff --git a/tests/ui/runtime/signal-alternate-stack-cleanup.rs b/tests/ui/runtime/signal-alternate-stack-cleanup.rs index f2af86be0a5..8fce0928273 100644 --- a/tests/ui/runtime/signal-alternate-stack-cleanup.rs +++ b/tests/ui/runtime/signal-alternate-stack-cleanup.rs @@ -29,7 +29,14 @@ fn main() { // Install signal handler that runs on alternate signal stack. let mut action: sigaction = std::mem::zeroed(); action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _; - action.sa_sigaction = signal_handler as sighandler_t; + #[cfg(not(target_os = "aix"))] + { + action.sa_sigaction = signal_handler as sighandler_t; + } + #[cfg(target_os = "aix")] + { + action.sa_union.__su_sigaction = signal_handler as sighandler_t; + } sigaction(SIGWINCH, &action, std::ptr::null_mut()); // Send SIGWINCH on exit. diff --git a/tests/ui/rust-2024/gen-kw.e2015.stderr b/tests/ui/rust-2024/gen-kw.e2015.stderr index ff552f663c7..5c42d65abf0 100644 --- a/tests/ui/rust-2024/gen-kw.e2015.stderr +++ b/tests/ui/rust-2024/gen-kw.e2015.stderr @@ -34,11 +34,47 @@ LL | () => { mod test { fn gen() {} } } error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:9 | -LL | fn test<'gen>() {} +LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> -error: aborting due to 4 previous errors +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:25:19 + | +LL | fn test<'gen>(_: &'gen i32) {} + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:13 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:28 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:37 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: aborting due to 8 previous errors diff --git a/tests/ui/rust-2024/gen-kw.e2018.stderr b/tests/ui/rust-2024/gen-kw.e2018.stderr index efa812069c3..050e58c119b 100644 --- a/tests/ui/rust-2024/gen-kw.e2018.stderr +++ b/tests/ui/rust-2024/gen-kw.e2018.stderr @@ -34,11 +34,47 @@ LL | () => { mod test { fn gen() {} } } error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:9 | -LL | fn test<'gen>() {} +LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> -error: aborting due to 4 previous errors +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:25:19 + | +LL | fn test<'gen>(_: &'gen i32) {} + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:13 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:28 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: `gen` is a keyword in the 2024 edition + --> $DIR/gen-kw.rs:33:37 + | +LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ()); + | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` + | + = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + +error: aborting due to 8 previous errors diff --git a/tests/ui/rust-2024/gen-kw.rs b/tests/ui/rust-2024/gen-kw.rs index 5a658470c0a..3c075a4c022 100644 --- a/tests/ui/rust-2024/gen-kw.rs +++ b/tests/ui/rust-2024/gen-kw.rs @@ -22,9 +22,23 @@ macro_rules! t { //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! } -fn test<'gen>() {} +fn test<'gen>(_: &'gen i32) {} //~^ ERROR `gen` is a keyword in the 2024 edition +//~| ERROR `gen` is a keyword in the 2024 edition //[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! +//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! +//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! +//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! + +struct Test<'gen>(Box<Test<'gen>>, &'gen ()); +//~^ ERROR `gen` is a keyword in the 2024 edition +//~| ERROR `gen` is a keyword in the 2024 edition +//~| ERROR `gen` is a keyword in the 2024 edition +//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! +//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! +//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! +//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! +//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! t!(); diff --git a/tests/ui/specialization/default-generic-associated-type-bound.stderr b/tests/ui/specialization/default-generic-associated-type-bound.stderr index afdbe2eb226..57d67ac526a 100644 --- a/tests/ui/specialization/default-generic-associated-type-bound.stderr +++ b/tests/ui/specialization/default-generic-associated-type-bound.stderr @@ -20,7 +20,7 @@ note: required by a bound in `X::U` | LL | type U<'a>: PartialEq<&'a Self> where Self: 'a; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `X::U` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `PartialEq` | LL | impl<T: 'static + std::cmp::PartialEq> X for T { | +++++++++++++++++++++ diff --git a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr index 01188e293bd..4a51a7dfa47 100644 --- a/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -19,7 +19,7 @@ note: required by a bound in `Foo` | LL | trait Foo<'a, T: Eq + 'a> { } | ^^ required by this bound in `Foo` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Eq` | LL | default impl<U: std::cmp::Eq> Foo<'static, U> for () {} | ++++++++++++++ diff --git a/tests/ui/specialization/issue-33017.stderr b/tests/ui/specialization/issue-33017.stderr index 2c20077078f..29a82a4d875 100644 --- a/tests/ui/specialization/issue-33017.stderr +++ b/tests/ui/specialization/issue-33017.stderr @@ -9,7 +9,7 @@ note: required by a bound in `UncheckedCopy::Output` | LL | type Output: From<Self> + Copy + Into<Self>; | ^^^^ required by this bound in `UncheckedCopy::Output` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> UncheckedCopy for T { | +++++++++++++++++++ diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr index 268fc3a9591..84e526f4597 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.stderr +++ b/tests/ui/specialization/min_specialization/issue-79224.stderr @@ -5,7 +5,7 @@ LL | impl<B: ?Sized> Display for Cow<'_, B> { | ^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | +++++++++++++++++++ @@ -17,7 +17,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | +++++++++++++++++++ @@ -29,7 +29,7 @@ LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | +++++++++++++++++++ @@ -47,7 +47,7 @@ LL | | } | |_____^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` -help: consider further restricting this bound +help: consider further restricting type parameter `B` with trait `Clone` | LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | +++++++++++++++++++ diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index 2adbcfab612..e3bc68a2134 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -20,8 +20,8 @@ ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.4%) 3 -ast-stats-1 FieldDef 176 ( 2.6%) 2 88 ast-stats-1 Block 192 ( 2.9%) 6 32 +ast-stats-1 FieldDef 208 ( 3.1%) 2 104 ast-stats-1 Variant 208 ( 3.1%) 2 104 ast-stats-1 AssocItem 352 ( 5.3%) 4 88 ast-stats-1 - Type 176 ( 2.6%) 2 @@ -29,7 +29,7 @@ ast-stats-1 - Fn 176 ( 2.6%) 2 ast-stats-1 GenericBound 352 ( 5.3%) 4 88 ast-stats-1 - Trait 352 ( 5.3%) 4 ast-stats-1 GenericParam 480 ( 7.2%) 5 96 -ast-stats-1 Pat 504 ( 7.6%) 7 72 +ast-stats-1 Pat 504 ( 7.5%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Wild 72 ( 1.1%) 1 ast-stats-1 - Ident 360 ( 5.4%) 5 @@ -39,13 +39,13 @@ ast-stats-1 - Match 72 ( 1.1%) 1 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.2%) 3 -ast-stats-1 PathSegment 744 (11.2%) 31 24 +ast-stats-1 PathSegment 744 (11.1%) 31 24 ast-stats-1 Ty 896 (13.4%) 14 64 ast-stats-1 - Ref 64 ( 1.0%) 1 ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 ast-stats-1 - Path 640 ( 9.6%) 10 -ast-stats-1 Item 1_224 (18.4%) 9 136 +ast-stats-1 Item 1_224 (18.3%) 9 136 ast-stats-1 - ForeignMod 136 ( 2.0%) 1 ast-stats-1 - Trait 136 ( 2.0%) 1 ast-stats-1 - Impl 136 ( 2.0%) 1 @@ -53,7 +53,7 @@ ast-stats-1 - Enum 136 ( 2.0%) 1 ast-stats-1 - Fn 272 ( 4.1%) 2 ast-stats-1 - Use 408 ( 6.1%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 6_664 116 +ast-stats-1 Total 6_696 116 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size @@ -70,7 +70,7 @@ ast-stats-2 - Fn 88 ( 1.2%) 1 ast-stats-2 Arm 96 ( 1.3%) 2 48 ast-stats-2 FnDecl 120 ( 1.6%) 5 24 ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 -ast-stats-2 Attribute 128 ( 1.8%) 4 32 +ast-stats-2 Attribute 128 ( 1.7%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 ast-stats-2 - Normal 96 ( 1.3%) 3 ast-stats-2 Param 160 ( 2.2%) 4 40 @@ -78,33 +78,33 @@ ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Let 32 ( 0.4%) 1 ast-stats-2 - Semi 32 ( 0.4%) 1 ast-stats-2 - Expr 96 ( 1.3%) 3 -ast-stats-2 FieldDef 176 ( 2.4%) 2 88 ast-stats-2 Block 192 ( 2.6%) 6 32 +ast-stats-2 FieldDef 208 ( 2.8%) 2 104 ast-stats-2 Variant 208 ( 2.8%) 2 104 ast-stats-2 AssocItem 352 ( 4.8%) 4 88 ast-stats-2 - Type 176 ( 2.4%) 2 ast-stats-2 - Fn 176 ( 2.4%) 2 ast-stats-2 GenericBound 352 ( 4.8%) 4 88 ast-stats-2 - Trait 352 ( 4.8%) 4 -ast-stats-2 GenericParam 480 ( 6.6%) 5 96 +ast-stats-2 GenericParam 480 ( 6.5%) 5 96 ast-stats-2 Pat 504 ( 6.9%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - Wild 72 ( 1.0%) 1 ast-stats-2 - Ident 360 ( 4.9%) 5 -ast-stats-2 Expr 648 ( 8.9%) 9 72 +ast-stats-2 Expr 648 ( 8.8%) 9 72 ast-stats-2 - Path 72 ( 1.0%) 1 ast-stats-2 - Match 72 ( 1.0%) 1 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - InlineAsm 72 ( 1.0%) 1 ast-stats-2 - Lit 144 ( 2.0%) 2 -ast-stats-2 - Block 216 ( 3.0%) 3 +ast-stats-2 - Block 216 ( 2.9%) 3 ast-stats-2 PathSegment 864 (11.8%) 36 24 -ast-stats-2 Ty 896 (12.3%) 14 64 +ast-stats-2 Ty 896 (12.2%) 14 64 ast-stats-2 - Ref 64 ( 0.9%) 1 ast-stats-2 - Ptr 64 ( 0.9%) 1 -ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 -ast-stats-2 - Path 640 ( 8.8%) 10 -ast-stats-2 Item 1_496 (20.5%) 11 136 +ast-stats-2 - ImplicitSelf 128 ( 1.7%) 2 +ast-stats-2 - Path 640 ( 8.7%) 10 +ast-stats-2 Item 1_496 (20.4%) 11 136 ast-stats-2 - Enum 136 ( 1.9%) 1 ast-stats-2 - Trait 136 ( 1.9%) 1 ast-stats-2 - Impl 136 ( 1.9%) 1 @@ -113,7 +113,7 @@ ast-stats-2 - ForeignMod 136 ( 1.9%) 1 ast-stats-2 - Fn 272 ( 3.7%) 2 ast-stats-2 - Use 544 ( 7.4%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 7_312 127 +ast-stats-2 Total 7_344 127 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size @@ -138,9 +138,9 @@ hir-stats Stmt 96 ( 1.1%) 3 32 hir-stats - Let 32 ( 0.4%) 1 hir-stats - Semi 32 ( 0.4%) 1 hir-stats - Expr 32 ( 0.4%) 1 -hir-stats FieldDef 112 ( 1.3%) 2 56 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 +hir-stats FieldDef 128 ( 1.4%) 2 64 hir-stats GenericArgs 144 ( 1.6%) 3 48 hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericBound 256 ( 2.9%) 4 64 @@ -163,7 +163,7 @@ hir-stats - Struct 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.3%) 6 -hir-stats Item 968 (10.9%) 11 88 +hir-stats Item 968 (10.8%) 11 88 hir-stats - Enum 88 ( 1.0%) 1 hir-stats - Trait 88 ( 1.0%) 1 hir-stats - Impl 88 ( 1.0%) 1 @@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.9%) 31 40 hir-stats PathSegment 1_920 (21.5%) 40 48 hir-stats ---------------------------------------------------------------- -hir-stats Total 8_920 180 +hir-stats Total 8_936 180 hir-stats diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_matches.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_matches.stderr new file mode 100644 index 00000000000..109985c0052 --- /dev/null +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_matches.stderr @@ -0,0 +1,13 @@ +error[E0658]: use of unstable library feature `atomic_from_mut` + --> $DIR/atomic-from-mut-not-available.rs:24:5 + | +LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76314 <https://github.com/rust-lang/rust/issues/76314> for more information + = help: add `#![feature(atomic_from_mut)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/atomic-from-mut-not-available.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr index a4514524f48..47b17f9fcd7 100644 --- a/tests/ui/atomic-from-mut-not-available.stderr +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr @@ -1,5 +1,5 @@ error[E0599]: no function or associated item named `from_mut` found for struct `AtomicU64` in the current scope - --> $DIR/atomic-from-mut-not-available.rs:5:36 + --> $DIR/atomic-from-mut-not-available.rs:24:36 | LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); | ^^^^^^^^ function or associated item not found in `AtomicU64` diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs new file mode 100644 index 00000000000..7e9de3570eb --- /dev/null +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs @@ -0,0 +1,27 @@ +//! This test exercises the combined effect of the `cfg(target_has_atomic_equal_alignment = "...")` +//! implementation in the compiler plus usage of said `cfg(target_has_atomic_equal_alignment)` in +//! `core` for the `Atomic64::from_mut` API. +//! +//! This test is a basic smoke test: that `AtomicU64::from_mut` is gated by +//! `#[cfg(target_has_atomic_equal_alignment = "8")]`, which is only available on platforms where +//! `AtomicU64` has the same alignment as `u64`. This is notably *not* satisfied by `x86_32`, where +//! they have differing alignments. Thus, `AtomicU64::from_mut` should *not* be available on +//! `x86_32` linux and should report assoc item not found, if the `cfg` is working correctly. +//! Conversely, `AtomicU64::from_mut` *should* be available on `x86_64` linux where the alignment +//! matches. + +//@ revisions: alignment_mismatch alignment_matches + +// This should fail on 32-bit x86 linux... +//@[alignment_mismatch] only-x86 +//@[alignment_mismatch] only-linux + +// ... but pass on 64-bit x86_64 linux. +//@[alignment_matches] only-x86_64 +//@[alignment_matches] only-linux + +fn main() { + core::sync::atomic::AtomicU64::from_mut(&mut 0u64); + //[alignment_mismatch]~^ ERROR no function or associated item named `from_mut` found for struct `AtomicU64` + //[alignment_matches]~^^ ERROR use of unstable library feature `atomic_from_mut` +} diff --git a/tests/ui/structs/auxiliary/struct_field_default.rs b/tests/ui/structs/auxiliary/struct_field_default.rs new file mode 100644 index 00000000000..b315df5dba2 --- /dev/null +++ b/tests/ui/structs/auxiliary/struct_field_default.rs @@ -0,0 +1,5 @@ +#![feature(default_field_values)] + +pub struct A { + pub a: isize = 42, +} diff --git a/tests/ui/structs/default-field-values-failures.rs b/tests/ui/structs/default-field-values-failures.rs new file mode 100644 index 00000000000..0ac071d91d6 --- /dev/null +++ b/tests/ui/structs/default-field-values-failures.rs @@ -0,0 +1,64 @@ +#![feature(default_field_values)] + +#[derive(Debug)] +pub struct S; + +#[derive(Debug, Default)] +pub struct Foo { + pub bar: S = S, + pub baz: i32 = 42 + 3, +} + +#[derive(Debug, Default)] +pub struct Bar { + pub bar: S, //~ ERROR the trait bound `S: Default` is not satisfied + pub baz: i32 = 42 + 3, +} + +#[derive(Default)] +pub struct Qux<const C: i32> { + bar: S = Self::S, //~ ERROR generic `Self` types are currently not permitted in anonymous constants + baz: i32 = foo(), + bat: i32 = <Qux<{ C }> as T>::K, //~ ERROR generic parameters may not be used in const operations + bay: i32 = C, +} + +pub struct Rak(i32 = 42); //~ ERROR default fields are not supported in tuple structs + +impl<const C: i32> Qux<C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<const C: i32> T for Qux<C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +#[derive(Debug, Default)] +enum E { + #[default] + Variant {} //~ ERROR the `#[default]` attribute may only be used on unit enum variants +} + +fn main () { + let _ = Foo { .. }; // ok + let _ = Foo::default(); // ok + let _ = Bar { .. }; //~ ERROR mandatory field + let _ = Bar::default(); // silenced + let _ = Bar { bar: S, .. }; // ok + let _ = Qux::<4> { .. }; + let _ = Rak(..); //~ ERROR E0308 + //~^ you might have meant to use `..` to skip providing + let _ = Rak(0, ..); //~ ERROR E0061 + //~^ you might have meant to use `..` to skip providing + let _ = Rak(.., 0); //~ ERROR E0061 + //~^ you might have meant to use `..` to skip providing + let _ = Rak { .. }; // ok +} diff --git a/tests/ui/structs/default-field-values-failures.stderr b/tests/ui/structs/default-field-values-failures.stderr new file mode 100644 index 00000000000..5b9d2df5a5d --- /dev/null +++ b/tests/ui/structs/default-field-values-failures.stderr @@ -0,0 +1,118 @@ +error: the `#[default]` attribute may only be used on unit enum variants or variants where every field has a default value + --> $DIR/default-field-values-failures.rs:47:5 + | +LL | Variant {} + | ^^^^^^^ + | + = help: consider a manual implementation of `Default` + +error: generic parameters may not be used in const operations + --> $DIR/default-field-values-failures.rs:22:23 + | +LL | bat: i32 = <Qux<{ C }> as T>::K, + | ^ cannot perform const operation using `C` + | + = help: const parameters may only be used as standalone arguments, i.e. `C` + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: default fields are not supported in tuple structs + --> $DIR/default-field-values-failures.rs:26:22 + | +LL | pub struct Rak(i32 = 42); + | ^^ default fields are only supported on structs + +error: generic `Self` types are currently not permitted in anonymous constants + --> $DIR/default-field-values-failures.rs:20:14 + | +LL | bar: S = Self::S, + | ^^^^ + +error[E0277]: the trait bound `S: Default` is not satisfied + --> $DIR/default-field-values-failures.rs:14:5 + | +LL | #[derive(Debug, Default)] + | ------- in this derive macro expansion +LL | pub struct Bar { +LL | pub bar: S, + | ^^^^^^^^^^ the trait `Default` is not implemented for `S` + | + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `S` with `#[derive(Default)]` + | +LL + #[derive(Default)] +LL | pub struct S; + | + +error: missing mandatory field `bar` + --> $DIR/default-field-values-failures.rs:53:21 + | +LL | let _ = Bar { .. }; + | ^ + +error[E0308]: mismatched types + --> $DIR/default-field-values-failures.rs:57:17 + | +LL | let _ = Rak(..); + | --- ^^ expected `i32`, found `RangeFull` + | | + | arguments to this struct are incorrect + | +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:57:17 + | +LL | let _ = Rak(..); + | ^^ + +error[E0061]: this struct takes 1 argument but 2 arguments were supplied + --> $DIR/default-field-values-failures.rs:59:13 + | +LL | let _ = Rak(0, ..); + | ^^^ -- unexpected argument #2 of type `RangeFull` + | +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:59:20 + | +LL | let _ = Rak(0, ..); + | ^^ +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: remove the extra argument + | +LL - let _ = Rak(0, ..); +LL + let _ = Rak(0); + | + +error[E0061]: this struct takes 1 argument but 2 arguments were supplied + --> $DIR/default-field-values-failures.rs:61:13 + | +LL | let _ = Rak(.., 0); + | ^^^ -- unexpected argument #1 of type `RangeFull` + | +help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal + --> $DIR/default-field-values-failures.rs:61:17 + | +LL | let _ = Rak(.., 0); + | ^^ +note: tuple struct defined here + --> $DIR/default-field-values-failures.rs:26:12 + | +LL | pub struct Rak(i32 = 42); + | ^^^ +help: remove the extra argument + | +LL - let _ = Rak(.., 0); +LL + let _ = Rak(0); + | + +error: aborting due to 9 previous errors + +Some errors have detailed explanations: E0061, E0277, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/structs/default-field-values-invalid-const.rs b/tests/ui/structs/default-field-values-invalid-const.rs new file mode 100644 index 00000000000..203a712868b --- /dev/null +++ b/tests/ui/structs/default-field-values-invalid-const.rs @@ -0,0 +1,16 @@ +#![feature(default_field_values, generic_const_exprs)] +#![allow(incomplete_features)] + +pub struct Bat { + pub bax: u8 = panic!("asdf"), + //~^ ERROR evaluation of constant value failed +} + +pub struct Baz<const C: u8> { + pub bax: u8 = 130 + C, // ok + pub bat: u8 = 130 + 130, + //~^ ERROR evaluation of `Baz::<C>::bat::{constant#0}` failed + pub bay: u8 = 1, // ok +} + +fn main() {} diff --git a/tests/ui/structs/default-field-values-invalid-const.stderr b/tests/ui/structs/default-field-values-invalid-const.stderr new file mode 100644 index 00000000000..47f25a1f38e --- /dev/null +++ b/tests/ui/structs/default-field-values-invalid-const.stderr @@ -0,0 +1,17 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/default-field-values-invalid-const.rs:5:19 + | +LL | pub bax: u8 = panic!("asdf"), + | ^^^^^^^^^^^^^^ the evaluated program panicked at 'asdf', $DIR/default-field-values-invalid-const.rs:5:19 + | + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0080]: evaluation of `Baz::<C>::bat::{constant#0}` failed + --> $DIR/default-field-values-invalid-const.rs:11:19 + | +LL | pub bat: u8 = 130 + 130, + | ^^^^^^^^^ attempt to compute `130_u8 + 130_u8`, which would overflow + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/structs/default-field-values-support.rs b/tests/ui/structs/default-field-values-support.rs new file mode 100644 index 00000000000..da0379af94b --- /dev/null +++ b/tests/ui/structs/default-field-values-support.rs @@ -0,0 +1,74 @@ +//@ run-pass +//@ aux-build:struct_field_default.rs +#![feature(default_field_values, generic_const_exprs)] +#![allow(unused_variables, dead_code, incomplete_features)] + +extern crate struct_field_default as xc; + +pub struct S; + +#[derive(Default)] +pub struct Foo { + pub bar: S = S, + pub baz: i32 = 42 + 3, +} + +#[derive(Default)] +pub enum Bar { + #[default] + Foo { + bar: S = S, + baz: i32 = 42 + 3, + } +} + +#[derive(Default)] +pub struct Qux<A, const C: i32> { + bar: S = Qux::<A, C>::S, + baz: i32 = foo(), + bat: i32 = <Qux<A, C> as T>::K, + baq: i32 = Self::K, + bay: i32 = C, + bak: Vec<A> = Vec::new(), +} + +impl<A, const C: i32> Qux<A, C> { + const S: S = S; +} + +trait T { + const K: i32; +} + +impl<A, const C: i32> T for Qux<A, C> { + const K: i32 = 2; +} + +const fn foo() -> i32 { + 42 +} + +fn main () { + let x = Foo { .. }; + let y = Foo::default(); + let z = Foo { baz: 1, .. }; + + assert_eq!(45, x.baz); + assert_eq!(45, y.baz); + assert_eq!(1, z.baz); + + let x = Bar::Foo { .. }; + let y = Bar::default(); + let z = Bar::Foo { baz: 1, .. }; + + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, x)); + assert!(matches!(Bar::Foo { bar: S, baz: 45 }, y)); + assert!(matches!(Bar::Foo { bar: S, baz: 1 }, z)); + + let x = Qux::<i32, 4> { .. }; + assert!(matches!(Qux::<i32, 4> { bar: S, baz: 42, bat: 2, baq: 2, bay: 4, .. }, x)); + assert!(x.bak.is_empty()); + + let x = xc::A { .. }; + assert!(matches!(xc::A { a: 42 }, x)); +} diff --git a/tests/ui/suggestions/assoc-const-as-fn.stderr b/tests/ui/suggestions/assoc-const-as-fn.stderr index 69e9af72647..6732033e774 100644 --- a/tests/ui/suggestions/assoc-const-as-fn.stderr +++ b/tests/ui/suggestions/assoc-const-as-fn.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied LL | <T as GlUniformScalar>::FACTORY(1, value); | ^ the trait `GlUniformScalar` is not implemented for `T` | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `GlUniformScalar` | LL | pub fn foo<T: UniformScalar + GlUniformScalar>(value: T) { | +++++++++++++++++ diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index 4965e7439f8..e30deb11398 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -5,7 +5,7 @@ LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider restricting opaque type `impl Sized` with trait `Debug` | LL | fn test_impl(t: impl Sized + std::fmt::Debug) { | +++++++++++++++++ @@ -17,7 +17,7 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Debug` | LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) { | +++++++++++++++++ @@ -29,7 +29,7 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Debug` | LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) { | +++++++++++++++++ @@ -41,7 +41,7 @@ LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting type parameter `Y` +help: consider further restricting type parameter `Y` with trait `Debug` | LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { | ~~~~~~~~~~~~~~~~~~~~ @@ -53,7 +53,7 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `X` with trait `Debug` | LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug { | +++++++++++++++++ @@ -65,7 +65,7 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `X` with trait `Debug` | LL | fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized { | +++++++++++++++++ diff --git a/tests/ui/suggestions/clone-bounds-121524.rs b/tests/ui/suggestions/clone-bounds-121524.rs index 8cd60b452de..b7760584ebb 100644 --- a/tests/ui/suggestions/clone-bounds-121524.rs +++ b/tests/ui/suggestions/clone-bounds-121524.rs @@ -6,7 +6,7 @@ trait DoesAThing {} impl DoesAThing for ThingThatDoesAThing {} fn clones_impl_ref_inline(thing: &impl DoesAThing) { - //~^ HELP consider further restricting this bound + //~^ HELP consider restricting opaque type `impl DoesAThing` with trait `Clone` drops_impl_owned(thing.clone()); //~ ERROR E0277 //~^ NOTE copies the reference //~| NOTE the trait `DoesAThing` is not implemented for `&impl DoesAThing` diff --git a/tests/ui/suggestions/clone-bounds-121524.stderr b/tests/ui/suggestions/clone-bounds-121524.stderr index 6d60508a4a1..bdba8d7e472 100644 --- a/tests/ui/suggestions/clone-bounds-121524.stderr +++ b/tests/ui/suggestions/clone-bounds-121524.stderr @@ -9,7 +9,7 @@ note: this `clone()` copies the reference, which does not do anything, because ` | LL | drops_impl_owned(thing.clone()); | ^^^^^ -help: consider further restricting this bound +help: consider restricting opaque type `impl DoesAThing` with trait `Clone` | LL | fn clones_impl_ref_inline(thing: &impl DoesAThing + Clone) { | +++++++ diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr index afbb9c32d51..03a14b03781 100644 --- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr +++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr @@ -15,7 +15,7 @@ note: `T` does not implement `Clone`, so `&T` was cloned instead | LL | t.clone() | ^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | fn wat<T: Clone>(t: &T) -> T { | +++++++ diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr index 680890e880c..eae0b0ae817 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.stderr +++ b/tests/ui/suggestions/derive-clone-for-eq.stderr @@ -14,7 +14,7 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T> note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub struct Struct<T: std::clone::Clone>(T); | +++++++++++++++++++ diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr index bffcb1af487..37a5f4932ff 100644 --- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr @@ -38,7 +38,7 @@ LL | impl<T: Debug + Trait> Debug for Inner<T> { = note: required for `&c::Inner<T>` to implement `Debug` = note: required for the cast from `&&c::Inner<T>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer<T: c::Trait>(Inner<T>); | ++++++++++ @@ -60,7 +60,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait { = note: required for `&d::Inner<T>` to implement `Debug` = note: required for the cast from `&&d::Inner<T>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer<T: d::Trait>(Inner<T>); | ++++++++++ @@ -82,7 +82,7 @@ LL | impl<T> Debug for Inner<T> where T: Debug + Trait { = note: required for `&e::Inner<T>` to implement `Debug` = note: required for the cast from `&&e::Inner<T>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer<T: e::Trait>(Inner<T>); | ++++++++++ @@ -104,7 +104,7 @@ LL | impl<T: Debug> Debug for Inner<T> where T: Trait { = note: required for `&f::Inner<T>` to implement `Debug` = note: required for the cast from `&&f::Inner<T>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | struct Outer<T: f::Trait>(Inner<T>); | ++++++++++ diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr index 8607917ede6..8b1c0b9a77a 100644 --- a/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr +++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&T: X` is not satisfied LL | foo(s); | ^ the trait `X` is not implemented for `&T` | -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Clone` | LL | fn bar<T: X + Clone>(s: &T) { | +++++++ diff --git a/tests/ui/suggestions/issue-97677.stderr b/tests/ui/suggestions/issue-97677.stderr index 0e95167d851..7fe091ef71c 100644 --- a/tests/ui/suggestions/issue-97677.stderr +++ b/tests/ui/suggestions/issue-97677.stderr @@ -6,7 +6,7 @@ LL | n + 10 | | | N | -help: consider restricting type parameter `N` +help: consider restricting type parameter `N` with trait `Add` | LL | fn add_ten<N: std::ops::Add<i32, Output = N>>(n: N) -> N { | ++++++++++++++++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr index d65ad109241..4408fe0a0a4 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: Debug + std::marker::Copy> { | +++++++++++++++++++ @@ -32,7 +32,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> { | ---- unsatisfied trait bound introduced in this `derive` macro = note: required for the cast from `&Vector2<K>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: Debug + std::marker::Copy> { | +++++++++++++++++++ @@ -52,7 +52,7 @@ note: required by a bound in `Vector2` LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: Debug + std::marker::Copy> { | +++++++++++++++++++ @@ -74,7 +74,7 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct Vector2<T: Debug + Copy + Clone> { | ---- unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: Debug + std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr index 2ade0e974e4..1bbf6f66ab2 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` LL | pub loc: Vector2<K>, | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: Copy + Debug>{ | +++++++ @@ -29,7 +29,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2<T: Debug + Copy + Clone>{ | ^^^^^ required by this bound in `Vector2` -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: Copy + std::fmt::Debug>{ | +++++++++++++++++ @@ -44,7 +44,7 @@ LL | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: Copy + std::fmt::Debug>{ | +++++++++++++++++ @@ -59,7 +59,7 @@ LL | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider further restricting this bound +help: consider further restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: Copy + std::fmt::Debug>{ | +++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index 316c2fa0fc9..8b5cced4c4a 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -13,7 +13,7 @@ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` LL | pub loc: Vector2<K>, | ^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: Debug> { | +++++++ @@ -29,7 +29,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: std::fmt::Debug> { | +++++++++++++++++ @@ -45,7 +45,7 @@ note: required by a bound in `Vector2` | LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: std::marker::Copy> { | +++++++++++++++++++ @@ -68,7 +68,7 @@ LL | pub struct Vector2<T: Debug + Copy + Clone> { | ---- unsatisfied trait bound introduced in this `derive` macro = note: required for the cast from `&Vector2<K>` to `&dyn Debug` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: std::marker::Copy> { | +++++++++++++++++++ @@ -83,7 +83,7 @@ LL | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: std::fmt::Debug> { | +++++++++++++++++ @@ -103,7 +103,7 @@ note: required by a bound in `Vector2` LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: std::marker::Copy> { | +++++++++++++++++++ @@ -118,7 +118,7 @@ LL | pub size: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Debug` | LL | pub struct AABB<K: std::fmt::Debug> { | +++++++++++++++++ @@ -140,7 +140,7 @@ LL | #[derive(Debug, Copy, Clone)] LL | pub struct Vector2<T: Debug + Copy + Clone> { | ---- unsatisfied trait bound introduced in this `derive` macro = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Copy` | LL | pub struct AABB<K: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr index 23a75154f20..600e5ae63d3 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl-2.stderr @@ -12,7 +12,7 @@ note: the `Copy` impl for `OnlyCopyIfDisplay<S>` requires that `S: std::fmt::Dis | LL | struct Wrapper<T>(T); | ^ -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Display` | LL | impl<S: std::fmt::Display> Copy for Wrapper<OnlyCopyIfDisplay<S>> {} | +++++++++++++++++++ diff --git a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr index c9f277fb350..b22aa35ef6d 100644 --- a/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-manual-copy-impl.stderr @@ -7,7 +7,7 @@ LL | LL | impl<S> Copy for Wrapper<S> {} | ^^^^^^^^^^ | -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Copy` | LL | impl<S: Copy> Copy for Wrapper<S> {} | ++++++ diff --git a/tests/ui/suggestions/restrict-type-argument.stderr b/tests/ui/suggestions/restrict-type-argument.stderr index 01c2de79864..4b6da8a9cd9 100644 --- a/tests/ui/suggestions/restrict-type-argument.stderr +++ b/tests/ui/suggestions/restrict-type-argument.stderr @@ -11,7 +11,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider restricting opaque type `impl Sync` with trait `Send` | LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { | +++++++++++++++++++ @@ -29,7 +29,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_where<S>(val: S) where S: Sync + std::marker::Send { | +++++++++++++++++++ @@ -47,7 +47,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_bound<S: Sync + std::marker::Send>(val: S) { | +++++++++++++++++++ @@ -65,7 +65,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | Sync + std::marker::Send | +++++++++++++++++++ @@ -83,7 +83,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider further restricting this bound +help: consider further restricting type parameter `S` with trait `Send` | LL | fn use_bound_and_where<S: Sync + std::marker::Send>(val: S) where S: std::fmt::Debug { | +++++++++++++++++++ @@ -101,7 +101,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T: Send>(val: T) {} | ^^^^ required by this bound in `is_send` -help: consider restricting type parameter `S` +help: consider restricting type parameter `S` with trait `Send` | LL | fn use_unbound<S: std::marker::Send>(val: S) { | +++++++++++++++++++ diff --git a/tests/ui/suggestions/trait-impl-bound-suggestions.stderr b/tests/ui/suggestions/trait-impl-bound-suggestions.stderr index 6a75cbdf639..346d19f1b77 100644 --- a/tests/ui/suggestions/trait-impl-bound-suggestions.stderr +++ b/tests/ui/suggestions/trait-impl-bound-suggestions.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -41,7 +41,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ @@ -57,7 +57,7 @@ note: required by a bound in `ConstrainedStruct` | LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` -help: consider further restricting type parameter `X` +help: consider further restricting type parameter `X` with trait `Copy` | LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy { | ++++++++++++++++++++++ diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index d56f15fb221..916f296ccfc 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -92,7 +92,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] @@ -154,7 +154,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] @@ -206,7 +206,7 @@ body: adt_def: AdtDef { did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo) - variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] + variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])), safety: Safe, value: None }], tainted: None, flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], tainted: None, flags: }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 } args: [] diff --git a/tests/ui/trait-bounds/unstable-trait-suggestion.rs b/tests/ui/trait-bounds/unstable-trait-suggestion.rs new file mode 100644 index 00000000000..ba96b4f3f97 --- /dev/null +++ b/tests/ui/trait-bounds/unstable-trait-suggestion.rs @@ -0,0 +1,19 @@ +#![feature(staged_api)] +#![allow(internal_features)] +#![stable(feature = "unit_test", since = "1.0.0")] + +#[unstable(feature = "step_trait", issue = "42168")] +pub trait Unstable {} + +#[stable(feature = "unit_test", since = "1.0.0")] +fn foo<T: Unstable>(_: T) {} + +#[stable(feature = "unit_test", since = "1.0.0")] +pub fn bar<T>(t: T) { //~ HELP consider restricting type parameter `T` with unstable trait `Unstable` + foo(t) //~ ERROR E0277 +} +#[stable(feature = "unit_test", since = "1.0.0")] +pub fn baz<T>(t: std::ops::Range<T>) { //~ HELP consider restricting type parameter `T` with unstable trait + for _ in t {} //~ ERROR E0277 +} +fn main() {} diff --git a/tests/ui/trait-bounds/unstable-trait-suggestion.stderr b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr new file mode 100644 index 00000000000..dfa47f2ab46 --- /dev/null +++ b/tests/ui/trait-bounds/unstable-trait-suggestion.stderr @@ -0,0 +1,34 @@ +error[E0277]: the trait bound `T: Unstable` is not satisfied + --> $DIR/unstable-trait-suggestion.rs:13:9 + | +LL | foo(t) + | --- ^ the trait `Unstable` is not implemented for `T` + | | + | required by a bound introduced by this call + | +note: required by a bound in `foo` + --> $DIR/unstable-trait-suggestion.rs:9:11 + | +LL | fn foo<T: Unstable>(_: T) {} + | ^^^^^^^^ required by this bound in `foo` +help: consider restricting type parameter `T` with unstable trait `Unstable` + | +LL | pub fn bar<T: Unstable>(t: T) { + | ++++++++++ + +error[E0277]: the trait bound `T: Step` is not satisfied + --> $DIR/unstable-trait-suggestion.rs:17:14 + | +LL | for _ in t {} + | ^ the trait `Step` is not implemented for `T` + | + = note: required for `std::ops::Range<T>` to implement `Iterator` + = note: required for `std::ops::Range<T>` to implement `IntoIterator` +help: consider restricting type parameter `T` with unstable trait `Step` + | +LL | pub fn baz<T: std::iter::Step>(t: std::ops::Range<T>) { + | +++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/alias/wf.stderr b/tests/ui/traits/alias/wf.stderr index 3be6e8a49d6..42b0104e865 100644 --- a/tests/ui/traits/alias/wf.stderr +++ b/tests/ui/traits/alias/wf.stderr @@ -9,7 +9,7 @@ note: required by a bound in `A` | LL | trait A<T: Foo> {} | ^^^ required by this bound in `A` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Foo` | LL | trait B<T: Foo> = A<T>; | +++++ diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr index 376a83e58a7..3b3d6e5f832 100644 --- a/tests/ui/traits/bad-method-typaram-kind.stderr +++ b/tests/ui/traits/bad-method-typaram-kind.stderr @@ -11,7 +11,7 @@ note: required by a bound in `Bar::bar` | LL | fn bar<T:Send>(&self); | ^^^^ required by this bound in `Bar::bar` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Send` | LL | fn foo<T:'static + std::marker::Send>() { | +++++++++++++++++++ diff --git a/tests/ui/traits/bound/on-structs-and-enums.stderr b/tests/ui/traits/bound/on-structs-and-enums.stderr index 606f764852f..7d6420c6482 100644 --- a/tests/ui/traits/bound/on-structs-and-enums.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | struct Foo<T:Trait> { | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | impl<T: Trait> Foo<T> { | +++++++ @@ -59,7 +59,7 @@ note: required by a bound in `Foo` | LL | struct Foo<T:Trait> { | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Trait` | LL | struct Badness<U: Trait> { | +++++++ @@ -75,7 +75,7 @@ note: required by a bound in `Bar` | LL | enum Bar<T:Trait> { | ^^^^^ required by this bound in `Bar` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Trait` | LL | enum MoreBadness<V: Trait> { | +++++++ diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr index 9a53c61d019..21fb19daad4 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr @@ -42,10 +42,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions --> $DIR/call-generic-method-chain.rs:16:15 diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr index a168171cfe8..845949a38bf 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr @@ -42,10 +42,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self<T: PartialEq + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions --> $DIR/call-generic-method-dup-bound.rs:14:15 @@ -62,10 +58,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self2<T: A + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/traits/const-traits/call-generic-method-fail.stderr b/tests/ui/traits/const-traits/call-generic-method-fail.stderr index 07e50a7f7da..6bacb986fef 100644 --- a/tests/ui/traits/const-traits/call-generic-method-fail.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-fail.stderr @@ -5,10 +5,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr index af6e6d25dc9..0c0037e36b8 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr @@ -28,10 +28,6 @@ LL | *t == *t | ^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { - | ++++++++++++++++++++++++++++ error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions --> $DIR/call-generic-method-pass.rs:16:15 diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index cb4c994bc2f..a76dc3e82af 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -19,10 +19,6 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 { - | +++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr index 43af435ae64..d37ff3d727c 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr @@ -19,10 +19,6 @@ LL | x(()) | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 { - | +++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr index 2e9e37ba321..8ceaae16d8e 100644 --- a/tests/ui/traits/const-traits/const-closures.stderr +++ b/tests/ui/traits/const-traits/const-closures.stderr @@ -61,10 +61,6 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 { - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:24:11 @@ -73,10 +69,6 @@ LL | f() + f() | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 { - | +++++++++++++ error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:12:5 @@ -85,10 +77,6 @@ LL | f() * 7 | ^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: consider further restricting this bound - | -LL | F: ~const FnOnce() -> u8 + ~const Fn(), - | +++++++++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/traits/const-traits/trait-where-clause.stderr b/tests/ui/traits/const-traits/trait-where-clause.stderr index abe24b662a2..3a15cc63f32 100644 --- a/tests/ui/traits/const-traits/trait-where-clause.stderr +++ b/tests/ui/traits/const-traits/trait-where-clause.stderr @@ -33,7 +33,7 @@ note: required by a bound in `Foo::b` | LL | fn b() where Self: ~const Bar; | ^^^^^^^^^^ required by this bound in `Foo::b` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Bar` | LL | fn test1<T: Foo + Bar>() { | +++++ @@ -49,7 +49,7 @@ note: required by a bound in `Foo::c` | LL | fn c<T: ~const Bar>(); | ^^^^^^^^^^ required by this bound in `Foo::c` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Bar` | LL | fn test1<T: Foo + Bar>() { | +++++ diff --git a/tests/ui/traits/copy-impl-cannot-normalize.stderr b/tests/ui/traits/copy-impl-cannot-normalize.stderr index 3bdb8b70172..45c26ac9ef4 100644 --- a/tests/ui/traits/copy-impl-cannot-normalize.stderr +++ b/tests/ui/traits/copy-impl-cannot-normalize.stderr @@ -14,7 +14,7 @@ LL | T: TraitFoo, | -------- unsatisfied trait bound introduced here note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `TraitFoo` | LL | impl<T: TraitFoo> Copy for Foo<T> {} | ++++++++++ diff --git a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr index 56544dd4def..02170a127db 100644 --- a/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr +++ b/tests/ui/traits/copy-is-not-modulo-regions.not_static.stderr @@ -12,7 +12,7 @@ note: the `Copy` impl for `Foo<'any>` requires that `'any: 'static` | LL | struct Bar<'lt>(Foo<'lt>); | ^^^^^^^^ -help: consider restricting type parameter `'any` +help: consider restricting type parameter `'any` with `'static` | LL | impl<'any: 'static> Copy for Bar<'any> {} | +++++++++ diff --git a/tests/ui/traits/inductive-overflow/two-traits.stderr b/tests/ui/traits/inductive-overflow/two-traits.stderr index 6092c194a87..1816e029f18 100644 --- a/tests/ui/traits/inductive-overflow/two-traits.stderr +++ b/tests/ui/traits/inductive-overflow/two-traits.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Magic::X` | LL | type X: Trait; | ^^^^^ required by this bound in `Magic::X` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Sync` | LL | impl<T: Magic + std::marker::Sync> Magic for T { | +++++++++++++++++++ diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr index 6f7c9fa11d4..fdf0b1722be 100644 --- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -18,7 +18,7 @@ LL | c.same_as(22) | | | required by a bound introduced by this call | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `CompareTo` | LL | fn with_trait<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool { | ++++++++++++++++ @@ -41,7 +41,7 @@ LL | CompareTo::same_as(c, 22) | | | required by a bound introduced by this call | -help: consider further restricting this bound +help: consider further restricting type parameter `C` with trait `CompareTo` | LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool { | ++++++++++++++++ diff --git a/tests/ui/traits/issue-21837.stderr b/tests/ui/traits/issue-21837.stderr index f1989392688..06e79d40c7d 100644 --- a/tests/ui/traits/issue-21837.stderr +++ b/tests/ui/traits/issue-21837.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Foo` | LL | pub struct Foo<T: Bound>(T); | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Bound` | LL | impl<T: Bound> Trait2 for Foo<T> {} | +++++++ diff --git a/tests/ui/traits/issue-43784-supertrait.stderr b/tests/ui/traits/issue-43784-supertrait.stderr index 2bf365745a6..1a6da70d76d 100644 --- a/tests/ui/traits/issue-43784-supertrait.stderr +++ b/tests/ui/traits/issue-43784-supertrait.stderr @@ -14,7 +14,7 @@ note: required by a bound in `Complete` | LL | pub trait Complete: Partial { | ^^^^^^^ required by this bound in `Complete` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Complete for T {} | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr b/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr index cd8d8b3ffcd..463e50a2553 100644 --- a/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr +++ b/tests/ui/traits/next-solver/diagnostics/projection-trait-ref.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | let x: <T as Trait>::Assoc = (); | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn test_poly<T: Trait>() { | +++++++ diff --git a/tests/ui/traits/next-solver/dyn-incompatibility.stderr b/tests/ui/traits/next-solver/dyn-incompatibility.stderr index a720797efc4..6398fbddca5 100644 --- a/tests/ui/traits/next-solver/dyn-incompatibility.stderr +++ b/tests/ui/traits/next-solver/dyn-incompatibility.stderr @@ -10,7 +10,7 @@ note: required by a bound in `copy` | LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T { | +++++++++++++++++++ @@ -38,7 +38,7 @@ LL | copy::<dyn Setup<From=T>>(t) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T` | = note: required because it appears within the type `dyn Setup<From = T>` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T { | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr index 1f319cc6743..da269bbeae4 100644 --- a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr +++ b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr @@ -14,7 +14,7 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T> note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub struct Struct<T: std::clone::Clone>(T); | +++++++++++++++++++ diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index 09162970d33..d2a58e95629 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -32,7 +32,7 @@ error[E0277]: the trait bound `T: Overlap<for<'a> fn(Assoc<'a, T>)>` is not sati LL | impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T> {} | ^ the trait `Overlap<for<'a> fn(Assoc<'a, T>)>` is not implemented for `T` | -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Overlap` | LL | impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T>, T: Overlap<for<'a> fn(Assoc<'a, T>)> {} | ++++++++++++++++++++++++++++++++++++++ diff --git a/tests/ui/tuple/builtin-fail.stderr b/tests/ui/tuple/builtin-fail.stderr index e3e29a73fdc..ccbc5ae2b75 100644 --- a/tests/ui/tuple/builtin-fail.stderr +++ b/tests/ui/tuple/builtin-fail.stderr @@ -9,7 +9,7 @@ note: required by a bound in `assert_is_tuple` | LL | fn assert_is_tuple<T: std::marker::Tuple + ?Sized>() {} | ^^^^^^^^^^^^^^^^^^ required by this bound in `assert_is_tuple` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with unstable trait `Tuple` | LL | fn from_param_env<T: std::marker::Tuple>() { | ++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr index 8f887a6ac68..bbb32b2d604 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn f<T: Clone>(t: T) -> X<T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Clone` | LL | pub type X<T: std::clone::Clone> = impl Clone; | +++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr index bca88b5fae1..c0f6d678097 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked3.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Struct` | LL | struct Struct<V: Display>(Option<V>); | ^^^^^^^ required by this bound in `Struct` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Display` | LL | type Foo<T: Debug + std::fmt::Display> = (impl Debug, Struct<T>); | +++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/future.stderr b/tests/ui/type-alias-impl-trait/future.stderr index b20073fcdfc..047ad164239 100644 --- a/tests/ui/type-alias-impl-trait/future.stderr +++ b/tests/ui/type-alias-impl-trait/future.stderr @@ -9,7 +9,7 @@ note: required by a bound in `foo` | LL | fn foo<B: Bar>(bar: B) -> FooFuture<B> { | ^^^ required by this bound in `foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFuture<B: Bar> = impl Future<Output = ()>; | +++++ diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr index af6e6e1e66e..cd6e85764bd 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Debug` | LL | type Two<T: std::fmt::Debug, U> = impl Debug; | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr index a847bed93da..bf3c4a0e04f 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | type Two<T, U: std::fmt::Debug> = impl Debug; | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr index 88529b370f1..98f99cdbfbd 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -9,7 +9,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained<T: Trait> = impl Send; | ^^^^^ required by this bound -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> { | +++++++ @@ -30,7 +30,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained<T: Trait> = impl Send; | ^^^^^ required by this bound -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> { | +++++++ diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr index b3b9cbca968..5506977a3e7 100644 --- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -9,7 +9,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained<T: std::fmt::Debug> = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> { | +++++++++++++++++ @@ -25,7 +25,7 @@ note: required by a bound on the type alias `Underconstrained2` | LL | type Underconstrained2<T: std::fmt::Debug> = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> { | +++++++++++++++++ @@ -46,7 +46,7 @@ note: required by a bound on the type alias `Underconstrained` | LL | type Underconstrained<T: std::fmt::Debug> = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Debug` | LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> { | +++++++++++++++++ @@ -67,7 +67,7 @@ note: required by a bound on the type alias `Underconstrained2` | LL | type Underconstrained2<T: std::fmt::Debug> = impl Send; | ^^^^^^^^^^^^^^^ required by this bound -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Debug` | LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> { | +++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-52843.stderr b/tests/ui/type-alias-impl-trait/issue-52843.stderr index a6bdddbc98c..6673b03525d 100644 --- a/tests/ui/type-alias-impl-trait/issue-52843.stderr +++ b/tests/ui/type-alias-impl-trait/issue-52843.stderr @@ -14,7 +14,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn foo<T: Default>(t: T) -> Foo<T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Default` | LL | type Foo<T: std::default::Default> = impl Default; | +++++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-53092.stderr b/tests/ui/type-alias-impl-trait/issue-53092.stderr index f04750866c7..579902aa3ab 100644 --- a/tests/ui/type-alias-impl-trait/issue-53092.stderr +++ b/tests/ui/type-alias-impl-trait/issue-53092.stderr @@ -9,7 +9,7 @@ note: required by a bound in `make_bug` | LL | fn make_bug<T, U: From<T>>() -> Bug<T, U> { | ^^^^^^^ required by this bound in `make_bug` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `From` | LL | pub type Bug<T, U: std::convert::From<T>> = impl Fn(T) -> U + Copy; | +++++++++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-89686.stderr b/tests/ui/type-alias-impl-trait/issue-89686.stderr index 91d71339a08..6fa7e197c40 100644 --- a/tests/ui/type-alias-impl-trait/issue-89686.stderr +++ b/tests/ui/type-alias-impl-trait/issue-89686.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | async move { self.f().await } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type G<'a, T: Trait> = impl Future<Output = ()>; | +++++++ diff --git a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr index bc233a53214..afdccd56a50 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-1.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `<MyFoo as Foo>::foo` | LL | fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> { | ^^^ required by this bound in `<MyFoo as Foo>::foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn<B: Bar> = impl FnOnce(); | +++++ diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr index 4a6a62bdf96..d4faa6e9392 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -21,7 +21,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn<B: Bar> = impl Baz; | +++++ diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr index a2944a1acb9..e2fa9442323 100644 --- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr +++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `V` LL | type Foo<V> = impl Trait<V::Assoc>; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; | ++++++++++++++++ @@ -16,7 +16,7 @@ LL | type Foo<V> = impl Trait<V::Assoc>; | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc` | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `TraitWithAssoc` | LL | type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; | ++++++++++++++++ diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.rs b/tests/ui/type-alias-impl-trait/self-referential-3.rs index b33051da2d7..18f09b54867 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-3.rs +++ b/tests/ui/type-alias-impl-trait/self-referential-3.rs @@ -1,5 +1,3 @@ -//@ ignore-compare-mode-next-solver (hangs) - #![feature(type_alias_impl_trait)] type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug; diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.stderr b/tests/ui/type-alias-impl-trait/self-referential-3.stderr index 32eac622e51..15ebcdafca6 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-3.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-3.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `&i32` with `Bar<'a, 'b>` - --> $DIR/self-referential-3.rs:7:31 + --> $DIR/self-referential-3.rs:5:31 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'a, 'b>` diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.rs b/tests/ui/type-alias-impl-trait/self-referential-4.rs index 29b5a042b7d..36742c8ad57 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-4.rs +++ b/tests/ui/type-alias-impl-trait/self-referential-4.rs @@ -1,5 +1,3 @@ -//@ ignore-compare-mode-next-solver (hangs) - #![feature(type_alias_impl_trait)] type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'static>> + std::fmt::Debug; diff --git a/tests/ui/type-alias-impl-trait/self-referential-4.stderr b/tests/ui/type-alias-impl-trait/self-referential-4.stderr index e7f9e232a27..98c762e3d38 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-4.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `&i32` with `Bar<'b, 'static>` - --> $DIR/self-referential-4.rs:7:31 + --> $DIR/self-referential-4.rs:5:31 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'static>` @@ -10,7 +10,7 @@ LL | i = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` - --> $DIR/self-referential-4.rs:13:31 + --> $DIR/self-referential-4.rs:11:31 | LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == Foo<'static, 'b>` @@ -21,7 +21,7 @@ LL | i = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` - --> $DIR/self-referential-4.rs:19:31 + --> $DIR/self-referential-4.rs:17:31 | LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == Moo<'static, 'a>` diff --git a/tests/ui/type-alias-impl-trait/self-referential.rs b/tests/ui/type-alias-impl-trait/self-referential.rs index 2bd450e6c86..b899b12cc4a 100644 --- a/tests/ui/type-alias-impl-trait/self-referential.rs +++ b/tests/ui/type-alias-impl-trait/self-referential.rs @@ -1,5 +1,3 @@ -//@ ignore-compare-mode-next-solver (hangs) - #![feature(type_alias_impl_trait)] type Bar<'a, 'b> = impl PartialEq<Bar<'b, 'a>> + std::fmt::Debug; diff --git a/tests/ui/type-alias-impl-trait/self-referential.stderr b/tests/ui/type-alias-impl-trait/self-referential.stderr index 396237c7898..57d67f69376 100644 --- a/tests/ui/type-alias-impl-trait/self-referential.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `&i32` with `Bar<'b, 'a>` - --> $DIR/self-referential.rs:7:31 + --> $DIR/self-referential.rs:5:31 | LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == Bar<'b, 'a>` @@ -11,7 +11,7 @@ LL | i = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `(i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)` - --> $DIR/self-referential.rs:14:31 + --> $DIR/self-referential.rs:12:31 | LL | fn foo<'a, 'b>(i: &'a i32) -> Foo<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == (i32, Foo<'a, 'b>::{opaque#0}<'a, 'b>)` @@ -23,7 +23,7 @@ LL | (42, i) = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)` - --> $DIR/self-referential.rs:21:31 + --> $DIR/self-referential.rs:19:31 | LL | fn moo<'a, 'b>(i: &'a i32) -> Moo<'a, 'b> { | ^^^^^^^^^^^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0}<'b, 'a>)` diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr index 48cef847fbb..e50949ed8f3 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -21,7 +21,7 @@ note: this definition site has more where clauses than the opaque type | LL | fn _defining_use<T: Trait>() -> Converter<T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type Converter<T: Trait> = impl ProofForConversion<T>; | +++++++ diff --git a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr index 47bea7bbe60..9046a8a76b8 100644 --- a/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr +++ b/tests/ui/type-alias-impl-trait/wf-check-fn-def.stderr @@ -9,7 +9,7 @@ note: required by a bound in `mop` | LL | fn mop<B: Bar>(bar: B) { bar.bar() } | ^^^ required by this bound in `mop` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn<B: Bar> = impl FnOnce(B); | +++++ diff --git a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr index 09a42f73490..4156f0ca96a 100644 --- a/tests/ui/type-alias-impl-trait/wf_check_closures.stderr +++ b/tests/ui/type-alias-impl-trait/wf_check_closures.stderr @@ -9,7 +9,7 @@ note: required by a bound in `foo` | LL | fn foo<B: Bar>(bar: B) -> FooFn<B> { | ^^^ required by this bound in `foo` -help: consider restricting type parameter `B` +help: consider restricting type parameter `B` with trait `Bar` | LL | type FooFn<B: Bar> = impl FnOnce(); | +++++ diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr index 96179a7b484..885c6ec9d8e 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr @@ -4,7 +4,7 @@ error[E0220]: associated type `Assoc` not found for `T` LL | type AssocOf<T> = T::Assoc; | ^^^^^ there is an associated type `Assoc` in the trait `Trait` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type AssocOf<T: Trait> = T::Assoc; | +++++++ @@ -15,7 +15,7 @@ error[E0220]: associated type `Assok` not found for `T` LL | type AssokOf<T> = T::Assok; | ^^^^^ there is a similarly named associated type `Assoc` in the trait `Trait` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Trait` | LL | type AssokOf<T: Trait> = T::Assok; | +++++++ @@ -30,7 +30,7 @@ error[E0220]: associated type `Proj` not found for `T` LL | type ProjOf<T> = T::Proj; | ^^^^ there is an associated type `Proj` in the trait `Parametrized` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Parametrized` | LL | type ProjOf<T: Parametrized</* 'a, T, N */>> = T::Proj; | ++++++++++++++++++++++++++++++ diff --git a/tests/ui/type/auxiliary/crate_a1.rs b/tests/ui/type/auxiliary/crate_a1.rs index e2e18500541..616493193fd 100644 --- a/tests/ui/type/auxiliary/crate_a1.rs +++ b/tests/ui/type/auxiliary/crate_a1.rs @@ -1,6 +1,6 @@ pub struct Foo; -pub trait Bar{} +pub trait Bar {} pub fn bar() -> Box<Bar> { unimplemented!() diff --git a/tests/ui/type/auxiliary/crate_a2.rs b/tests/ui/type/auxiliary/crate_a2.rs index d16a4ac10e0..57a7685b77c 100644 --- a/tests/ui/type/auxiliary/crate_a2.rs +++ b/tests/ui/type/auxiliary/crate_a2.rs @@ -1,6 +1,6 @@ pub struct Foo; -pub trait Bar{} +pub trait Bar {} pub fn bar() -> Box<Bar> { unimplemented!() diff --git a/tests/ui/type/type-check-defaults.stderr b/tests/ui/type/type-check-defaults.stderr index 9c482506129..ab3378eaa4a 100644 --- a/tests/ui/type/type-check-defaults.stderr +++ b/tests/ui/type/type-check-defaults.stderr @@ -53,7 +53,7 @@ note: required by a bound in `Super` | LL | trait Super<T: Copy> { } | ^^^^ required by this bound in `Super` -help: consider further restricting type parameter `T` +help: consider further restricting type parameter `T` with trait `Copy` | LL | trait Base<T = String>: Super<T> where T: std::marker::Copy { } | ++++++++++++++++++++++++++ diff --git a/tests/ui/type/type-check/missing_trait_impl.stderr b/tests/ui/type/type-check/missing_trait_impl.stderr index 2b58cd4180b..033b42e6736 100644 --- a/tests/ui/type/type-check/missing_trait_impl.stderr +++ b/tests/ui/type/type-check/missing_trait_impl.stderr @@ -6,7 +6,7 @@ LL | let z = x + y; | | | T | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Add` | LL | fn foo<T: std::ops::Add>(x: T, y: T) { | +++++++++++++++ @@ -19,7 +19,7 @@ LL | x += x; | | | cannot use `+=` on type `T` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `AddAssign` | LL | fn bar<T: std::ops::AddAssign>(x: T) { | +++++++++++++++++++++ @@ -30,7 +30,7 @@ error[E0600]: cannot apply unary operator `-` to type `T` LL | let y = -x; | ^^ cannot apply unary operator `-` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Neg` | LL | fn baz<T: std::ops::Neg>(x: T) { | +++++++++++++++ @@ -41,7 +41,7 @@ error[E0600]: cannot apply unary operator `!` to type `T` LL | let y = !x; | ^^ cannot apply unary operator `!` | -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Not` | LL | fn baz<T: std::ops::Not>(x: T) { | +++++++++++++++ diff --git a/tests/ui/type/type-mismatch-same-crate-name.rs b/tests/ui/type/type-mismatch-same-crate-name.rs index da766165238..e88960364a2 100644 --- a/tests/ui/type/type-mismatch-same-crate-name.rs +++ b/tests/ui/type/type-mismatch-same-crate-name.rs @@ -3,25 +3,32 @@ // This tests the extra note reported when a type error deals with // seemingly identical types. -// The main use case of this error is when there are two crates -// (generally different versions of the same crate) with the same name -// causing a type mismatch. Here, we simulate that error using block-scoped -// aliased `extern crate` declarations. +// The main use case of this error is when there are two crates imported +// with the same name, causing a type mismatch. Here, we simulate that error +// using block-scoped aliased `extern crate` declarations. +// This is *not* the same case as two different crate versions in the +// dependency tree. That is tested in `tests/run-make/crate-loading/`. fn main() { let foo2 = {extern crate crate_a2 as a; a::Foo}; + //~^ NOTE one type comes from crate `crate_a2` used here, which is renamed locally to `a` + //~| NOTE one trait comes from crate `crate_a2` used here, which is renamed locally to `a` let bar2 = {extern crate crate_a2 as a; a::bar()}; { extern crate crate_a1 as a; + //~^ NOTE one type comes from crate `crate_a1` used here, which is renamed locally to `a` + //~| NOTE one trait comes from crate `crate_a1` used here, which is renamed locally to `a` a::try_foo(foo2); //~^ ERROR mismatched types - //~| perhaps two different versions of crate `crate_a1` - //~| expected `main::a::Foo`, found a different `main::a::Foo` + //~| NOTE expected `main::a::Foo`, found a different `main::a::Foo` + //~| NOTE arguments to this function are incorrect + //~| NOTE two types coming from two different crates are different types even if they look the same + //~| NOTE function defined here a::try_bar(bar2); //~^ ERROR mismatched types - //~| perhaps two different versions of crate `crate_a1` - //~| expected trait `main::a::Bar` - //~| expected struct `Box<(dyn main::a::Bar + 'static)>` - //~| found struct `Box<dyn main::a::Bar>` + //~| NOTE expected trait `main::a::Bar`, found a different trait `main::a::Bar` + //~| NOTE arguments to this function are incorrect + //~| NOTE two types coming from two different crates are different types even if they look the same + //~| NOTE function defined here } } diff --git a/tests/ui/type/type-mismatch-same-crate-name.stderr b/tests/ui/type/type-mismatch-same-crate-name.stderr index 504812f5867..7b791549f56 100644 --- a/tests/ui/type/type-mismatch-same-crate-name.stderr +++ b/tests/ui/type/type-mismatch-same-crate-name.stderr @@ -1,23 +1,29 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:16:20 + --> $DIR/type-mismatch-same-crate-name.rs:21:20 | LL | a::try_foo(foo2); | ---------- ^^^^ expected `main::a::Foo`, found a different `main::a::Foo` | | | arguments to this function are incorrect | - = note: `main::a::Foo` and `main::a::Foo` have similar names, but are actually distinct types -note: `main::a::Foo` is defined in crate `crate_a2` +note: two types coming from two different crates are different types even if they look the same --> $DIR/auxiliary/crate_a2.rs:1:1 | LL | pub struct Foo; - | ^^^^^^^^^^^^^^ -note: `main::a::Foo` is defined in crate `crate_a1` - --> $DIR/auxiliary/crate_a1.rs:1:1 + | ^^^^^^^^^^^^^^ this is the found type `crate_a2::Foo` + | + ::: $DIR/auxiliary/crate_a1.rs:1:1 | LL | pub struct Foo; - | ^^^^^^^^^^^^^^ - = note: perhaps two different versions of crate `crate_a1` are being used? + | ^^^^^^^^^^^^^^ this is the expected type `crate_a1::Foo` + | + ::: $DIR/type-mismatch-same-crate-name.rs:13:17 + | +LL | let foo2 = {extern crate crate_a2 as a; a::Foo}; + | --------------------------- one type comes from crate `crate_a2` used here, which is renamed locally to `a` +... +LL | extern crate crate_a1 as a; + | --------------------------- one type comes from crate `crate_a1` used here, which is renamed locally to `a` note: function defined here --> $DIR/auxiliary/crate_a1.rs:10:8 | @@ -25,16 +31,31 @@ LL | pub fn try_foo(x: Foo){} | ^^^^^^^ error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:20:20 + --> $DIR/type-mismatch-same-crate-name.rs:27:20 | LL | a::try_bar(bar2); | ---------- ^^^^ expected trait `main::a::Bar`, found a different trait `main::a::Bar` | | | arguments to this function are incorrect | - = note: expected struct `Box<(dyn main::a::Bar + 'static)>` - found struct `Box<dyn main::a::Bar>` - = note: perhaps two different versions of crate `crate_a1` are being used? +note: two types coming from two different crates are different types even if they look the same + --> $DIR/auxiliary/crate_a2.rs:3:1 + | +LL | pub trait Bar {} + | ^^^^^^^^^^^^^ this is the found trait `crate_a2::Bar` + | + ::: $DIR/auxiliary/crate_a1.rs:3:1 + | +LL | pub trait Bar {} + | ^^^^^^^^^^^^^ this is the expected trait `crate_a1::Bar` + | + ::: $DIR/type-mismatch-same-crate-name.rs:13:17 + | +LL | let foo2 = {extern crate crate_a2 as a; a::Foo}; + | --------------------------- one trait comes from crate `crate_a2` used here, which is renamed locally to `a` +... +LL | extern crate crate_a1 as a; + | --------------------------- one trait comes from crate `crate_a1` used here, which is renamed locally to `a` note: function defined here --> $DIR/auxiliary/crate_a1.rs:11:8 | diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr index bd7fd0392c3..dd2ce092368 100644 --- a/tests/ui/typeck/bad-index-due-to-nested.stderr +++ b/tests/ui/typeck/bad-index-due-to-nested.stderr @@ -12,7 +12,7 @@ LL | impl<K, V> Index<&K> for HashMap<K, V> LL | where LL | K: Hash, | ---- unsatisfied trait bound introduced here -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Hash` | LL | fn index<'a, K: std::hash::Hash, V>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++ @@ -31,7 +31,7 @@ LL | impl<K, V> Index<&K> for HashMap<K, V> ... LL | V: Copy, | ---- unsatisfied trait bound introduced here -help: consider restricting type parameter `V` +help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ diff --git a/tests/ui/typeck/issue-90164.stderr b/tests/ui/typeck/issue-90164.stderr index 43e96e1adc6..1be9c1a0b6e 100644 --- a/tests/ui/typeck/issue-90164.stderr +++ b/tests/ui/typeck/issue-90164.stderr @@ -13,7 +13,7 @@ note: required by a bound in `copy` | LL | fn copy<R: Unpin, W>(_: R, _: W) {} | ^^^^^ required by this bound in `copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Unpin` | LL | fn f<T: std::marker::Unpin>(r: T) { | ++++++++++++++++++++ diff --git a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr index 537ae6b2b5f..d72c56ac712 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_send` | LL | fn is_send<T:Send>() { | ^^^^ required by this bound in `is_send` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Send` | LL | fn foo<T: std::marker::Send>() { | +++++++++++++++++++ diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr index 0dd894beb2a..8b78ddcf4a5 100644 --- a/tests/ui/union/issue-81199.stderr +++ b/tests/ui/union/issue-81199.stderr @@ -9,7 +9,7 @@ note: required by a bound in `PtrComponents` | LL | struct PtrComponents<T: Pointee + ?Sized> { | ^^^^^^^ required by this bound in `PtrComponents` -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Pointee` | LL | union PtrRepr<T: ?Sized + Pointee> { | +++++++++ diff --git a/tests/ui/unop/unop-move-semantics.stderr b/tests/ui/unop/unop-move-semantics.stderr index 0ae918d434a..5b81feaa578 100644 --- a/tests/ui/unop/unop-move-semantics.stderr +++ b/tests/ui/unop/unop-move-semantics.stderr @@ -15,7 +15,7 @@ help: consider cloning the value if the performance cost is acceptable | LL | !x.clone(); | ++++++++ -help: consider further restricting this bound +help: consider further restricting type parameter `T` with trait `Copy` | LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) { | ++++++ diff --git a/tests/ui/wf/issue-96810.stderr b/tests/ui/wf/issue-96810.stderr index 622d72f791e..3f87d3e0786 100644 --- a/tests/ui/wf/issue-96810.stderr +++ b/tests/ui/wf/issue-96810.stderr @@ -9,7 +9,7 @@ note: required by a bound in `S` | LL | struct S<T: Tr>(T::Assoc); | ^^ required by this bound in `S` -help: consider restricting type parameter `K` +help: consider restricting type parameter `K` with trait `Tr` | LL | struct Hoge<K: Tr> { | ++++ diff --git a/tests/ui/wf/wf-enum-bound.stderr b/tests/ui/wf/wf-enum-bound.stderr index 78b5c6ec20e..1f37dc409fc 100644 --- a/tests/ui/wf/wf-enum-bound.stderr +++ b/tests/ui/wf/wf-enum-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-enum-fields-struct-variant.stderr b/tests/ui/wf/wf-enum-fields-struct-variant.stderr index 2f2c1c2d266..f15a31887a2 100644 --- a/tests/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/tests/ui/wf/wf-enum-fields-struct-variant.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy<T:Copy> { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | enum AnotherEnum<A: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-enum-fields.stderr b/tests/ui/wf/wf-enum-fields.stderr index a5feaadfc75..3b4de77efdc 100644 --- a/tests/ui/wf/wf-enum-fields.stderr +++ b/tests/ui/wf/wf-enum-fields.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy<T:Copy> { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | enum SomeEnum<A: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr index fbfe42ac624..76671dedabf 100644 --- a/tests/ui/wf/wf-fn-where-clause.stderr +++ b/tests/ui/wf/wf-fn-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-impl-associated-type-trait.stderr b/tests/ui/wf/wf-impl-associated-type-trait.stderr index 09e255bead0..47962c75d69 100644 --- a/tests/ui/wf/wf-impl-associated-type-trait.stderr +++ b/tests/ui/wf/wf-impl-associated-type-trait.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MySet` | LL | pub struct MySet<T:MyHash> { | ^^^^^^ required by this bound in `MySet` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `MyHash` | LL | impl<T: MyHash> Foo for T { | ++++++++ diff --git a/tests/ui/wf/wf-in-fn-arg.stderr b/tests/ui/wf/wf-in-fn-arg.stderr index 8f22edd17a1..a65f621526b 100644 --- a/tests/ui/wf/wf-in-fn-arg.stderr +++ b/tests/ui/wf/wf-in-fn-arg.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy<T:Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn bar<T: std::marker::Copy>(_: &MustBeCopy<T>) | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-ret.stderr b/tests/ui/wf/wf-in-fn-ret.stderr index 1ae49a348cc..3f2b46f8478 100644 --- a/tests/ui/wf/wf-in-fn-ret.stderr +++ b/tests/ui/wf/wf-in-fn-ret.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy<T: Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | fn bar<T: std::marker::Copy>() -> MustBeCopy<T> | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-type-arg.stderr b/tests/ui/wf/wf-in-fn-type-arg.stderr index 17594c813da..4626b90500a 100644 --- a/tests/ui/wf/wf-in-fn-type-arg.stderr +++ b/tests/ui/wf/wf-in-fn-type-arg.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy<T:Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Bar<T: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-type-ret.stderr b/tests/ui/wf/wf-in-fn-type-ret.stderr index fac535a1126..2ad405b4451 100644 --- a/tests/ui/wf/wf-in-fn-type-ret.stderr +++ b/tests/ui/wf/wf-in-fn-type-ret.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy<T:Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Foo<T: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-fn-where-clause.stderr b/tests/ui/wf/wf-in-fn-where-clause.stderr index 4c556d3d77d..6a56d1c032f 100644 --- a/tests/ui/wf/wf-in-fn-where-clause.stderr +++ b/tests/ui/wf/wf-in-fn-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | trait MustBeCopy<T:Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: MustBeCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-in-obj-type-trait.stderr b/tests/ui/wf/wf-in-obj-type-trait.stderr index b96f56a12a5..5cd5bf5e24e 100644 --- a/tests/ui/wf/wf-in-obj-type-trait.stderr +++ b/tests/ui/wf/wf-in-obj-type-trait.stderr @@ -9,7 +9,7 @@ note: required by a bound in `MustBeCopy` | LL | struct MustBeCopy<T:Copy> { | ^^^^ required by this bound in `MustBeCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | struct Bar<T: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr b/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr index 4cfbec12b6e..8b41bb17d2f 100644 --- a/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/tests/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `U` +help: consider restricting type parameter `U` with trait `Copy` | LL | impl<T,U: std::marker::Copy> Foo<T,U> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-inherent-impl-where-clause.stderr b/tests/ui/wf/wf-inherent-impl-where-clause.stderr index bdc1ee3e0e2..216b7a98b13 100644 --- a/tests/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/tests/ui/wf/wf-inherent-impl-where-clause.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-struct-bound.stderr b/tests/ui/wf/wf-struct-bound.stderr index 4ac7f4634e4..24b4282538d 100644 --- a/tests/ui/wf/wf-struct-bound.stderr +++ b/tests/ui/wf/wf-struct-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-struct-field.stderr b/tests/ui/wf/wf-struct-field.stderr index 241ced3c2db..4449b71bd88 100644 --- a/tests/ui/wf/wf-struct-field.stderr +++ b/tests/ui/wf/wf-struct-field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `IsCopy` | LL | struct IsCopy<T:Copy> { | ^^^^ required by this bound in `IsCopy` -help: consider restricting type parameter `A` +help: consider restricting type parameter `A` with trait `Copy` | LL | struct SomeStruct<A: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-associated-type-bound.stderr b/tests/ui/wf/wf-trait-associated-type-bound.stderr index 4ea895a9b03..fe6a848f866 100644 --- a/tests/ui/wf/wf-trait-associated-type-bound.stderr +++ b/tests/ui/wf/wf-trait-associated-type-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | trait SomeTrait<T: std::marker::Copy> { | +++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-bound.stderr b/tests/ui/wf/wf-trait-bound.stderr index 5845d05b38e..0a8d9aa7be8 100644 --- a/tests/ui/wf/wf-trait-bound.stderr +++ b/tests/ui/wf/wf-trait-bound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider further restricting type parameter `U` +help: consider further restricting type parameter `U` with trait `Copy` | LL | where T: ExtraCopy<U>, U: std::marker::Copy | ++++++++++++++++++++++ diff --git a/tests/ui/wf/wf-trait-superbound.stderr b/tests/ui/wf/wf-trait-superbound.stderr index 3c05065e57f..9b0205bfe39 100644 --- a/tests/ui/wf/wf-trait-superbound.stderr +++ b/tests/ui/wf/wf-trait-superbound.stderr @@ -9,7 +9,7 @@ note: required by a bound in `ExtraCopy` | LL | trait ExtraCopy<T:Copy> { } | ^^^^ required by this bound in `ExtraCopy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | trait SomeTrait<T: std::marker::Copy>: ExtraCopy<T> { | +++++++++++++++++++ diff --git a/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index 2612cefef28..955ec18f465 100644 --- a/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -11,7 +11,7 @@ note: required by a bound in `require_copy` | LL | fn require_copy<T: Copy>(x: T) {} | ^^^^ required by this bound in `require_copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Foo<T> { | +++++++++++++++++++ diff --git a/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 090df26a39e..793851a2871 100644 --- a/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/tests/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -11,7 +11,7 @@ note: required by a bound in `require_copy` | LL | fn require_copy<T: Copy>(x: T) {} | ^^^^ required by this bound in `require_copy` -help: consider restricting type parameter `T` +help: consider restricting type parameter `T` with trait `Copy` | LL | impl<T: std::marker::Copy> Foo<T> for Bar<T> { | +++++++++++++++++++ |
