diff options
Diffstat (limited to 'src/test/ui')
209 files changed, 2578 insertions, 597 deletions
diff --git a/src/test/ui/asm/aarch64/bad-options.stderr b/src/test/ui/asm/aarch64/bad-options.stderr index 21bcc4a9c7b..867e0433eae 100644 --- a/src/test/ui/asm/aarch64/bad-options.stderr +++ b/src/test/ui/asm/aarch64/bad-options.stderr @@ -36,41 +36,41 @@ LL | asm!("{}", out(reg) foo, clobber_abi("C")); | | | generic outputs -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/bad-options.rs:28:25 | LL | global_asm!("", options(nomem)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `readonly` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `readonly` --> $DIR/bad-options.rs:30:25 | LL | global_asm!("", options(readonly)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `noreturn` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `noreturn` --> $DIR/bad-options.rs:32:25 | LL | global_asm!("", options(noreturn)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `pure` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `pure` --> $DIR/bad-options.rs:34:25 | LL | global_asm!("", options(pure)); - | ^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nostack` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nostack` --> $DIR/bad-options.rs:36:25 | LL | global_asm!("", options(nostack)); - | ^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `preserves_flags` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `preserves_flags` --> $DIR/bad-options.rs:38:25 | LL | global_asm!("", options(preserves_flags)); - | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` error: invalid ABI for `clobber_abi` --> $DIR/bad-options.rs:20:18 diff --git a/src/test/ui/asm/aarch64/may_unwind.rs b/src/test/ui/asm/aarch64/may_unwind.rs new file mode 100644 index 00000000000..94cc7d75049 --- /dev/null +++ b/src/test/ui/asm/aarch64/may_unwind.rs @@ -0,0 +1,37 @@ +// min-llvm-version: 13.0.0 +// only-aarch64 +// run-pass +// needs-asm-support + +#![feature(asm, asm_sym, asm_unwind)] + +use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe}; + +struct Foo<'a>(&'a mut bool); + +impl Drop for Foo<'_> { + fn drop(&mut self) { + *self.0 = false; + } +} + +extern "C" fn panicky() { + resume_unwind(Box::new(())); +} + +fn main() { + let flag = &mut true; + catch_unwind(AssertUnwindSafe(|| { + let _foo = Foo(flag); + unsafe { + asm!( + "bl {}", + sym panicky, + clobber_abi("C"), + options(may_unwind) + ); + } + })) + .expect_err("expected a panic"); + assert_eq!(*flag, false); +} diff --git a/src/test/ui/asm/aarch64/parse-error.stderr b/src/test/ui/asm/aarch64/parse-error.stderr index 3d88cef5c7d..a143c3b2b28 100644 --- a/src/test/ui/asm/aarch64/parse-error.stderr +++ b/src/test/ui/asm/aarch64/parse-error.stderr @@ -64,11 +64,11 @@ error: argument to `sym` must be a path expression LL | asm!("{}", sym foo + bar); | ^^^^^^^^^ -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:31:26 | LL | asm!("", options(foo)); - | ^^^ expected one of 9 possible tokens + | ^^^ expected one of 10 possible tokens error: expected one of `)` or `,`, found `foo` --> $DIR/parse-error.rs:33:32 @@ -76,11 +76,11 @@ error: expected one of `)` or `,`, found `foo` LL | asm!("", options(nomem foo)); | ^^^ expected one of `)` or `,` -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:35:33 | LL | asm!("", options(nomem, foo)); - | ^^^ expected one of 9 possible tokens + | ^^^ expected one of 10 possible tokens error: arguments are not allowed after options --> $DIR/parse-error.rs:37:31 @@ -260,23 +260,23 @@ error: expected one of `,`, `.`, `?`, or an operator, found `FOO` LL | global_asm!("{}", const(reg) FOO); | ^^^ expected one of `,`, `.`, `?`, or an operator -error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `FOO` --> $DIR/parse-error.rs:100:25 | LL | global_asm!("", options(FOO)); - | ^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/parse-error.rs:102:25 | LL | global_asm!("", options(nomem FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/parse-error.rs:104:25 | LL | global_asm!("", options(nomem, FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` error: arguments are not allowed after options --> $DIR/parse-error.rs:106:30 diff --git a/src/test/ui/asm/may_unwind.rs b/src/test/ui/asm/may_unwind.rs new file mode 100644 index 00000000000..436e8b9d95a --- /dev/null +++ b/src/test/ui/asm/may_unwind.rs @@ -0,0 +1,9 @@ +// min-llvm-version: 13.0.0 +// run-pass +// needs-asm-support + +#![feature(asm, asm_unwind)] + +fn main() { + unsafe { asm!("", options(may_unwind)) }; +} diff --git a/src/test/ui/asm/x86_64/bad-options.stderr b/src/test/ui/asm/x86_64/bad-options.stderr index e2351840eef..a63c42aac27 100644 --- a/src/test/ui/asm/x86_64/bad-options.stderr +++ b/src/test/ui/asm/x86_64/bad-options.stderr @@ -45,41 +45,41 @@ LL | asm!("{}", out(reg) foo, clobber_abi("C"), clobber_abi("C")); | | clobber_abi | generic outputs -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/bad-options.rs:31:25 | LL | global_asm!("", options(nomem)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `readonly` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `readonly` --> $DIR/bad-options.rs:33:25 | LL | global_asm!("", options(readonly)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `noreturn` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `noreturn` --> $DIR/bad-options.rs:35:25 | LL | global_asm!("", options(noreturn)); - | ^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `pure` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `pure` --> $DIR/bad-options.rs:37:25 | LL | global_asm!("", options(pure)); - | ^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nostack` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nostack` --> $DIR/bad-options.rs:39:25 | LL | global_asm!("", options(nostack)); - | ^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `preserves_flags` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `preserves_flags` --> $DIR/bad-options.rs:41:25 | LL | global_asm!("", options(preserves_flags)); - | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` error: invalid ABI for `clobber_abi` --> $DIR/bad-options.rs:20:18 diff --git a/src/test/ui/asm/x86_64/may_unwind.rs b/src/test/ui/asm/x86_64/may_unwind.rs new file mode 100644 index 00000000000..5ac4dd9b956 --- /dev/null +++ b/src/test/ui/asm/x86_64/may_unwind.rs @@ -0,0 +1,37 @@ +// min-llvm-version: 13.0.0 +// only-x86_64 +// run-pass +// needs-asm-support + +#![feature(asm, asm_sym, asm_unwind)] + +use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe}; + +struct Foo<'a>(&'a mut bool); + +impl Drop for Foo<'_> { + fn drop(&mut self) { + *self.0 = false; + } +} + +extern "C" fn panicky() { + resume_unwind(Box::new(())); +} + +fn main() { + let flag = &mut true; + catch_unwind(AssertUnwindSafe(|| { + let _foo = Foo(flag); + unsafe { + asm!( + "call {}", + sym panicky, + clobber_abi("C"), + options(may_unwind) + ); + } + })) + .expect_err("expected a panic"); + assert_eq!(*flag, false); +} diff --git a/src/test/ui/asm/x86_64/parse-error.stderr b/src/test/ui/asm/x86_64/parse-error.stderr index 018df9826c6..4f16c15af38 100644 --- a/src/test/ui/asm/x86_64/parse-error.stderr +++ b/src/test/ui/asm/x86_64/parse-error.stderr @@ -64,11 +64,11 @@ error: argument to `sym` must be a path expression LL | asm!("{}", sym foo + bar); | ^^^^^^^^^ -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:31:26 | LL | asm!("", options(foo)); - | ^^^ expected one of 9 possible tokens + | ^^^ expected one of 10 possible tokens error: expected one of `)` or `,`, found `foo` --> $DIR/parse-error.rs:33:32 @@ -76,11 +76,11 @@ error: expected one of `)` or `,`, found `foo` LL | asm!("", options(nomem foo)); | ^^^ expected one of `)` or `,` -error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` +error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` --> $DIR/parse-error.rs:35:33 | LL | asm!("", options(nomem, foo)); - | ^^^ expected one of 9 possible tokens + | ^^^ expected one of 10 possible tokens error: arguments are not allowed after options --> $DIR/parse-error.rs:37:31 @@ -266,23 +266,23 @@ error: expected one of `,`, `.`, `?`, or an operator, found `FOO` LL | global_asm!("{}", const(reg) FOO); | ^^^ expected one of `,`, `.`, `?`, or an operator -error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `FOO` --> $DIR/parse-error.rs:102:25 | LL | global_asm!("", options(FOO)); - | ^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/parse-error.rs:104:25 | LL | global_asm!("", options(nomem FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` -error: expected one of `)`, `att_syntax`, or `raw`, found `nomem` +error: expected one of `)`, `att_syntax`, `may_unwind`, or `raw`, found `nomem` --> $DIR/parse-error.rs:106:25 | LL | global_asm!("", options(nomem, FOO)); - | ^^^^^ expected one of `)`, `att_syntax`, or `raw` + | ^^^^^ expected one of `)`, `att_syntax`, `may_unwind`, or `raw` error: arguments are not allowed after options --> $DIR/parse-error.rs:108:30 diff --git a/src/test/ui/associated-types/issue-59324.rs b/src/test/ui/associated-types/issue-59324.rs new file mode 100644 index 00000000000..9e68e9e7751 --- /dev/null +++ b/src/test/ui/associated-types/issue-59324.rs @@ -0,0 +1,26 @@ +trait NotFoo {} + +pub trait Foo: NotFoo { + type OnlyFoo; +} + +pub trait Service { + type AssocType; +} + +pub trait ThriftService<Bug: NotFoo>: +//~^ ERROR the trait bound `Bug: Foo` is not satisfied +//~| ERROR the trait bound `Bug: Foo` is not satisfied + Service<AssocType = <Bug as Foo>::OnlyFoo> +{ + fn get_service( + //~^ ERROR the trait bound `Bug: Foo` is not satisfied + //~| ERROR the trait bound `Bug: Foo` is not satisfied + &self, + ) -> Self::AssocType; +} + +fn with_factory<H>(factory: dyn ThriftService<()>) {} +//~^ ERROR the trait bound `(): Foo` is not satisfied + +fn main() {} diff --git a/src/test/ui/associated-types/issue-59324.stderr b/src/test/ui/associated-types/issue-59324.stderr new file mode 100644 index 00000000000..2f430d3055e --- /dev/null +++ b/src/test/ui/associated-types/issue-59324.stderr @@ -0,0 +1,69 @@ +error[E0277]: the trait bound `Bug: Foo` is not satisfied + --> $DIR/issue-59324.rs:11:1 + | +LL | / pub trait ThriftService<Bug: NotFoo>: +LL | | +LL | | +LL | | Service<AssocType = <Bug as Foo>::OnlyFoo> +... | +LL | | ) -> Self::AssocType; +LL | | } + | |_^ the trait `Foo` is not implemented for `Bug` + | +help: consider further restricting this bound + | +LL | pub trait ThriftService<Bug: NotFoo + Foo>: + | +++++ + +error[E0277]: the trait bound `Bug: Foo` is not satisfied + --> $DIR/issue-59324.rs:11:1 + | +LL | / pub trait ThriftService<Bug: NotFoo>: +LL | | +LL | | +LL | | Service<AssocType = <Bug as Foo>::OnlyFoo> +... | +LL | | ) -> Self::AssocType; +LL | | } + | |_^ the trait `Foo` is not implemented for `Bug` + | +help: consider further restricting this bound + | +LL | pub trait ThriftService<Bug: NotFoo + Foo>: + | +++++ + +error[E0277]: the trait bound `Bug: Foo` is not satisfied + --> $DIR/issue-59324.rs:16:5 + | +LL | / fn get_service( +LL | | +LL | | +LL | | &self, +LL | | ) -> Self::AssocType; + | |_________________________^ the trait `Foo` is not implemented for `Bug` + | +help: consider further restricting this bound + | +LL | pub trait ThriftService<Bug: NotFoo + Foo>: + | +++++ + +error[E0277]: the trait bound `Bug: Foo` is not satisfied + --> $DIR/issue-59324.rs:16:8 + | +LL | fn get_service( + | ^^^^^^^^^^^ the trait `Foo` is not implemented for `Bug` + | +help: consider further restricting this bound + | +LL | pub trait ThriftService<Bug: NotFoo + Foo>: + | +++++ + +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/issue-59324.rs:23:29 + | +LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} + | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/associated-types/issue-67684.rs b/src/test/ui/associated-types/issue-67684.rs new file mode 100644 index 00000000000..49efe8a1bda --- /dev/null +++ b/src/test/ui/associated-types/issue-67684.rs @@ -0,0 +1,62 @@ +// check-pass + +#![allow(dead_code)] + +trait ParseError { + type StreamError; +} + +impl<T> ParseError for T { + type StreamError = (); +} + +trait Stream { + type Item; + type Error: ParseError; +} + +trait Parser +where + <Self as Parser>::PartialState: Default, +{ + type PartialState; + fn parse_mode(_: &Self, _: Self::PartialState) { + loop {} + } +} + +impl Stream for () { + type Item = (); + type Error = (); +} + +impl Parser for () { + type PartialState = (); +} + +struct AndThen<A, B>(core::marker::PhantomData<(A, B)>); + +impl<A, B> Parser for AndThen<A, B> +where + A: Stream, + B: Into<<A::Error as ParseError>::StreamError>, +{ + type PartialState = (); +} + +fn expr<A>() -> impl Parser +where + A: Stream<Error = <A as Stream>::Item>, +{ + AndThen::<A, ()>(core::marker::PhantomData) +} + +fn parse_mode_impl<A>() +where + <A as Stream>::Error: ParseError, + A: Stream<Error = <A as Stream>::Item>, +{ + Parser::parse_mode(&expr::<A>(), Default::default()) +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-69398.rs b/src/test/ui/associated-types/issue-69398.rs new file mode 100644 index 00000000000..ca3d66b1c8e --- /dev/null +++ b/src/test/ui/associated-types/issue-69398.rs @@ -0,0 +1,21 @@ +// check-pass + +pub trait Foo { + type Bar; +} + +pub trait Broken { + type Assoc; + fn broken(&self) where Self::Assoc: Foo; +} + +impl<T> Broken for T { + type Assoc = (); + fn broken(&self) where Self::Assoc: Foo { + let _x: <Self::Assoc as Foo>::Bar; + } +} + +fn main() { + let _m: &dyn Broken<Assoc=()> = &(); +} diff --git a/src/test/ui/associated-types/issue-71113.rs b/src/test/ui/associated-types/issue-71113.rs new file mode 100644 index 00000000000..48de89127f4 --- /dev/null +++ b/src/test/ui/associated-types/issue-71113.rs @@ -0,0 +1,16 @@ +// check-pass + +use std::borrow::Cow; + +enum _Recursive<'a> +where + Self: ToOwned<Owned=Box<Self>> +{ + Variant(MyCow<'a, _Recursive<'a>>), +} + +pub struct Wrapper<T>(T); + +pub struct MyCow<'a, T: ToOwned<Owned=Box<T>> + 'a>(Wrapper<Cow<'a, T>>); + +fn main() {} diff --git a/src/test/ui/associated-types/issue-82079.rs b/src/test/ui/associated-types/issue-82079.rs new file mode 100644 index 00000000000..590c799c2d7 --- /dev/null +++ b/src/test/ui/associated-types/issue-82079.rs @@ -0,0 +1,121 @@ +// check-pass + +mod convenience_operators { + use crate::{Op, Relation}; + use std::ops::AddAssign; + use std::ops::Mul; + + impl<C: Op> Relation<C> { + pub fn map<F: Fn(C::D) -> D2 + 'static, D2: 'static>( + self, + f: F, + ) -> Relation<impl Op<D = D2, R = C::R>> { + self.map_dr(move |x, r| (f(x), r)) + } + } + + impl<K: 'static, V: 'static, C: Op<D = (K, V)>> Relation<C> { + pub fn semijoin<C2: Op<D = K, R = R2>, R2, R3: AddAssign<R3>>( + self, + other: Relation<C2>, + ) -> Relation<impl Op<D = C::D, R = R3>> + where + C::R: Mul<R2, Output = R3>, + { + self.join(other.map(|x| (x, ()))).map(|(k, x, ())| (k, x)) + } + } +} + +mod core { + mod operator { + mod join { + use super::Op; + use crate::core::Relation; + use std::ops::{AddAssign, Mul}; + struct Join<LC, RC> { + _left: LC, + _right: RC, + } + impl< + LC: Op<D = (K, LD), R = LR>, + RC: Op<D = (K, RD), R = RR>, + K: 'static, + LD: 'static, + LR: AddAssign<LR> + Mul<RR, Output = OR>, + RD: 'static, + RR: AddAssign<RR>, + OR: AddAssign<OR>, + > Op for Join<LC, RC> + { + type D = (K, LD, RD); + type R = OR; + } + impl<K: 'static, D: 'static, C: Op<D = (K, D)>> Relation<C> { + pub fn join<C2: Op<D = (K, D2)>, D2: 'static, OR: AddAssign<OR>>( + self, + other: Relation<C2>, + ) -> Relation<impl Op<D = (K, D, D2), R = OR>> + where + C::R: Mul<C2::R, Output = OR>, + { + Relation { + inner: Join { + _left: self.inner, + _right: other.inner, + }, + } + } + } + } + mod map { + use super::Op; + use crate::core::Relation; + use std::ops::AddAssign; + struct Map<C, MF> { + _inner: C, + _op: MF, + } + impl< + D1, + R1, + D2: 'static, + R2: AddAssign<R2>, + C: Op<D = D1, R = R1>, + MF: Fn(D1, R1) -> (D2, R2), + > Op for Map<C, MF> + { + type D = D2; + type R = R2; + } + impl<C: Op> Relation<C> { + pub fn map_dr<F: Fn(C::D, C::R) -> (D2, R2), D2: 'static, R2: AddAssign<R2>>( + self, + f: F, + ) -> Relation<impl Op<D = D2, R = R2>> { + Relation { + inner: Map { + _inner: self.inner, + _op: f, + }, + } + } + } + } + use std::ops::AddAssign; + pub trait Op { + type D: 'static; + type R: AddAssign<Self::R>; + } + } + pub use self::operator::Op; + #[derive(Clone)] + pub struct Relation<C> { + inner: C, + } +} + +use self::core::Op; +pub use self::core::Relation; + +fn main() {} diff --git a/src/test/ui/associated-types/issue-85103.rs b/src/test/ui/associated-types/issue-85103.rs new file mode 100644 index 00000000000..c5e13856178 --- /dev/null +++ b/src/test/ui/associated-types/issue-85103.rs @@ -0,0 +1,9 @@ +#![feature(rustc_attrs)] + +use std::borrow::Cow; + +#[rustc_layout(debug)] +type Edges<'a, E> = Cow<'a, [E]>; +//~^ ERROR layout error: NormalizationFailure + +fn main() {} diff --git a/src/test/ui/associated-types/issue-85103.stderr b/src/test/ui/associated-types/issue-85103.stderr new file mode 100644 index 00000000000..142f3c411ec --- /dev/null +++ b/src/test/ui/associated-types/issue-85103.stderr @@ -0,0 +1,8 @@ +error: layout error: NormalizationFailure(<[E] as std::borrow::ToOwned>::Owned, Type(<[E] as std::borrow::ToOwned>::Owned)) + --> $DIR/issue-85103.rs:6:1 + | +LL | type Edges<'a, E> = Cow<'a, [E]>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/associated-types/issue-88856.rs b/src/test/ui/associated-types/issue-88856.rs new file mode 100644 index 00000000000..7cae7c71cd2 --- /dev/null +++ b/src/test/ui/associated-types/issue-88856.rs @@ -0,0 +1,32 @@ +// check-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait Trait{ + type R; + fn func(self)->Self::R; +} + +pub struct TraitImpl<const N:usize>(pub i32); + +impl<const N:usize> Trait for TraitImpl<N> +where [();N/2]:, +{ + type R = Self; + fn func(self)->Self::R { + self + } +} + +fn sample<P,Convert>(p:P,f:Convert) -> i32 +where + P:Trait,Convert:Fn(P::R)->i32 +{ + f(p.func()) +} + +fn main() { + let t = TraitImpl::<10>(4); + sample(t,|x|x.0); +} diff --git a/src/test/ui/associated-types/issue-91231.rs b/src/test/ui/associated-types/issue-91231.rs new file mode 100644 index 00000000000..3c1cb81f097 --- /dev/null +++ b/src/test/ui/associated-types/issue-91231.rs @@ -0,0 +1,17 @@ +// check-pass + +#![feature(extern_types)] +#![allow(dead_code)] + +extern { + type Extern; +} + +trait Trait { + type Type; +} + +#[inline] +fn f<'a>(_: <&'a Extern as Trait>::Type) where &'a Extern: Trait {} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-91234.rs b/src/test/ui/associated-types/issue-91234.rs new file mode 100644 index 00000000000..2f6c2d3aebd --- /dev/null +++ b/src/test/ui/associated-types/issue-91234.rs @@ -0,0 +1,13 @@ +// check-pass + +struct Struct; + +trait Trait { + type Type; +} + +enum Enum<'a> where &'a Struct: Trait { + Variant(<&'a Struct as Trait>::Type) +} + +fn main() {} diff --git a/src/test/ui/ast-json/ast-json-noexpand-output.stdout b/src/test/ui/ast-json/ast-json-noexpand-output.stdout index 8961655ede3..22484ba6378 100644 --- a/src/test/ui/ast-json/ast-json-noexpand-output.stdout +++ b/src/test/ui/ast-json/ast-json-noexpand-output.stdout @@ -1 +1 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0}} +{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"is_placeholder":null} diff --git a/src/test/ui/ast-json/ast-json-output.stdout b/src/test/ui/ast-json/ast-json-output.stdout index 082f04134ce..ae56bef35ff 100644 --- a/src/test/ui/ast-json/ast-json-output.stdout +++ b/src/test/ui/ast-json/ast-json-output.stdout @@ -1 +1 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0}} +{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"is_placeholder":null} diff --git a/src/test/ui/async-await/async-error-span.stderr b/src/test/ui/async-await/async-error-span.stderr index 994bfd33ba4..2e3f8bb5256 100644 --- a/src/test/ui/async-await/async-error-span.stderr +++ b/src/test/ui/async-await/async-error-span.stderr @@ -5,6 +5,7 @@ LL | fn get_future() -> impl Future<Output = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited error[E0698]: type inside `async fn` body must be known in this context --> $DIR/async-error-span.rs:13:9 diff --git a/src/test/ui/async-await/async-fn-size-moved-locals.rs b/src/test/ui/async-await/async-fn-size-moved-locals.rs index 636fafc2bc4..a603ebd6e85 100644 --- a/src/test/ui/async-await/async-fn-size-moved-locals.rs +++ b/src/test/ui/async-await/async-fn-size-moved-locals.rs @@ -112,7 +112,7 @@ async fn mixed_sizes() { fn main() { assert_eq!(1025, std::mem::size_of_val(&single())); assert_eq!(1026, std::mem::size_of_val(&single_with_noop())); - assert_eq!(3078, std::mem::size_of_val(&joined())); - assert_eq!(3079, std::mem::size_of_val(&joined_with_noop())); - assert_eq!(7181, std::mem::size_of_val(&mixed_sizes())); + assert_eq!(3076, std::mem::size_of_val(&joined())); + assert_eq!(3076, std::mem::size_of_val(&joined_with_noop())); + assert_eq!(6157, std::mem::size_of_val(&mixed_sizes())); } diff --git a/src/test/ui/async-await/await-into-future.rs b/src/test/ui/async-await/await-into-future.rs new file mode 100644 index 00000000000..b74b1684440 --- /dev/null +++ b/src/test/ui/async-await/await-into-future.rs @@ -0,0 +1,30 @@ +// run-pass +// aux-build: issue-72470-lib.rs +// edition:2021 +#![feature(into_future)] + +extern crate issue_72470_lib; +use std::{future::{Future, IntoFuture}, pin::Pin}; + +struct AwaitMe; + +impl IntoFuture for AwaitMe { + type Output = i32; + type Future = Pin<Box<dyn Future<Output = i32>>>; + + fn into_future(self) -> Self::Future { + Box::pin(me()) + } +} + +async fn me() -> i32 { + 41 +} + +async fn run() { + assert_eq!(AwaitMe.await, 41); +} + +fn main() { + issue_72470_lib::run(run()); +} diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index eb24040404b..ab05251526b 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -25,6 +25,8 @@ LL | [1; ().await]; | ^^^^^^^^ `()` is not a future | = help: the trait `Future` is not implemented for `()` + = note: () must be a future or must implement `IntoFuture` to be awaited + = note: required because of the requirements on the impl of `IntoFuture` for `()` error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/issues/issue-60674.stdout b/src/test/ui/async-await/issues/issue-60674.stdout index 395d9e21b38..6f980e60664 100644 --- a/src/test/ui/async-await/issues/issue-60674.stdout +++ b/src/test/ui/async-await/issues/issue-60674.stdout @@ -1,3 +1,3 @@ -async fn f(mut x : u8) { } -async fn g((mut x, y, mut z) : (u8, u8, u8)) { } -async fn g(mut x : u8, (a, mut b, c) : (u8, u8, u8), y : u8) { } +async fn f(mut x : u8) {} +async fn g((mut x, y, mut z) : (u8, u8, u8)) {} +async fn g(mut x : u8, (a, mut b, c) : (u8, u8, u8), y : u8) {} diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index e2ea72a1e61..19d6f9bc438 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -34,6 +34,8 @@ LL | (|_| 2333).await; | ^^^^^^^^^^^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future | = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` + = note: [closure@$DIR/issue-62009-1.rs:12:5: 12:15] must be a future or must implement `IntoFuture` to be awaited + = note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` error: aborting due to 4 previous errors diff --git a/src/test/ui/async-await/unresolved_type_param.rs b/src/test/ui/async-await/unresolved_type_param.rs index d313691b388..85d868c2703 100644 --- a/src/test/ui/async-await/unresolved_type_param.rs +++ b/src/test/ui/async-await/unresolved_type_param.rs @@ -10,12 +10,20 @@ async fn foo() { //~^ ERROR type inside `async fn` body must be known in this context //~| ERROR type inside `async fn` body must be known in this context //~| ERROR type inside `async fn` body must be known in this context + //~| ERROR type inside `async fn` body must be known in this context + //~| ERROR type inside `async fn` body must be known in this context + //~| NOTE cannot infer type for type parameter `T` + //~| NOTE cannot infer type for type parameter `T` //~| NOTE cannot infer type for type parameter `T` //~| NOTE cannot infer type for type parameter `T` //~| NOTE cannot infer type for type parameter `T` //~| NOTE the type is part of the `async fn` body because of this `await` //~| NOTE the type is part of the `async fn` body because of this `await` //~| NOTE the type is part of the `async fn` body because of this `await` + //~| NOTE the type is part of the `async fn` body because of this `await` + //~| NOTE the type is part of the `async fn` body because of this `await` + //~| NOTE in this expansion of desugaring of `await` + //~| NOTE in this expansion of desugaring of `await` //~| NOTE in this expansion of desugaring of `await` //~| NOTE in this expansion of desugaring of `await` //~| NOTE in this expansion of desugaring of `await` diff --git a/src/test/ui/async-await/unresolved_type_param.stderr b/src/test/ui/async-await/unresolved_type_param.stderr index 6b9e960ca1a..130667a49c5 100644 --- a/src/test/ui/async-await/unresolved_type_param.stderr +++ b/src/test/ui/async-await/unresolved_type_param.stderr @@ -34,6 +34,30 @@ note: the type is part of the `async fn` body because of this `await` LL | bar().await; | ^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:9:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:9:5 + | +LL | bar().await; + | ^^^^^^^^^^^ + +error[E0698]: type inside `async fn` body must be known in this context + --> $DIR/unresolved_type_param.rs:9:5 + | +LL | bar().await; + | ^^^ cannot infer type for type parameter `T` declared on the function `bar` + | +note: the type is part of the `async fn` body because of this `await` + --> $DIR/unresolved_type_param.rs:9:5 + | +LL | bar().await; + | ^^^^^^^^^^^ + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0698`. diff --git a/src/test/ui/attributes/issue-90873.stderr b/src/test/ui/attributes/issue-90873.stderr index d466157f04e..2718b65108c 100644 --- a/src/test/ui/attributes/issue-90873.stderr +++ b/src/test/ui/attributes/issue-90873.stderr @@ -8,7 +8,7 @@ LL | #![u=||{static d=||1;}] | ^^^^^^^^^^^^^^^^^ error: unexpected token: `{ - impl std::ops::Neg for i8 { } + impl std::ops::Neg for i8 {} }` --> $DIR/issue-90873.rs:7:6 | diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr index 1cdcc18632c..10400cff5e5 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:19:46 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:17:46 | LL | pub fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:28:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:42:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:47:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:45:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:50:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:57:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:55:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr index 1cdcc18632c..10400cff5e5 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:19:46 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:17:46 | LL | pub fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:28:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:42:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:47:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:45:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:50:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:57:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:55:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs index 751a911a6bb..fe7ed8ed3fa 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs @@ -3,15 +3,13 @@ // looks at some parent. // revisions: migrate nll +//[nll]compile-flags: -Z borrowck=mir // Since we are testing nll (and migration) explicitly as a separate // revisions, don't worry about the --compare-mode=nll on this test. // ignore-compare-mode-nll -//[nll]compile-flags: -Z borrowck=mir - - // transcribed from borrowck-closures-unique.rs mod borrowck_closures_unique { pub fn e(x: &'static mut isize) { diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr deleted file mode 100644 index efd4e1a1716..00000000000 --- a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0506]: cannot assign to `greeting` because it is borrowed - --> $DIR/issue-58776-borrowck-scans-children.rs:11:5 - | -LL | let res = (|| (|| &greeting)())(); - | -- -------- borrow occurs due to use in closure - | | - | borrow of `greeting` occurs here -LL | -LL | greeting = "DEALLOCATED".to_string(); - | ^^^^^^^^ assignment to borrowed `greeting` occurs here -... -LL | println!("thread result: {:?}", res); - | --- borrow later used here - -error[E0505]: cannot move out of `greeting` because it is borrowed - --> $DIR/issue-58776-borrowck-scans-children.rs:14:10 - | -LL | let res = (|| (|| &greeting)())(); - | -- -------- borrow occurs due to use in closure - | | - | borrow of `greeting` occurs here -... -LL | drop(greeting); - | ^^^^^^^^ move out of `greeting` occurs here -... -LL | println!("thread result: {:?}", res); - | --- borrow later used here - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0505, E0506. -For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/cast/issue-88621.rs b/src/test/ui/cast/issue-88621.rs new file mode 100644 index 00000000000..9242b80e229 --- /dev/null +++ b/src/test/ui/cast/issue-88621.rs @@ -0,0 +1,13 @@ +#![feature(arbitrary_enum_discriminant)] + +#[repr(u8)] +enum Kind2 { + Foo() = 1, + Bar{} = 2, + Baz = 3, +} + +fn main() { + let _ = Kind2::Foo() as u8; + //~^ ERROR non-primitive cast +} diff --git a/src/test/ui/cast/issue-88621.stderr b/src/test/ui/cast/issue-88621.stderr new file mode 100644 index 00000000000..e96d8665152 --- /dev/null +++ b/src/test/ui/cast/issue-88621.stderr @@ -0,0 +1,9 @@ +error[E0605]: non-primitive cast: `Kind2` as `u8` + --> $DIR/issue-88621.rs:11:13 + | +LL | let _ = Kind2::Foo() as u8; + | ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0605`. diff --git a/src/test/ui/const-generics/defaults/pretty-printing-ast.stdout b/src/test/ui/const-generics/defaults/pretty-printing-ast.stdout index 1bceb8cbb94..9f65b8f25ba 100644 --- a/src/test/ui/const-generics/defaults/pretty-printing-ast.stdout +++ b/src/test/ui/const-generics/defaults/pretty-printing-ast.stdout @@ -11,9 +11,9 @@ use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -trait Foo<const KIND : bool = true> { } +trait Foo<const KIND : bool = true> {} -fn foo<const SIZE : usize = 5>() { } +fn foo<const SIZE : usize = 5>() {} struct Range<const FROM : usize = 0, const LEN : usize = 0, const TO : usize = FROM>; diff --git a/src/test/ui/const-generics/generic_const_exprs/closures.stderr b/src/test/ui/const-generics/generic_const_exprs/closures.stderr index 0dfd804be41..18010413b93 100644 --- a/src/test/ui/const-generics/generic_const_exprs/closures.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/closures.stderr @@ -4,7 +4,7 @@ error: overly complex generic constant LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ^^^^-------^^ | | - | dereferencing is not supported in generic constants + | borrowing is not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future diff --git a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs index b79bc262d2b..18f33acaabb 100644 --- a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs +++ b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs @@ -1,4 +1,3 @@ -// run-pass #![feature(generic_const_exprs)] #![allow(incomplete_features)] @@ -22,8 +21,11 @@ where } fn main() { - // Test that we can correctly infer `T` which requires evaluating - // `{ N + 1 }` which has substs containing an inference var + // FIXME(generic_const_exprs): We can't correctly infer `T` which requires + // evaluating `{ N + 1 }` which has substs containing an inference var let mut _q = Default::default(); + //~^ ERROR type annotations needed + _q = foo::<_, 2>(_q); + //~^ ERROR type annotations needed } diff --git a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr new file mode 100644 index 00000000000..e59f1ac8027 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.stderr @@ -0,0 +1,33 @@ +error[E0282]: type annotations needed + --> $DIR/const_eval_resolve_canonical.rs:26:9 + | +LL | let mut _q = Default::default(); + | ^^^^^^ consider giving `_q` a type + +error[E0283]: type annotations needed + --> $DIR/const_eval_resolve_canonical.rs:29:10 + | +LL | _q = foo::<_, 2>(_q); + | ^^^^^^^^^^^ cannot infer type + | +note: multiple `impl`s satisfying `(): Foo<{ N + 1 }>` found + --> $DIR/const_eval_resolve_canonical.rs:8:1 + | +LL | impl Foo<0> for () { + | ^^^^^^^^^^^^^^^^^^ +... +LL | impl Foo<3> for () { + | ^^^^^^^^^^^^^^^^^^ +note: required by a bound in `foo` + --> $DIR/const_eval_resolve_canonical.rs:18:9 + | +LL | fn foo<T, const N: usize>(_: T) -> <() as Foo<{ N + 1 }>>::Assoc + | --- required by a bound in this +LL | where +LL | (): Foo<{ N + 1 }>, + | ^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0282, E0283. +For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/issues/issue-83249.rs b/src/test/ui/const-generics/issues/issue-83249.rs new file mode 100644 index 00000000000..65148c55ee5 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-83249.rs @@ -0,0 +1,23 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +trait Foo { + const N: usize; +} + +impl Foo for u8 { + const N: usize = 1; +} + +fn foo<T: Foo>(_: [u8; T::N]) -> T { + todo!() +} + +pub fn bar() { + let _: u8 = foo([0; 1]); + + let _ = foo([0; 1]); + //~^ ERROR type annotations needed +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-83249.stderr b/src/test/ui/const-generics/issues/issue-83249.stderr new file mode 100644 index 00000000000..402b3aa2d61 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-83249.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/issue-83249.rs:19:13 + | +LL | let _ = foo([0; 1]); + | - ^^^ cannot infer type for type parameter `T` declared on the function `foo` + | | + | consider giving this pattern a type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/issues/issue-83288.rs b/src/test/ui/const-generics/issues/issue-83288.rs new file mode 100644 index 00000000000..a24596d242e --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-83288.rs @@ -0,0 +1,69 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +use std::{marker::PhantomData, ops::Mul}; + +pub enum Nil {} +pub struct Cons<T, L> { + _phantom: PhantomData<(T, L)>, +} + +pub trait Indices<const N: usize> { + const RANK: usize; + const NUM_ELEMS: usize; +} + +impl<const N: usize> Indices<N> for Nil { + const RANK: usize = 0; + const NUM_ELEMS: usize = 1; +} + +impl<T, I: Indices<N>, const N: usize> Indices<N> for Cons<T, I> { + const RANK: usize = I::RANK + 1; + const NUM_ELEMS: usize = I::NUM_ELEMS * N; +} + +pub trait Concat<J> { + type Output; +} + +impl<J> Concat<J> for Nil { + type Output = J; +} + +impl<T, I, J> Concat<J> for Cons<T, I> +where + I: Concat<J>, +{ + type Output = Cons<T, <I as Concat<J>>::Output>; +} + +pub struct Tensor<I: Indices<N>, const N: usize> +where + [u8; I::NUM_ELEMS]: Sized, +{ + pub data: [u8; I::NUM_ELEMS], + _phantom: PhantomData<I>, +} + +impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N> +where + I: Concat<J>, + <I as Concat<J>>::Output: Indices<N>, + [u8; I::NUM_ELEMS]: Sized, + [u8; J::NUM_ELEMS]: Sized, + [u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized, +{ + type Output = Tensor<<I as Concat<J>>::Output, N>; + + fn mul(self, _rhs: Tensor<J, N>) -> Self::Output { + Tensor { + data: [0u8; <I as Concat<J>>::Output::NUM_ELEMS], + _phantom: PhantomData, + } + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-87470.rs b/src/test/ui/const-generics/issues/issue-87470.rs new file mode 100644 index 00000000000..d60181a418a --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-87470.rs @@ -0,0 +1,24 @@ +// build-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait TraitWithConst { + const SOME_CONST: usize; +} + +pub trait OtherTrait: TraitWithConst { + fn some_fn(self) -> [u8 ; <Self as TraitWithConst>::SOME_CONST]; +} + +impl TraitWithConst for f32 { + const SOME_CONST: usize = 32; +} + +impl OtherTrait for f32 { + fn some_fn(self) -> [u8 ; <Self as TraitWithConst>::SOME_CONST] { + [0; 32] + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-87964.rs b/src/test/ui/const-generics/issues/issue-87964.rs new file mode 100644 index 00000000000..116686abb9e --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-87964.rs @@ -0,0 +1,29 @@ +// build-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait Target { + const LENGTH: usize; +} + + +pub struct Container<T: Target> +where + [(); T::LENGTH]: Sized, +{ + _target: T, +} + +impl<T: Target> Container<T> +where + [(); T::LENGTH]: Sized, +{ + pub fn start( + _target: T, + ) -> Container<T> { + Container { _target } + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-89146.rs b/src/test/ui/const-generics/issues/issue-89146.rs new file mode 100644 index 00000000000..e3540f46f1e --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-89146.rs @@ -0,0 +1,26 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +pub trait Foo { + const SIZE: usize; + + fn to_bytes(&self) -> [u8; Self::SIZE]; +} + +pub fn bar<G: Foo>(a: &G) -> u8 +where + [(); G::SIZE]: Sized, +{ + deeper_bar(a) +} + +fn deeper_bar<G: Foo>(a: &G) -> u8 +where + [(); G::SIZE]: Sized, +{ + a.to_bytes()[0] +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-89320.rs b/src/test/ui/const-generics/issues/issue-89320.rs new file mode 100644 index 00000000000..afa5c8fab74 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-89320.rs @@ -0,0 +1,19 @@ +// build-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait Enumerable { + const N: usize; +} + +#[derive(Clone)] +pub struct SymmetricGroup<S> +where + S: Enumerable, + [(); S::N]: Sized, +{ + _phantom: std::marker::PhantomData<S>, +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-90455.rs b/src/test/ui/const-generics/issues/issue-90455.rs new file mode 100644 index 00000000000..a580410cf37 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90455.rs @@ -0,0 +1,12 @@ +#![feature(generic_const_exprs, adt_const_params)] +#![allow(incomplete_features)] + +struct FieldElement<const N: &'static str> { + n: [u64; num_limbs(N)], + //~^ ERROR unconstrained generic constant +} +const fn num_limbs(_: &str) -> usize { + 0 +} + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-90455.stderr b/src/test/ui/const-generics/issues/issue-90455.stderr new file mode 100644 index 00000000000..724d7f42e69 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90455.stderr @@ -0,0 +1,10 @@ +error: unconstrained generic constant + --> $DIR/issue-90455.rs:5:8 + | +LL | n: [u64; num_limbs(N)], + | ^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); num_limbs(N)]:` + +error: aborting due to previous error + diff --git a/src/test/ui/consts/assert-type-intrinsics.rs b/src/test/ui/consts/assert-type-intrinsics.rs new file mode 100644 index 00000000000..31ff6aed03b --- /dev/null +++ b/src/test/ui/consts/assert-type-intrinsics.rs @@ -0,0 +1,22 @@ +// error-pattern: any use of this value will cause an error + +#![feature(never_type)] +#![feature(const_maybe_uninit_assume_init, const_assert_type2)] +#![feature(core_intrinsics)] + +use std::intrinsics; + +#[allow(invalid_value)] +fn main() { + use std::mem::MaybeUninit; + + const _BAD1: () = unsafe { + MaybeUninit::<!>::uninit().assume_init(); + }; + const _BAD2: () = unsafe { + intrinsics::assert_uninit_valid::<bool>(); + }; + const _BAD3: () = unsafe { + intrinsics::assert_zero_valid::<&'static i32>(); + }; +} diff --git a/src/test/ui/consts/assert-type-intrinsics.stderr b/src/test/ui/consts/assert-type-intrinsics.stderr new file mode 100644 index 00000000000..bb57ee82cc1 --- /dev/null +++ b/src/test/ui/consts/assert-type-intrinsics.stderr @@ -0,0 +1,39 @@ +error: any use of this value will cause an error + --> $DIR/assert-type-intrinsics.rs:14:9 + | +LL | / const _BAD1: () = unsafe { +LL | | MaybeUninit::<!>::uninit().assume_init(); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` +LL | | }; + | |______- + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error: any use of this value will cause an error + --> $DIR/assert-type-intrinsics.rs:17:9 + | +LL | / const _BAD2: () = unsafe { +LL | | intrinsics::assert_uninit_valid::<bool>(); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `bool` uninitialized, which is invalid +LL | | }; + | |______- + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error: any use of this value will cause an error + --> $DIR/assert-type-intrinsics.rs:20:9 + | +LL | / const _BAD3: () = unsafe { +LL | | intrinsics::assert_zero_valid::<&'static i32>(); + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `&i32`, which is invalid +LL | | }; + | |______- + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/consts/assume-type-intrinsics.rs b/src/test/ui/consts/assume-type-intrinsics.rs deleted file mode 100644 index 77370e1ccc5..00000000000 --- a/src/test/ui/consts/assume-type-intrinsics.rs +++ /dev/null @@ -1,13 +0,0 @@ -// error-pattern: any use of this value will cause an error - -#![feature(never_type)] -#![feature(const_maybe_uninit_assume_init)] - -#[allow(invalid_value)] -fn main() { - use std::mem::MaybeUninit; - - const _BAD: () = unsafe { - MaybeUninit::<!>::uninit().assume_init(); - }; -} diff --git a/src/test/ui/consts/assume-type-intrinsics.stderr b/src/test/ui/consts/assume-type-intrinsics.stderr deleted file mode 100644 index e660730396f..00000000000 --- a/src/test/ui/consts/assume-type-intrinsics.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: any use of this value will cause an error - --> $DIR/assume-type-intrinsics.rs:11:9 - | -LL | / const _BAD: () = unsafe { -LL | | MaybeUninit::<!>::uninit().assume_init(); - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!` -LL | | }; - | |______- - | - = note: `#[deny(const_err)]` on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> - -error: aborting due to previous error - diff --git a/src/test/ui/consts/drop_zst.rs b/src/test/ui/consts/drop_zst.rs new file mode 100644 index 00000000000..f7c70d3978b --- /dev/null +++ b/src/test/ui/consts/drop_zst.rs @@ -0,0 +1,17 @@ +// check-fail + +#![feature(const_precise_live_drops)] + +struct S; + +impl Drop for S { + fn drop(&mut self) { + println!("Hello!"); + } +} + +const fn foo() { + let s = S; //~ destructor +} + +fn main() {} diff --git a/src/test/ui/consts/drop_zst.stderr b/src/test/ui/consts/drop_zst.stderr new file mode 100644 index 00000000000..d4be5aa56d9 --- /dev/null +++ b/src/test/ui/consts/drop_zst.stderr @@ -0,0 +1,9 @@ +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/drop_zst.rs:14:9 + | +LL | let s = S; + | ^ constant functions cannot evaluate destructors + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0493`. diff --git a/src/test/ui/crate-loading/invalid-rlib.rs b/src/test/ui/crate-loading/invalid-rlib.rs index 77c29090a3e..aea861e3261 100644 --- a/src/test/ui/crate-loading/invalid-rlib.rs +++ b/src/test/ui/crate-loading/invalid-rlib.rs @@ -6,3 +6,5 @@ #![no_std] use ::foo; //~ ERROR invalid metadata files for crate `foo` //~| NOTE failed to mmap file +//~^^ ERROR invalid metadata files for crate `foo` +//~| NOTE failed to mmap file diff --git a/src/test/ui/crate-loading/invalid-rlib.stderr b/src/test/ui/crate-loading/invalid-rlib.stderr index b2c79f742fb..3c0d23bf7b4 100644 --- a/src/test/ui/crate-loading/invalid-rlib.stderr +++ b/src/test/ui/crate-loading/invalid-rlib.stderr @@ -6,6 +6,14 @@ LL | use ::foo; | = note: failed to mmap file 'auxiliary/libfoo.rlib' -error: aborting due to previous error +error[E0786]: found invalid metadata files for crate `foo` + --> $DIR/invalid-rlib.rs:7:7 + | +LL | use ::foo; + | ^^^ + | + = note: failed to mmap file 'auxiliary/libfoo.rlib' + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0786`. diff --git a/src/test/ui/crate-loading/missing-std.rs b/src/test/ui/crate-loading/missing-std.rs index 1a34c21ba54..400d9f6e0ba 100644 --- a/src/test/ui/crate-loading/missing-std.rs +++ b/src/test/ui/crate-loading/missing-std.rs @@ -1,6 +1,7 @@ // compile-flags: --target x86_64-unknown-uefi // needs-llvm-components: x86 // rustc-env:CARGO=/usr/bin/cargo +#![feature(no_core)] #![no_core] extern crate core; //~^ ERROR can't find crate for `core` diff --git a/src/test/ui/crate-loading/missing-std.stderr b/src/test/ui/crate-loading/missing-std.stderr index 25808efdfa6..70bcae1e0ed 100644 --- a/src/test/ui/crate-loading/missing-std.stderr +++ b/src/test/ui/crate-loading/missing-std.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `core` - --> $DIR/missing-std.rs:5:1 + --> $DIR/missing-std.rs:6:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ can't find crate @@ -8,6 +8,8 @@ LL | extern crate core; = help: consider downloading the target with `rustup target add x86_64-unknown-uefi` = help: consider building the standard library from source with `cargo build -Zbuild-std` -error: aborting due to previous error +error: requires `sized` lang_item + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui/derives/issue-36617.rs b/src/test/ui/derives/issue-36617.rs index 08fc82e91f6..08f293d2ebb 100644 --- a/src/test/ui/derives/issue-36617.rs +++ b/src/test/ui/derives/issue-36617.rs @@ -1,3 +1,16 @@ #![derive(Copy)] //~ ERROR cannot determine resolution for the attribute macro `derive` +//~^ ERROR `derive` attribute cannot be used at crate level + +#![test]//~ ERROR cannot determine resolution for the attribute macro `test` +//~^ ERROR `test` attribute cannot be used at crate level + +#![test_case]//~ ERROR cannot determine resolution for the attribute macro `test_case` +//~^ ERROR `test_case` attribute cannot be used at crate level + +#![bench]//~ ERROR cannot determine resolution for the attribute macro `bench` +//~^ ERROR `bench` attribute cannot be used at crate level + +#![global_allocator]//~ ERROR cannot determine resolution for the attribute macro `global_allocator` +//~^ ERROR `global_allocator` attribute cannot be used at crate level fn main() {} diff --git a/src/test/ui/derives/issue-36617.stderr b/src/test/ui/derives/issue-36617.stderr index 0716764b427..9cc0a29b065 100644 --- a/src/test/ui/derives/issue-36617.stderr +++ b/src/test/ui/derives/issue-36617.stderr @@ -6,5 +6,92 @@ LL | #![derive(Copy)] | = note: import resolution is stuck, try simplifying macro imports -error: aborting due to previous error +error: cannot determine resolution for the attribute macro `test` + --> $DIR/issue-36617.rs:4:4 + | +LL | #![test] + | ^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: cannot determine resolution for the attribute macro `test_case` + --> $DIR/issue-36617.rs:7:4 + | +LL | #![test_case] + | ^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: cannot determine resolution for the attribute macro `bench` + --> $DIR/issue-36617.rs:10:4 + | +LL | #![bench] + | ^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: cannot determine resolution for the attribute macro `global_allocator` + --> $DIR/issue-36617.rs:13:4 + | +LL | #![global_allocator] + | ^^^^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: `derive` attribute cannot be used at crate level + --> $DIR/issue-36617.rs:1:1 + | +LL | #![derive(Copy)] + | ^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[derive(Copy)] + | ~~~~~~~~~~~~~~~ + +error: `test` attribute cannot be used at crate level + --> $DIR/issue-36617.rs:4:1 + | +LL | #![test] + | ^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[test] + | ~~~~~~~ + +error: `test_case` attribute cannot be used at crate level + --> $DIR/issue-36617.rs:7:1 + | +LL | #![test_case] + | ^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[test_case] + | ~~~~~~~~~~~~ + +error: `bench` attribute cannot be used at crate level + --> $DIR/issue-36617.rs:10:1 + | +LL | #![bench] + | ^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[bench] + | ~~~~~~~~ + +error: `global_allocator` attribute cannot be used at crate level + --> $DIR/issue-36617.rs:13:1 + | +LL | #![global_allocator] + | ^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[global_allocator] + | ~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 10 previous errors diff --git a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs index 22c5332c925..ccc423e4a19 100644 --- a/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs +++ b/src/test/ui/enum-discriminant/arbitrary_enum_discriminant.rs @@ -22,14 +22,6 @@ impl Enum { } } -#[allow(dead_code)] -#[repr(u8)] -enum FieldlessEnum { - Unit = 3, - Tuple() = 2, - Struct {} = 1, -} - fn main() { const UNIT: Enum = Enum::Unit; const TUPLE: Enum = Enum::Tuple(5); @@ -48,9 +40,4 @@ fn main() { assert_eq!(3, UNIT_TAG); assert_eq!(2, TUPLE_TAG); assert_eq!(1, STRUCT_TAG); - - // Ensure `as` conversions are correct - assert_eq!(3, FieldlessEnum::Unit as u8); - assert_eq!(2, FieldlessEnum::Tuple() as u8); - assert_eq!(1, FieldlessEnum::Struct{} as u8); } diff --git a/src/test/ui/error-codes/E0161.edition.stderr b/src/test/ui/error-codes/E0161.edition.stderr index 1060675cd45..fb082bc1eab 100644 --- a/src/test/ui/error-codes/E0161.edition.stderr +++ b/src/test/ui/error-codes/E0161.edition.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined - --> $DIR/E0161.rs:29:5 + --> $DIR/E0161.rs:32:5 | LL | x.f(); | ^^^^^ diff --git a/src/test/ui/error-codes/E0161.migrate.stderr b/src/test/ui/error-codes/E0161.migrate.stderr index 1060675cd45..fb082bc1eab 100644 --- a/src/test/ui/error-codes/E0161.migrate.stderr +++ b/src/test/ui/error-codes/E0161.migrate.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined - --> $DIR/E0161.rs:29:5 + --> $DIR/E0161.rs:32:5 | LL | x.f(); | ^^^^^ diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr index 1060675cd45..fb082bc1eab 100644 --- a/src/test/ui/error-codes/E0161.nll.stderr +++ b/src/test/ui/error-codes/E0161.nll.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined - --> $DIR/E0161.rs:29:5 + --> $DIR/E0161.rs:32:5 | LL | x.f(); | ^^^^^ diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index ba74529e4b6..f3a7b68c7cf 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -1,5 +1,3 @@ -// ignore-compare-mode-nll - // Check that E0161 is a hard error in all possible configurations that might // affect it. @@ -13,6 +11,11 @@ //[zflagsul] check-pass //[editionul] check-pass +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + #![allow(incomplete_features)] #![cfg_attr(nll, feature(nll))] #![cfg_attr(nllul, feature(nll))] diff --git a/src/test/ui/error-codes/E0161.zflags.stderr b/src/test/ui/error-codes/E0161.zflags.stderr index 1060675cd45..fb082bc1eab 100644 --- a/src/test/ui/error-codes/E0161.zflags.stderr +++ b/src/test/ui/error-codes/E0161.zflags.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined - --> $DIR/E0161.rs:29:5 + --> $DIR/E0161.rs:32:5 | LL | x.f(); | ^^^^^ diff --git a/src/test/ui/expr/if/if-without-block.stderr b/src/test/ui/expr/if/if-without-block.stderr index ee2bb62e2bb..d3f6ca07617 100644 --- a/src/test/ui/expr/if/if-without-block.stderr +++ b/src/test/ui/expr/if/if-without-block.stderr @@ -7,7 +7,11 @@ LL | if 5 == { LL | } | ^ expected `{` | - = help: maybe you forgot the right operand of the condition? +help: maybe you forgot the right operand of the condition? + --> $DIR/if-without-block.rs:3:10 + | +LL | if 5 == { + | ^^ error: aborting due to previous error diff --git a/src/test/ui/extern-flag/empty-extern-arg.rs b/src/test/ui/extern-flag/empty-extern-arg.rs index d3cb5aaaeba..3170537b0e0 100644 --- a/src/test/ui/extern-flag/empty-extern-arg.rs +++ b/src/test/ui/extern-flag/empty-extern-arg.rs @@ -1,4 +1,6 @@ // compile-flags: --extern std= // error-pattern: extern location for std does not exist +// needs-unwind since it affects the error output +// ignore-emscripten compiled with panic=abort, personality not required fn main() {} diff --git a/src/test/ui/extern-flag/empty-extern-arg.stderr b/src/test/ui/extern-flag/empty-extern-arg.stderr index 199c4fb616b..b0628a4f6dd 100644 --- a/src/test/ui/extern-flag/empty-extern-arg.stderr +++ b/src/test/ui/extern-flag/empty-extern-arg.stderr @@ -1,4 +1,8 @@ error: extern location for std does not exist: -error: aborting due to previous error +error: language item required, but not found: `eh_personality` + +error: `#[panic_handler]` function required, but not found + +error: aborting due to 3 previous errors diff --git a/src/test/ui/extern/extern-crate-multiple-missing.rs b/src/test/ui/extern/extern-crate-multiple-missing.rs new file mode 100644 index 00000000000..a6560ca7862 --- /dev/null +++ b/src/test/ui/extern/extern-crate-multiple-missing.rs @@ -0,0 +1,10 @@ +// If multiple `extern crate` resolutions fail each of them should produce an error +extern crate bar; //~ ERROR can't find crate for `bar` +extern crate foo; //~ ERROR can't find crate for `foo` + +fn main() { + // If the crate name introduced by `extern crate` failed to resolve then subsequent + // derived paths do not emit additional errors + foo::something(); + bar::something(); +} diff --git a/src/test/ui/extern/extern-crate-multiple-missing.stderr b/src/test/ui/extern/extern-crate-multiple-missing.stderr new file mode 100644 index 00000000000..893bb4fb26d --- /dev/null +++ b/src/test/ui/extern/extern-crate-multiple-missing.stderr @@ -0,0 +1,15 @@ +error[E0463]: can't find crate for `bar` + --> $DIR/extern-crate-multiple-missing.rs:2:1 + | +LL | extern crate bar; + | ^^^^^^^^^^^^^^^^^ can't find crate + +error[E0463]: can't find crate for `foo` + --> $DIR/extern-crate-multiple-missing.rs:3:1 + | +LL | extern crate foo; + | ^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui/feature-gates/feature-gate-asm_unwind.rs b/src/test/ui/feature-gates/feature-gate-asm_unwind.rs new file mode 100644 index 00000000000..c9957ff91d5 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-asm_unwind.rs @@ -0,0 +1,10 @@ +// only-x86_64 + +#![feature(asm)] + +fn main() { + unsafe { + asm!("", options(may_unwind)); + //~^ ERROR the `may_unwind` option is unstable + } +} diff --git a/src/test/ui/feature-gates/feature-gate-asm_unwind.stderr b/src/test/ui/feature-gates/feature-gate-asm_unwind.stderr new file mode 100644 index 00000000000..6b5bf286e7b --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-asm_unwind.stderr @@ -0,0 +1,12 @@ +error[E0658]: the `may_unwind` option is unstable + --> $DIR/feature-gate-asm_unwind.rs:7:9 + | +LL | asm!("", options(may_unwind)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #72016 <https://github.com/rust-lang/rust/issues/72016> for more information + = help: add `#![feature(asm_unwind)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-bench.rs b/src/test/ui/feature-gates/issue-43106-gating-of-bench.rs index 31eee88d1fa..796325b79af 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-bench.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-bench.rs @@ -6,5 +6,5 @@ #![bench = "4100"] //~^ ERROR cannot determine resolution for the attribute macro `bench` - +//~^^ ERROR `bench` attribute cannot be used at crate level fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-bench.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-bench.stderr index d0305c5160f..6b332211942 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-bench.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-bench.stderr @@ -6,5 +6,16 @@ LL | #![bench = "4100"] | = note: import resolution is stuck, try simplifying macro imports -error: aborting due to previous error +error: `bench` attribute cannot be used at crate level + --> $DIR/issue-43106-gating-of-bench.rs:7:1 + | +LL | #![bench = "4100"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[bench = "4100"] + | + +error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index 9e2e2d4137d..f94ec7d4704 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -129,36 +129,66 @@ error: `macro_export` attribute cannot be used at crate level | LL | #![macro_export] | ^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[macro_export] + | error: `rustc_main` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:14:1 | LL | #![rustc_main] | ^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[rustc_main] + | ~~~~~~~~~~~~~ error: `start` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1 | LL | #![start] | ^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[start] + | error: `repr` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:18:1 | LL | #![repr()] | ^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[repr()] + | error: `path` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:20:1 | LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[path = "3800"] + | error: `automatically_derived` attribute cannot be used at crate level --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:22:1 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[automatically_derived] + | error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:17 diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-test.rs b/src/test/ui/feature-gates/issue-43106-gating-of-test.rs index ee3fe712e36..39835c9268e 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-test.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-test.rs @@ -3,5 +3,5 @@ #![allow(soft_unstable)] #![test = "4200"] //~^ ERROR cannot determine resolution for the attribute macro `test` - +//~^^ ERROR `test` attribute cannot be used at crate level fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-test.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-test.stderr index 335af5e7905..300a9966dd8 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-test.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-test.stderr @@ -6,5 +6,16 @@ LL | #![test = "4200"] | = note: import resolution is stuck, try simplifying macro imports -error: aborting due to previous error +error: `test` attribute cannot be used at crate level + --> $DIR/issue-43106-gating-of-test.rs:4:1 + | +LL | #![test = "4200"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[test = "4200"] + | + +error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/thread-local-const-init.rs b/src/test/ui/feature-gates/thread-local-const-init.rs deleted file mode 100644 index 6584ffa7cf9..00000000000 --- a/src/test/ui/feature-gates/thread-local-const-init.rs +++ /dev/null @@ -1,4 +0,0 @@ -thread_local!(static X: u32 = const { 0 }); -//~^ ERROR: use of unstable library feature 'thread_local_const_init' - -fn main() {} diff --git a/src/test/ui/feature-gates/thread-local-const-init.stderr b/src/test/ui/feature-gates/thread-local-const-init.stderr deleted file mode 100644 index f80506831b4..00000000000 --- a/src/test/ui/feature-gates/thread-local-const-init.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: use of unstable library feature 'thread_local_const_init' - --> $DIR/thread-local-const-init.rs:1:1 - | -LL | thread_local!(static X: u32 = const { 0 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #84223 <https://github.com/rust-lang/rust/issues/84223> for more information - = help: add `#![feature(thread_local_const_init)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs new file mode 100644 index 00000000000..5a92bcd37b6 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type-2.rs @@ -0,0 +1,22 @@ +// check-pass + +trait Trait { + type Type; +} + +impl<T> Trait for T { + type Type = (); +} + +fn f<'a, 'b>(_: <&'a &'b () as Trait>::Type) +where + 'a: 'a, + 'b: 'b, +{ +} + +fn g<'a, 'b>() { + f::<'a, 'b>(()); +} + +fn main() {} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr new file mode 100644 index 00000000000..e37ec7f2665 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.stderr @@ -0,0 +1,14 @@ +error: lifetime may not live long enough + --> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 + | +LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | s + | ^ returning this value requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + +error: aborting due to previous error + diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs new file mode 100644 index 00000000000..2e5ac7d7398 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.rs @@ -0,0 +1,22 @@ +// check-fail +// See issue #91068. Types in the substs of an associated type can't be implied +// to be WF, since they don't actually have to be constructed. + +trait Trait { + type Type; +} + +impl<T> Trait for T { + type Type = (); +} + +fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + s //~ ERROR lifetime mismatch [E0623] +} + +fn main() { + let x = String::from("Hello World!"); + let y = f(&x, ()); + drop(x); + println!("{}", y); +} diff --git a/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr new file mode 100644 index 00000000000..93ab5dceee9 --- /dev/null +++ b/src/test/ui/fn/implied-bounds-unnorm-associated-type.stderr @@ -0,0 +1,13 @@ +error[E0623]: lifetime mismatch + --> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 + | +LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { + | ------- ---------- + | | + | these two types are declared with different lifetimes... +LL | s + | ^ ...but data from `s` flows here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/generator/issue-91477.rs b/src/test/ui/generator/issue-91477.rs new file mode 100644 index 00000000000..6c027feb422 --- /dev/null +++ b/src/test/ui/generator/issue-91477.rs @@ -0,0 +1,7 @@ +#![feature(generators)] + +fn foo() -> impl Sized { + yield 1; //~ ERROR E0627 +} + +fn main() {} diff --git a/src/test/ui/generator/issue-91477.stderr b/src/test/ui/generator/issue-91477.stderr new file mode 100644 index 00000000000..4597dc1bcdf --- /dev/null +++ b/src/test/ui/generator/issue-91477.stderr @@ -0,0 +1,9 @@ +error[E0627]: yield expression outside of generator literal + --> $DIR/issue-91477.rs:4:5 + | +LL | yield 1; + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0627`. diff --git a/src/test/ui/generic-associated-types/issue-87748.rs b/src/test/ui/generic-associated-types/issue-87748.rs deleted file mode 100644 index 93c3b3937cb..00000000000 --- a/src/test/ui/generic-associated-types/issue-87748.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Checks that we properly add implied bounds from unnormalized projections in -// inputs when typechecking functions. - -// check-pass - -#![feature(generic_associated_types)] - -trait MyTrait { - type Assoc<'a, 'b> where 'b: 'a; - fn do_sth(arg: Self::Assoc<'_, '_>); -} - -struct A; -struct B; -struct C; - -impl MyTrait for A { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: u32) {} -} -impl MyTrait for B { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: Self::Assoc<'_, '_>) {} -} -impl MyTrait for C { - type Assoc<'a, 'b> where 'b: 'a = u32; - fn do_sth(_: Self::Assoc<'static, 'static>) {} -} - -fn main () {} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr index 119cec1fa95..7da6b029c26 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.migrate.stderr @@ -1,5 +1,5 @@ error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:52:5 + --> $DIR/issue-71955.rs:57:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -8,7 +8,7 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:52:5 + --> $DIR/issue-71955.rs:57:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -17,7 +17,7 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:52:5 + --> $DIR/issue-71955.rs:57:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -26,7 +26,7 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:52:5 + --> $DIR/issue-71955.rs:57:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -35,7 +35,7 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:52:5 + --> $DIR/issue-71955.rs:57:5 | LL | foo(bar, "string", |s| s.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -44,7 +44,7 @@ LL | foo(bar, "string", |s| s.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:63:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -53,7 +53,7 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:63:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -62,7 +62,7 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:63:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -71,7 +71,7 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:63:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^ implementation of `Parser` is not general enough @@ -80,7 +80,7 @@ LL | foo(baz, "string", |s| s.0.len() == 5); = note: ...but it actually implements `Parser<'1>`, for some specific lifetime `'1` error: implementation of `Parser` is not general enough - --> $DIR/issue-71955.rs:58:5 + --> $DIR/issue-71955.rs:63:5 | LL | foo(baz, "string", |s| s.0.len() == 5); | ^^^ implementation of `Parser` is not general enough diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr index 69ab446bc7a..c2feaa91280 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.nll.stderr @@ -1,5 +1,5 @@ error: fatal error triggered by #[rustc_error] - --> $DIR/issue-71955.rs:42:1 + --> $DIR/issue-71955.rs:47:1 | LL | fn main() { | ^^^^^^^^^ diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs index 95e3b3d4e1b..3d6778b6942 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.rs @@ -3,6 +3,11 @@ // [nll]compile-flags: -Zborrowck=mir // check-fail +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + #![feature(rustc_attrs)] trait Parser<'s> { diff --git a/src/test/ui/hrtb/issue-30786.migrate.stderr b/src/test/ui/hrtb/issue-30786.migrate.stderr index a497c6257da..a2ab1f1856d 100644 --- a/src/test/ui/hrtb/issue-30786.migrate.stderr +++ b/src/test/ui/hrtb/issue-30786.migrate.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:128:22 +error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:127:22 | LL | pub struct Map<S, F> { | -------------------- @@ -8,19 +8,19 @@ LL | pub struct Map<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: - `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - --> $DIR/issue-30786.rs:106:9 + `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + --> $DIR/issue-30786.rs:105:9 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | ^^^^^^^^^ ^ -error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:141:24 +error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:140:24 | LL | pub struct Filter<S, F> { | ----------------------- @@ -29,13 +29,13 @@ LL | pub struct Filter<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds + | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: - `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - --> $DIR/issue-30786.rs:106:9 + `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + --> $DIR/issue-30786.rs:105:9 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | ^^^^^^^^^ ^ diff --git a/src/test/ui/hrtb/issue-30786.nll.stderr b/src/test/ui/hrtb/issue-30786.nll.stderr index a497c6257da..a2ab1f1856d 100644 --- a/src/test/ui/hrtb/issue-30786.nll.stderr +++ b/src/test/ui/hrtb/issue-30786.nll.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:128:22 +error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:127:22 | LL | pub struct Map<S, F> { | -------------------- @@ -8,19 +8,19 @@ LL | pub struct Map<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: - `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:127:27: 127:36]>: Stream` - --> $DIR/issue-30786.rs:106:9 + `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` + --> $DIR/issue-30786.rs:105:9 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | ^^^^^^^^^ ^ -error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:141:24 +error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:140:24 | LL | pub struct Filter<S, F> { | ----------------------- @@ -29,13 +29,13 @@ LL | pub struct Filter<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>` due to unsatisfied trait bounds + | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied because of the requirements of the implementation of `StreamExt` for `_`: - `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:140:30: 140:42]>: Stream` - --> $DIR/issue-30786.rs:106:9 + `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` + --> $DIR/issue-30786.rs:105:9 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | ^^^^^^^^^ ^ diff --git a/src/test/ui/hrtb/issue-30786.rs b/src/test/ui/hrtb/issue-30786.rs index 278c5441ecf..540c26c358b 100644 --- a/src/test/ui/hrtb/issue-30786.rs +++ b/src/test/ui/hrtb/issue-30786.rs @@ -7,6 +7,7 @@ // through again. // revisions: migrate nll +//[nll]compile-flags: -Z borrowck=mir // Since we are testing nll (and migration) explicitly as a separate // revisions, don't worry about the --compare-mode=nll on this test. @@ -14,8 +15,6 @@ // ignore-compare-mode-nll // ignore-compare-mode-polonius -//[nll]compile-flags: -Z borrowck=mir - pub trait Stream { type Item; fn next(self) -> Option<Self::Item>; diff --git a/src/test/ui/hygiene/unpretty-debug.stdout b/src/test/ui/hygiene/unpretty-debug.stdout index ffb9f9eed41..51c21043db8 100644 --- a/src/test/ui/hygiene/unpretty-debug.stdout +++ b/src/test/ui/hygiene/unpretty-debug.stdout @@ -15,7 +15,7 @@ fn bar /* 0#0 */() { y /* 0#1 */ + x /* 0#0 */ } -fn y /* 0#0 */() { } +fn y /* 0#0 */() {} /* Expansions: diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index 8f369f1b038..127765727b4 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -2,7 +2,12 @@ error: `extern crate self;` requires renaming --> $DIR/extern-crate-self-fail.rs:1:1 | LL | extern crate self; - | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` + | ^^^^^^^^^^^^^^^^^^ + | +help: rename the `self` crate to be able to import it + | +LL | extern crate self as name; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `#[macro_use]` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 diff --git a/src/test/ui/imports/issue-28134.rs b/src/test/ui/imports/issue-28134.rs index 1ed2d330b51..ef2a5d634a6 100644 --- a/src/test/ui/imports/issue-28134.rs +++ b/src/test/ui/imports/issue-28134.rs @@ -2,3 +2,4 @@ #![allow(soft_unstable)] #![test] //~ ERROR cannot determine resolution for the attribute macro `test` +//~^ ERROR 4:1: 4:9: `test` attribute cannot be used at crate level diff --git a/src/test/ui/imports/issue-28134.stderr b/src/test/ui/imports/issue-28134.stderr index 8ed4d015f32..33cb53f202a 100644 --- a/src/test/ui/imports/issue-28134.stderr +++ b/src/test/ui/imports/issue-28134.stderr @@ -6,5 +6,16 @@ LL | #![test] | = note: import resolution is stuck, try simplifying macro imports -error: aborting due to previous error +error: `test` attribute cannot be used at crate level + --> $DIR/issue-28134.rs:4:1 + | +LL | #![test] + | ^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[test] + | ~~~~~~~ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed index 2998f05efba..87a79b88137 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed @@ -5,23 +5,24 @@ #![deny(elided_lifetimes_in_paths)] //~^ NOTE the lint level is defined here -use std::cell::{RefCell, Ref}; +use std::cell::{Ref, RefCell}; - -struct Foo<'a> { x: &'a u32 } +struct Foo<'a> { + x: &'a u32, +} fn foo(x: &Foo<'_>) { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime } fn bar(x: &Foo<'_>) {} - struct Wrapped<'a>(&'a str); struct WrappedWithBow<'a> { - gift: &'a str + gift: &'a str, } struct MatchedSet<'a, 'b> { @@ -31,22 +32,34 @@ struct MatchedSet<'a, 'b> { fn wrap_gift(gift: &str) -> Wrapped<'_> { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime Wrapped(gift) } fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow<'_> { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime WrappedWithBow { gift } } fn inspect_matched_set(set: MatchedSet<'_, '_>) { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected 2 lifetime parameters + //~| HELP consider using the `'_` lifetime println!("{} {}", set.one, set.another); } +// Verify that the lint does not fire, because the added `'_` wouldn't be resolved correctly. +fn match_sets() -> MatchedSet<'static, 'static> { + //~^ ERROR missing lifetime specifiers + //~| NOTE expected 2 lifetime parameters + //~| HELP this function's return type contains a borrowed value + //~| HELP consider using the `'static` lifetime + MatchedSet { one: "one", another: "another" } +} + macro_rules! autowrapper { ($type_name:ident, $fn_name:ident, $lt:lifetime) => { struct $type_name<$lt> { @@ -55,7 +68,11 @@ macro_rules! autowrapper { fn $fn_name(gift: &str) -> $type_name<'_> { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime + //~| ERROR hidden lifetime parameters in types are deprecated + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime $type_name { gift } } } @@ -65,19 +82,34 @@ autowrapper!(Autowrapped, autowrap_gift, 'a); //~^ NOTE in this expansion of autowrapper! //~| NOTE in this expansion of autowrapper! +// Verify that rustfix does not try to apply the fix twice. +autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); +//~^ NOTE in this expansion of autowrapper! +//~| NOTE in this expansion of autowrapper! + macro_rules! anytuple_ref_ty { ($($types:ty),*) => { Ref<'_, ($($types),*)> //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime } } +#[allow(elided_lifetimes_in_paths)] +mod blah { + struct Thing<'a>(&'a i32); + struct Bar<T>(T); + + fn foo(b: Bar<Thing>) {} +} + fn main() { let honesty = RefCell::new((4, 'e')); let loyalty: Ref<'_, (u32, char)> = honesty.borrow(); //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime let generosity = Ref::map(loyalty, |t| &t.0); let laughter = RefCell::new((true, "magic")); diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs index b729a15a29e..28323a22427 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs @@ -5,23 +5,24 @@ #![deny(elided_lifetimes_in_paths)] //~^ NOTE the lint level is defined here -use std::cell::{RefCell, Ref}; +use std::cell::{Ref, RefCell}; - -struct Foo<'a> { x: &'a u32 } +struct Foo<'a> { + x: &'a u32, +} fn foo(x: &Foo) { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime } fn bar(x: &Foo<'_>) {} - struct Wrapped<'a>(&'a str); struct WrappedWithBow<'a> { - gift: &'a str + gift: &'a str, } struct MatchedSet<'a, 'b> { @@ -31,22 +32,34 @@ struct MatchedSet<'a, 'b> { fn wrap_gift(gift: &str) -> Wrapped { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime Wrapped(gift) } fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime WrappedWithBow { gift } } fn inspect_matched_set(set: MatchedSet) { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected 2 lifetime parameters + //~| HELP consider using the `'_` lifetime println!("{} {}", set.one, set.another); } +// Verify that the lint does not fire, because the added `'_` wouldn't be resolved correctly. +fn match_sets() -> MatchedSet { + //~^ ERROR missing lifetime specifiers + //~| NOTE expected 2 lifetime parameters + //~| HELP this function's return type contains a borrowed value + //~| HELP consider using the `'static` lifetime + MatchedSet { one: "one", another: "another" } +} + macro_rules! autowrapper { ($type_name:ident, $fn_name:ident, $lt:lifetime) => { struct $type_name<$lt> { @@ -55,7 +68,11 @@ macro_rules! autowrapper { fn $fn_name(gift: &str) -> $type_name { //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime + //~| ERROR hidden lifetime parameters in types are deprecated + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime $type_name { gift } } } @@ -65,19 +82,34 @@ autowrapper!(Autowrapped, autowrap_gift, 'a); //~^ NOTE in this expansion of autowrapper! //~| NOTE in this expansion of autowrapper! +// Verify that rustfix does not try to apply the fix twice. +autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); +//~^ NOTE in this expansion of autowrapper! +//~| NOTE in this expansion of autowrapper! + macro_rules! anytuple_ref_ty { ($($types:ty),*) => { Ref<($($types),*)> //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime } } +#[allow(elided_lifetimes_in_paths)] +mod blah { + struct Thing<'a>(&'a i32); + struct Bar<T>(T); + + fn foo(b: Bar<Thing>) {} +} + fn main() { let honesty = RefCell::new((4, 'e')); let loyalty: Ref<(u32, char)> = honesty.borrow(); //~^ ERROR hidden lifetime parameters in types are deprecated - //~| HELP indicate the anonymous lifetime + //~| NOTE expected named lifetime parameter + //~| HELP consider using the `'_` lifetime let generosity = Ref::map(loyalty, |t| &t.0); let laughter = RefCell::new((true, "magic")); diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr index 037ce401b3c..2e65461b321 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr @@ -1,60 +1,120 @@ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:13:12 + --> $DIR/elided-lifetimes.rs:14:12 | LL | fn foo(x: &Foo) { - | ^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^ expected named lifetime parameter | note: the lint level is defined here --> $DIR/elided-lifetimes.rs:5:9 | LL | #![deny(elided_lifetimes_in_paths)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider using the `'_` lifetime + | +LL | fn foo(x: &Foo<'_>) { + | ~~~~~~~ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:32:29 + --> $DIR/elided-lifetimes.rs:33:29 | LL | fn wrap_gift(gift: &str) -> Wrapped { - | ^^^^^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^^^^^ expected named lifetime parameter + | +help: consider using the `'_` lifetime + | +LL | fn wrap_gift(gift: &str) -> Wrapped<'_> { + | ~~~~~~~~~~~ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:38:38 + --> $DIR/elided-lifetimes.rs:40:38 | LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { - | ^^^^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^^^^^^^^^^^^ expected named lifetime parameter + | +help: consider using the `'_` lifetime + | +LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow<'_> { + | ~~~~~~~~~~~~~~~~~~ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:44:29 + --> $DIR/elided-lifetimes.rs:47:29 | LL | fn inspect_matched_set(set: MatchedSet) { - | ^^^^^^^^^^- help: indicate the anonymous lifetimes: `<'_, '_>` + | ^^^^^^^^^^ expected 2 lifetime parameters + | +help: consider using the `'_` lifetime + | +LL | fn inspect_matched_set(set: MatchedSet<'_, '_>) { + | ~~~~~~~~~~~~~~~~~~ + +error[E0106]: missing lifetime specifiers + --> $DIR/elided-lifetimes.rs:55:20 + | +LL | fn match_sets() -> MatchedSet { + | ^^^^^^^^^^ expected 2 lifetime parameters + | + = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from +help: consider using the `'static` lifetime + | +LL | fn match_sets() -> MatchedSet<'static, 'static> { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:56:36 + --> $DIR/elided-lifetimes.rs:69:36 | LL | fn $fn_name(gift: &str) -> $type_name { - | ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^^^^^^^^ expected named lifetime parameter ... LL | autowrapper!(Autowrapped, autowrap_gift, 'a); | -------------------------------------------- in this macro invocation | = note: this error originates in the macro `autowrapper` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using the `'_` lifetime + | +LL | fn $fn_name(gift: &str) -> $type_name<'_> { + | ~~~~~~~~~~~~~~ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:78:18 + --> $DIR/elided-lifetimes.rs:69:36 + | +LL | fn $fn_name(gift: &str) -> $type_name { + | ^^^^^^^^^^ expected named lifetime parameter +... +LL | autowrapper!(AutowrappedAgain, autowrap_gift_again, 'a); + | ------------------------------------------------------- in this macro invocation + | + = note: this error originates in the macro `autowrapper` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using the `'_` lifetime + | +LL | fn $fn_name(gift: &str) -> $type_name<'_> { + | ~~~~~~~~~~~~~~ + +error: hidden lifetime parameters in types are deprecated + --> $DIR/elided-lifetimes.rs:109:22 | LL | let loyalty: Ref<(u32, char)> = honesty.borrow(); - | ^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, (u32, char)>` + | ^ expected named lifetime parameter + | +help: consider using the `'_` lifetime + | +LL | let loyalty: Ref<'_, (u32, char)> = honesty.borrow(); + | +++ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:70:9 + --> $DIR/elided-lifetimes.rs:92:13 | LL | Ref<($($types),*)> - | ^^^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, ($($types),*)>` + | ^ expected named lifetime parameter ... LL | let yellow: anytuple_ref_ty!(bool, &str) = laughter.borrow(); | ---------------------------- in this macro invocation | = note: this error originates in the macro `anytuple_ref_ty` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using the `'_` lifetime + | +LL | Ref<'_, ($($types),*)> + | +++ -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/issues-71798.stderr b/src/test/ui/issues-71798.stderr index bbcdd3e37a9..bc4dc9ebf9e 100644 --- a/src/test/ui/issues-71798.stderr +++ b/src/test/ui/issues-71798.stderr @@ -11,6 +11,7 @@ LL | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future | = help: the trait `Future` is not implemented for `u32` + = note: u32 must be a future or must implement `IntoFuture` to be awaited error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-37131.stderr b/src/test/ui/issues/issue-37131.stderr index b45574f0c49..9ecae3e7a2b 100644 --- a/src/test/ui/issues/issue-37131.stderr +++ b/src/test/ui/issues/issue-37131.stderr @@ -4,6 +4,8 @@ error[E0463]: can't find crate for `std` = help: consider downloading the target with `rustup target add thumbv6m-none-eabi` = help: consider building the standard library from source with `cargo build -Zbuild-std` -error: aborting due to previous error +error: requires `sized` lang_item + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr index e53a543f3a0..cdf1f0dfc53 100644 --- a/src/test/ui/issues/issue-38821.stderr +++ b/src/test/ui/issues/issue-38821.stderr @@ -10,6 +10,10 @@ note: required because of the requirements on the impl of `IntoNullable` for `<C LL | impl<T: NotNull> IntoNullable for T { | ^^^^^^^^^^^^ ^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting the associated type + | +LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull, + | +++++++++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs index ddb070ddf9f..4e56cca33d6 100644 --- a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs +++ b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs @@ -1,4 +1,5 @@ -//~ ERROR 1:1: 1:1: can't find crate for `core` [E0463] +//~ ERROR can't find crate for `core` +//~^ ERROR can't find crate for `compiler_builtins` // compile-flags: --target thumbv7em-none-eabihf // needs-llvm-components: arm @@ -7,3 +8,6 @@ #![no_std] extern crate cortex_m; +//~^ ERROR can't find crate for `cortex_m` + +fn main() {} diff --git a/src/test/ui/issues/issue-49851/compiler-builtins-error.stderr b/src/test/ui/issues/issue-49851/compiler-builtins-error.stderr index d963c07ea91..fcfa2bf119c 100644 --- a/src/test/ui/issues/issue-49851/compiler-builtins-error.stderr +++ b/src/test/ui/issues/issue-49851/compiler-builtins-error.stderr @@ -4,6 +4,16 @@ error[E0463]: can't find crate for `core` = help: consider downloading the target with `rustup target add thumbv7em-none-eabihf` = help: consider building the standard library from source with `cargo build -Zbuild-std` -error: aborting due to previous error +error[E0463]: can't find crate for `compiler_builtins` + +error[E0463]: can't find crate for `cortex_m` + --> $DIR/compiler-builtins-error.rs:10:1 + | +LL | extern crate cortex_m; + | ^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: requires `sized` lang_item + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui/issues/issue-50480.rs b/src/test/ui/issues/issue-50480.rs index deb63872f69..10597caf5b2 100644 --- a/src/test/ui/issues/issue-50480.rs +++ b/src/test/ui/issues/issue-50480.rs @@ -1,8 +1,17 @@ #[derive(Clone, Copy)] //~^ ERROR the trait `Copy` may not be implemented for this type -struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); +struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); //~^ ERROR cannot find type `NotDefined` in this scope //~| ERROR cannot find type `NotDefined` in this scope +//~| ERROR cannot find type `N` in this scope +//~| ERROR cannot find type `N` in this scope +//~| ERROR `i32` is not an iterator + +#[derive(Clone, Copy)] +//~^ ERROR the trait `Copy` may not be implemented for this type +struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); +//~^ ERROR cannot find type `NotDefined` in this scope +//~| ERROR cannot find type `N` in this scope //~| ERROR `i32` is not an iterator fn main() {} diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr index 15f38c89267..0bb1f9ae035 100644 --- a/src/test/ui/issues/issue-50480.stderr +++ b/src/test/ui/issues/issue-50480.stderr @@ -1,20 +1,61 @@ -error[E0412]: cannot find type `NotDefined` in this scope +error[E0412]: cannot find type `N` in this scope --> $DIR/issue-50480.rs:3:12 | -LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); - | ^^^^^^^^^^ not found in this scope +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | -^ not found in this scope + | | + | help: you might be missing a type parameter: `<N>` error[E0412]: cannot find type `NotDefined` in this scope + --> $DIR/issue-50480.rs:3:15 + | +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^^^^^^^^ not found in this scope + +error[E0412]: cannot find type `N` in this scope --> $DIR/issue-50480.rs:3:12 | -LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); - | ^^^^^^^^^^ not found in this scope +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | -^ not found in this scope + | | + | help: you might be missing a type parameter: `<N>` + +error[E0412]: cannot find type `NotDefined` in this scope + --> $DIR/issue-50480.rs:3:15 + | +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | - ^^^^^^^^^^ not found in this scope + | | + | help: you might be missing a type parameter: `<NotDefined>` + +error[E0412]: cannot find type `N` in this scope + --> $DIR/issue-50480.rs:12:18 + | +LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | - ^ + | | + | similarly named type parameter `T` defined here + | +help: a type parameter with a similar name exists + | +LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ~ +help: you might be missing a type parameter + | +LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | +++ + +error[E0412]: cannot find type `NotDefined` in this scope + --> $DIR/issue-50480.rs:12:21 + | +LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^^^^^^^^ not found in this scope error[E0277]: `i32` is not an iterator - --> $DIR/issue-50480.rs:3:24 + --> $DIR/issue-50480.rs:3:27 | -LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); - | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator | = help: the trait `Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` @@ -25,14 +66,36 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | #[derive(Clone, Copy)] | ^^^^ LL | -LL | struct Foo(NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); - | -------- ------ this field does not implement `Copy` - | | - | this field does not implement `Copy` +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | -------- ------ this field does not implement `Copy` + | | + | this field does not implement `Copy` + | + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `i32` is not an iterator + --> $DIR/issue-50480.rs:12:33 + | +LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + +error[E0204]: the trait `Copy` may not be implemented for this type + --> $DIR/issue-50480.rs:10:17 + | +LL | #[derive(Clone, Copy)] + | ^^^^ +LL | +LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | -------- ------ this field does not implement `Copy` + | | + | this field does not implement `Copy` | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 4 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0204, E0277, E0412. For more information about an error, try `rustc --explain E0204`. diff --git a/src/test/ui/issues/issue-88150.rs b/src/test/ui/issues/issue-88150.rs new file mode 100644 index 00000000000..555a38637a4 --- /dev/null +++ b/src/test/ui/issues/issue-88150.rs @@ -0,0 +1,21 @@ +// run-pass +// compile-flags:-C debuginfo=2 +// edition:2018 + +use core::marker::PhantomData; + +pub struct Foo<T: ?Sized, A>( + PhantomData<(A, T)>, +); + +enum Never {} + +impl<T: ?Sized> Foo<T, Never> { + fn new_foo() -> Foo<T, Never> { + Foo(PhantomData) + } +} + +fn main() { + let _ = Foo::<[()], Never>::new_foo(); +} diff --git a/src/test/ui/keyword/keyword-self-as-type-param.rs b/src/test/ui/keyword/keyword-self-as-type-param.rs index 785d64ec8ea..55c7ac128ff 100644 --- a/src/test/ui/keyword/keyword-self-as-type-param.rs +++ b/src/test/ui/keyword/keyword-self-as-type-param.rs @@ -1,10 +1,10 @@ // Regression test of #36638. struct Foo<Self>(Self); -//~^ ERROR expected identifier, found keyword `Self` -//~^^ ERROR E0392 +//~^ ERROR unexpected keyword `Self` in generic parameters +//~| ERROR recursive type `Foo` has infinite size trait Bar<Self> {} -//~^ ERROR expected identifier, found keyword `Self` +//~^ ERROR unexpected keyword `Self` in generic parameters fn main() {} diff --git a/src/test/ui/keyword/keyword-self-as-type-param.stderr b/src/test/ui/keyword/keyword-self-as-type-param.stderr index cc3df2e36f7..fd101b32b4c 100644 --- a/src/test/ui/keyword/keyword-self-as-type-param.stderr +++ b/src/test/ui/keyword/keyword-self-as-type-param.stderr @@ -1,24 +1,33 @@ -error: expected identifier, found keyword `Self` +error: unexpected keyword `Self` in generic parameters --> $DIR/keyword-self-as-type-param.rs:3:12 | LL | struct Foo<Self>(Self); - | ^^^^ expected identifier, found keyword + | ^^^^ + | + = note: you cannot use `Self` as a generic parameter because it is reserved for associated items -error: expected identifier, found keyword `Self` +error: unexpected keyword `Self` in generic parameters --> $DIR/keyword-self-as-type-param.rs:7:11 | LL | trait Bar<Self> {} - | ^^^^ expected identifier, found keyword + | ^^^^ + | + = note: you cannot use `Self` as a generic parameter because it is reserved for associated items -error[E0392]: parameter `Self` is never used - --> $DIR/keyword-self-as-type-param.rs:3:12 +error[E0072]: recursive type `Foo` has infinite size + --> $DIR/keyword-self-as-type-param.rs:3:1 | LL | struct Foo<Self>(Self); - | ^^^^ unused parameter + | ^^^^^^^^^^^^^^^^^----^^ + | | | + | | recursive without indirection + | recursive type has infinite size + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable | - = help: consider removing `Self`, referring to it in a field, or using a marker such as `PhantomData` - = help: if you intended `Self` to be a const parameter, use `const Self: usize` instead +LL | struct Foo<Self>(Box<Self>); + | ++++ + error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0392`. +For more information about this error, try `rustc --explain E0072`. diff --git a/src/test/ui/lifetimes/issue-76168-hr-outlives.rs b/src/test/ui/lifetimes/issue-76168-hr-outlives.rs new file mode 100644 index 00000000000..9366e94c90f --- /dev/null +++ b/src/test/ui/lifetimes/issue-76168-hr-outlives.rs @@ -0,0 +1,19 @@ +// edition:2018 +// check-pass + +#![feature(unboxed_closures)] +use std::future::Future; + +async fn wrapper<F>(f: F) +where for<'a> F: FnOnce<(&'a mut i32,)>, + for<'a> <F as FnOnce<(&'a mut i32,)>>::Output: Future<Output=()> + 'a +{ + let mut i = 41; + f(&mut i).await; +} + +async fn add_one(i: &mut i32) { + *i = *i + 1; +} + +fn main() {} diff --git a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr index e18d725faef..a2086895234 100644 --- a/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr +++ b/src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr @@ -11,9 +11,8 @@ LL | a: &'b str, error[E0261]: use of undeclared lifetime name `'b` --> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9 | -LL | #[derive(Eq, PartialEq)] - | -- lifetime `'b` is missing in item created through this procedural macro LL | struct Test { + | - help: consider introducing lifetime `'b` here: `<'b>` LL | a: &'b str, | ^^ undeclared lifetime | diff --git a/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr index baa47cbb10f..f5e8b41b163 100644 --- a/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-by-default-lint.stderr @@ -2,9 +2,13 @@ warning: hidden lifetime parameters in types are deprecated --> $DIR/allowed-by-default-lint.rs:9:12 | LL | fn foo(x: &Foo) {} - | ^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^ expected named lifetime parameter | = note: requested on the command line with `--force-warn elided-lifetimes-in-paths` +help: consider using the `'_` lifetime + | +LL | fn foo(x: &Foo<'_>) {} + | ~~~~~~~ warning: 1 warning emitted diff --git a/src/test/ui/lint/future-incompat-test.rs b/src/test/ui/lint/future-incompat-test.rs index ce8c118dab2..c5f477cc450 100644 --- a/src/test/ui/lint/future-incompat-test.rs +++ b/src/test/ui/lint/future-incompat-test.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zfuture-incompat-test -Zemit-future-incompat-report +// compile-flags: -Zfuture-incompat-test // check-pass // The `-Zfuture-incompat-test flag causes any normal warning to be included diff --git a/src/test/ui/lint/issue-87308.stdout b/src/test/ui/lint/issue-87308.stdout index 68a076c93be..4f81ee8b7e6 100644 --- a/src/test/ui/lint/issue-87308.stdout +++ b/src/test/ui/lint/issue-87308.stdout @@ -11,4 +11,4 @@ extern crate std; macro_rules! foo { () => { break 'x ; } } -pub fn main() { loop { } } +pub fn main() { loop {} } diff --git a/src/test/ui/lint/reasons.rs b/src/test/ui/lint/reasons.rs index 34cac4968a8..b1792e2e9cb 100644 --- a/src/test/ui/lint/reasons.rs +++ b/src/test/ui/lint/reasons.rs @@ -1,7 +1,6 @@ // check-pass #![feature(lint_reasons)] - #![warn(elided_lifetimes_in_paths, //~^ NOTE the lint level is defined here reason = "explicit anonymous lifetimes aid reasoning about ownership")] @@ -20,8 +19,9 @@ pub struct CheaterDetectionMechanism {} impl fmt::Debug for CheaterDetectionMechanism { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { //~^ WARN hidden lifetime parameters in types are deprecated + //~| NOTE expected named lifetime parameter //~| NOTE explicit anonymous lifetimes aid - //~| HELP indicate the anonymous lifetime + //~| HELP consider using the `'_` lifetime fmt.debug_struct("CheaterDetectionMechanism").finish() } } diff --git a/src/test/ui/lint/reasons.stderr b/src/test/ui/lint/reasons.stderr index 150237c6be2..f797c89a032 100644 --- a/src/test/ui/lint/reasons.stderr +++ b/src/test/ui/lint/reasons.stderr @@ -1,15 +1,19 @@ warning: hidden lifetime parameters in types are deprecated - --> $DIR/reasons.rs:21:29 + --> $DIR/reasons.rs:20:29 | LL | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - | ^^^^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` + | ^^^^^^^^^^^^^^ expected named lifetime parameter | = note: explicit anonymous lifetimes aid reasoning about ownership note: the lint level is defined here - --> $DIR/reasons.rs:5:9 + --> $DIR/reasons.rs:4:9 | LL | #![warn(elided_lifetimes_in_paths, | ^^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider using the `'_` lifetime + | +LL | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + | ~~~~~~~~~~~~~~~~~~ warning: variable `Social_exchange_psychology` should have a snake case name --> $DIR/reasons.rs:30:9 @@ -20,7 +24,7 @@ LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; = note: people shouldn't have to change their usual style habits to contribute to our project note: the lint level is defined here - --> $DIR/reasons.rs:9:5 + --> $DIR/reasons.rs:8:5 | LL | nonstandard_style, | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs index fd9baf8c6b9..258f9e4831f 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.rs @@ -26,4 +26,7 @@ fn doc_comment_on_expr(num: u8) -> bool { num == 3 } +fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {} +//~^ ERROR: unused doc comment + fn main() {} diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr index 403367017c6..3ce1df71a2e 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr @@ -41,6 +41,14 @@ LL | num == 3 | = help: use `//` for a plain comment +error: unused doc comment + --> $DIR/unused-doc-comments-edge-cases.rs:29:27 + | +LL | fn doc_comment_on_generic<#[doc = "x"] T>(val: T) {} + | ^^^^^^^^^^^^ - rustdoc does not generate documentation for generic parameters + | + = help: use `//` for a plain comment + error[E0308]: mismatched types --> $DIR/unused-doc-comments-edge-cases.rs:14:9 | @@ -55,7 +63,7 @@ help: you might have meant to return this value LL | return true; | ++++++ + -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0308, E0658. For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr b/src/test/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr index a5987a25551..a06487be3d6 100644 --- a/src/test/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr +++ b/src/test/ui/macros/macro-pat-pattern-followed-by-or-in-2021.stderr @@ -2,7 +2,9 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:3:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } - | ^ not allowed after `pat` fragments + | ------ ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$x:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` @@ -10,7 +12,9 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:4:32 | LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } - | ^ not allowed after `pat` fragments + | ------ ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$x:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` @@ -18,7 +22,9 @@ error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragmen --> $DIR/macro-pat-pattern-followed-by-or-in-2021.rs:7:36 | LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { - | ^ not allowed after `pat` fragments + | -------- ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$pat:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` diff --git a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr index 8aebe98515f..c3754dde080 100644 --- a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr +++ b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr @@ -2,7 +2,9 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat2021-pattern-followed-by-or.rs:4:28 | LL | macro_rules! foo { ($x:pat | $y:pat) => {} } - | ^ not allowed after `pat` fragments + | ------ ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$x:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` @@ -10,7 +12,9 @@ error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments --> $DIR/macro-pat2021-pattern-followed-by-or.rs:7:28 | LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } - | ^ not allowed after `pat` fragments + | ------ ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$x:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` @@ -18,7 +22,9 @@ error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragmen --> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:35 | LL | ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => { - | ^ not allowed after `pat` fragments + | -------- ^ not allowed after `pat` fragments + | | + | help: try a `pat_param` fragment specifier instead: `$pat:pat_param` | = note: allowed there are: `=>`, `,`, `=`, `if` or `in` diff --git a/src/test/ui/macros/nonterminal-matching.rs b/src/test/ui/macros/nonterminal-matching.rs index 0ccdf6e5f2e..84fffe44d6a 100644 --- a/src/test/ui/macros/nonterminal-matching.rs +++ b/src/test/ui/macros/nonterminal-matching.rs @@ -16,7 +16,7 @@ macro complex_nonterminal($nt_item: item) { struct S; } - n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }` + n!(a $nt_item b); //~ ERROR no rules expected the token `enum E {}` } simple_nonterminal!(a, 'a, (x, y, z)); // OK diff --git a/src/test/ui/macros/nonterminal-matching.stderr b/src/test/ui/macros/nonterminal-matching.stderr index 155a9425131..585f2355321 100644 --- a/src/test/ui/macros/nonterminal-matching.stderr +++ b/src/test/ui/macros/nonterminal-matching.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `enum E { }` +error: no rules expected the token `enum E {}` --> $DIR/nonterminal-matching.rs:19:10 | LL | macro n(a $nt_item b) { diff --git a/src/test/ui/numeric/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr index 3e2bc5bc82d..b8f2d88ab49 100644 --- a/src/test/ui/numeric/numeric-cast.stderr +++ b/src/test/ui/numeric/numeric-cast.stderr @@ -994,8 +994,8 @@ error[E0308]: mismatched types LL | foo::<f64>(x_usize); | ^^^^^^^ expected `f64`, found `usize` | -help: you can cast a `usize` to an `f64`, producing the floating point representation of the integer, - | rounded if necessary +help: you can cast a `usize` to an `f64`, producing the floating point representation of the integer, rounded if necessary + | LL | foo::<f64>(x_usize as f64); | ++++++ @@ -1005,8 +1005,8 @@ error[E0308]: mismatched types LL | foo::<f64>(x_u64); | ^^^^^ expected `f64`, found `u64` | -help: you can cast a `u64` to an `f64`, producing the floating point representation of the integer, - | rounded if necessary +help: you can cast a `u64` to an `f64`, producing the floating point representation of the integer, rounded if necessary + | LL | foo::<f64>(x_u64 as f64); | ++++++ @@ -1115,8 +1115,8 @@ error[E0308]: mismatched types LL | foo::<f32>(x_usize); | ^^^^^^^ expected `f32`, found `usize` | -help: you can cast a `usize` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary +help: you can cast a `usize` to an `f32`, producing the floating point representation of the integer, rounded if necessary + | LL | foo::<f32>(x_usize as f32); | ++++++ @@ -1126,8 +1126,8 @@ error[E0308]: mismatched types LL | foo::<f32>(x_u64); | ^^^^^ expected `f32`, found `u64` | -help: you can cast a `u64` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary +help: you can cast a `u64` to an `f32`, producing the floating point representation of the integer, rounded if necessary + | LL | foo::<f32>(x_u64 as f32); | ++++++ @@ -1137,8 +1137,8 @@ error[E0308]: mismatched types LL | foo::<f32>(x_u32); | ^^^^^ expected `f32`, found `u32` | -help: you can cast a `u32` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary +help: you can cast a `u32` to an `f32`, producing the floating point representation of the integer, rounded if necessary + | LL | foo::<f32>(x_u32 as f32); | ++++++ diff --git a/src/test/ui/optimization-remark.rs b/src/test/ui/optimization-remark.rs index 7aedb09928b..36549cbc554 100644 --- a/src/test/ui/optimization-remark.rs +++ b/src/test/ui/optimization-remark.rs @@ -1,10 +1,19 @@ // build-pass // ignore-pass // no-system-llvm -// revisions: all inline -// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2 +// revisions: all inline merge1 merge2 +// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2 +// +// Check that remarks can be enabled individually or with "all": +// // [all] compile-flags: -Cremark=all // [inline] compile-flags: -Cremark=inline +// +// Check that values of -Cremark flag are accumulated: +// +// [merge1] compile-flags: -Cremark=all -Cremark=giraffe +// [merge2] compile-flags: -Cremark=inline -Cremark=giraffe +// // error-pattern: inline: f not inlined into g // dont-check-compiler-stderr diff --git a/src/test/ui/parser/issue-91421.rs b/src/test/ui/parser/issue-91421.rs new file mode 100644 index 00000000000..9959df56638 --- /dev/null +++ b/src/test/ui/parser/issue-91421.rs @@ -0,0 +1,10 @@ +// Regression test for issue #91421. + +fn main() { + let value = if true && { + //~^ ERROR: this `if` expression has a condition, but no block + //~| HELP: maybe you forgot the right operand of the condition? + 3 + //~^ ERROR: mismatched types [E0308] + } else { 4 }; +} diff --git a/src/test/ui/parser/issue-91421.stderr b/src/test/ui/parser/issue-91421.stderr new file mode 100644 index 00000000000..04284d5e3b2 --- /dev/null +++ b/src/test/ui/parser/issue-91421.stderr @@ -0,0 +1,21 @@ +error: this `if` expression has a condition, but no block + --> $DIR/issue-91421.rs:4:17 + | +LL | let value = if true && { + | ^^ + | +help: maybe you forgot the right operand of the condition? + --> $DIR/issue-91421.rs:4:25 + | +LL | let value = if true && { + | ^^ + +error[E0308]: mismatched types + --> $DIR/issue-91421.rs:7:9 + | +LL | 3 + | ^ expected `bool`, found integer + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs b/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs index 4ee0b2054ff..0b7b67496d6 100644 --- a/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs +++ b/src/test/ui/parser/issues/issue-87086-colon-path-sep.rs @@ -1,11 +1,15 @@ // Tests that a suggestion is issued if the user wrote a colon instead of // a path separator in a match arm. -enum Foo { - Bar, - Baz, +mod qux { + pub enum Foo { + Bar, + Baz, + } } +use qux::Foo; + fn f() -> Foo { Foo::Bar } fn g1() { @@ -16,24 +20,24 @@ fn g1() { _ => {} } match f() { - Foo::Bar:Baz => {} + qux::Foo:Bar => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here _ => {} } match f() { - Foo:Bar::Baz => {} + qux:Foo::Baz => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here _ => {} } match f() { - Foo: Bar::Baz if true => {} + qux: Foo::Baz if true => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here _ => {} } - if let Bar:Baz = f() { + if let Foo:Bar = f() { //~^ ERROR: expected one of //~| HELP: maybe write a path separator here } @@ -41,16 +45,18 @@ fn g1() { fn g1_neg() { match f() { - ref Foo: Bar::Baz => {} + ref qux: Foo::Baz => {} //~^ ERROR: expected one of + //~| HELP: maybe write a path separator here _ => {} } } fn g2_neg() { match f() { - mut Foo: Bar::Baz => {} + mut qux: Foo::Baz => {} //~^ ERROR: expected one of + //~| HELP: maybe write a path separator here _ => {} } } @@ -62,5 +68,12 @@ fn main() { Foo:Bar::Baz => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here + //~| ERROR: failed to resolve: `Bar` is a variant, not a module + } + match myfoo { + Foo::Bar => {} + Foo:Bar => {} + //~^ ERROR: expected one of + //~| HELP: maybe write a path separator here } } diff --git a/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr b/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr index 8f93661a626..2050a16beb3 100644 --- a/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/src/test/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -1,5 +1,5 @@ error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:13:12 + --> $DIR/issue-87086-colon-path-sep.rs:17:12 | LL | Foo:Bar => {} | ^ @@ -8,55 +8,61 @@ LL | Foo:Bar => {} | help: maybe write a path separator here: `::` error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:19:17 + --> $DIR/issue-87086-colon-path-sep.rs:23:17 | -LL | Foo::Bar:Baz => {} +LL | qux::Foo:Bar => {} | ^ | | | expected one of 8 possible tokens | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:25:12 + --> $DIR/issue-87086-colon-path-sep.rs:29:12 | -LL | Foo:Bar::Baz => {} +LL | qux:Foo::Baz => {} | ^ | | | expected one of `@` or `|` | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:31:12 + --> $DIR/issue-87086-colon-path-sep.rs:35:12 | -LL | Foo: Bar::Baz if true => {} +LL | qux: Foo::Baz if true => {} | ^ | | | expected one of `@` or `|` | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:36:15 + --> $DIR/issue-87086-colon-path-sep.rs:40:15 | -LL | if let Bar:Baz = f() { +LL | if let Foo:Bar = f() { | ^ | | | expected one of `@` or `|` | help: maybe write a path separator here: `::` -error: expected one of `=>`, `@`, `if`, or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:44:16 +error: expected one of `@` or `|`, found `:` + --> $DIR/issue-87086-colon-path-sep.rs:48:16 | -LL | ref Foo: Bar::Baz => {} - | ^ expected one of `=>`, `@`, `if`, or `|` +LL | ref qux: Foo::Baz => {} + | ^ + | | + | expected one of `@` or `|` + | help: maybe write a path separator here: `::` -error: expected one of `=>`, `@`, `if`, or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:52:16 +error: expected one of `@` or `|`, found `:` + --> $DIR/issue-87086-colon-path-sep.rs:57:16 | -LL | mut Foo: Bar::Baz => {} - | ^ expected one of `=>`, `@`, `if`, or `|` +LL | mut qux: Foo::Baz => {} + | ^ + | | + | expected one of `@` or `|` + | help: maybe write a path separator here: `::` error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:62:12 + --> $DIR/issue-87086-colon-path-sep.rs:68:12 | LL | Foo:Bar::Baz => {} | ^ @@ -64,5 +70,21 @@ LL | Foo:Bar::Baz => {} | expected one of `@` or `|` | help: maybe write a path separator here: `::` -error: aborting due to 8 previous errors +error: expected one of `@` or `|`, found `:` + --> $DIR/issue-87086-colon-path-sep.rs:75:12 + | +LL | Foo:Bar => {} + | ^ + | | + | expected one of `@` or `|` + | help: maybe write a path separator here: `::` + +error[E0433]: failed to resolve: `Bar` is a variant, not a module + --> $DIR/issue-87086-colon-path-sep.rs:68:13 + | +LL | Foo:Bar::Baz => {} + | ^^^ `Bar` is a variant, not a module + +error: aborting due to 10 previous errors +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/proc-macro/allowed-attr-stmt-expr.stdout b/src/test/ui/proc-macro/allowed-attr-stmt-expr.stdout index eae169b162f..091862de30f 100644 --- a/src/test/ui/proc-macro/allowed-attr-stmt-expr.stdout +++ b/src/test/ui/proc-macro/allowed-attr-stmt-expr.stdout @@ -14,7 +14,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/allowed-attr-stmt-expr.rs:49:20: 49:21 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Foo { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Foo {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', @@ -140,7 +140,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/allowed-attr-stmt-expr.rs:61:28: 61:29 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar { }) ; +PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar {}) ; PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "second_make_stmt", @@ -201,7 +201,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/allowed-attr-stmt-expr.rs:64:57: 64:58 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[allow(dead_code)] struct Bar { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[allow(dead_code)] struct Bar {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', @@ -257,7 +257,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/allowed-attr-stmt-expr.rs:64:54: 64:56 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Other { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Other {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', diff --git a/src/test/ui/proc-macro/attr-complex-fn.stdout b/src/test/ui/proc-macro/attr-complex-fn.stdout index fbefa3923ee..fc69a13ddb9 100644 --- a/src/test/ui/proc-macro/attr-complex-fn.stdout +++ b/src/test/ui/proc-macro/attr-complex-fn.stdout @@ -1,4 +1,4 @@ -PRINT-ATTR INPUT (DISPLAY): fn foo < T : MyTrait < MyStruct < { true } >> > () { } +PRINT-ATTR INPUT (DISPLAY): fn foo < T : MyTrait < MyStruct < { true } >> > () {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", diff --git a/src/test/ui/proc-macro/attr-stmt-expr.stdout b/src/test/ui/proc-macro/attr-stmt-expr.stdout index edb9fbab342..f9b2305c735 100644 --- a/src/test/ui/proc-macro/attr-stmt-expr.stdout +++ b/src/test/ui/proc-macro/attr-stmt-expr.stdout @@ -1,4 +1,4 @@ -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Foo { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Foo {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', @@ -124,7 +124,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/attr-stmt-expr.rs:53:28: 53:29 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar { }) ; +PRINT-ATTR INPUT (DISPLAY): second_make_stmt! (#[allow(dead_code)] struct Bar {}) ; PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "second_make_stmt", @@ -185,7 +185,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/attr-stmt-expr.rs:56:57: 56:58 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[allow(dead_code)] struct Bar { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[allow(dead_code)] struct Bar {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', @@ -241,7 +241,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/attr-stmt-expr.rs:56:54: 56:56 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Other { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] struct Other {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', diff --git a/src/test/ui/proc-macro/attribute-after-derive.stdout b/src/test/ui/proc-macro/attribute-after-derive.stdout index c5b84b0367c..1b17d60476a 100644 --- a/src/test/ui/proc-macro/attribute-after-derive.stdout +++ b/src/test/ui/proc-macro/attribute-after-derive.stdout @@ -83,7 +83,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/attribute-after-derive.rs:16:24: 19:2 (#0), }, ] -PRINT-DERIVE INPUT (DISPLAY): struct AttributeDerive { } +PRINT-DERIVE INPUT (DISPLAY): struct AttributeDerive {} PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "struct", @@ -99,7 +99,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/attribute-after-derive.rs:16:24: 19:2 (#0), }, ] -PRINT-DERIVE INPUT (DISPLAY): #[print_attr] struct DeriveAttribute { } +PRINT-DERIVE INPUT (DISPLAY): #[print_attr] struct DeriveAttribute {} PRINT-DERIVE INPUT (DEBUG): TokenStream [ Punct { ch: '#', diff --git a/src/test/ui/proc-macro/auxiliary/attr-args.rs b/src/test/ui/proc-macro/auxiliary/attr-args.rs index 8dd2a5ac786..5f76a4484e1 100644 --- a/src/test/ui/proc-macro/auxiliary/attr-args.rs +++ b/src/test/ui/proc-macro/auxiliary/attr-args.rs @@ -15,7 +15,7 @@ pub fn attr_with_args(args: TokenStream, input: TokenStream) -> TokenStream { let input = input.to_string(); - assert_eq!(input, "fn foo() { }"); + assert_eq!(input, "fn foo() {}"); r#" fn foo() -> &'static str { "Hello, world!" } diff --git a/src/test/ui/proc-macro/auxiliary/attr-on-trait.rs b/src/test/ui/proc-macro/auxiliary/attr-on-trait.rs index d89aaac59f6..3787b8eeccc 100644 --- a/src/test/ui/proc-macro/auxiliary/attr-on-trait.rs +++ b/src/test/ui/proc-macro/auxiliary/attr-on-trait.rs @@ -10,6 +10,6 @@ use proc_macro::TokenStream; #[proc_macro_attribute] pub fn foo(attr: TokenStream, item: TokenStream) -> TokenStream { drop(attr); - assert_eq!(item.to_string(), "fn foo() { }"); + assert_eq!(item.to_string(), "fn foo() {}"); "fn foo(&self);".parse().unwrap() } diff --git a/src/test/ui/proc-macro/auxiliary/custom-quote.rs b/src/test/ui/proc-macro/auxiliary/custom-quote.rs index 714417deee5..3b7811748ed 100644 --- a/src/test/ui/proc-macro/auxiliary/custom-quote.rs +++ b/src/test/ui/proc-macro/auxiliary/custom-quote.rs @@ -6,6 +6,7 @@ #![crate_type = "proc-macro"] extern crate proc_macro; +use std::iter::FromIterator; use std::str::FromStr; use proc_macro::*; @@ -23,7 +24,7 @@ pub fn custom_quote(input: TokenStream) -> TokenStream { let set_span_method = TokenStream::from_str("ident.set_span").unwrap(); let set_span_arg = TokenStream::from(TokenTree::Group(Group::new(Delimiter::Parenthesis, quoted_span))); let suffix = TokenStream::from_str(";proc_macro::TokenStream::from(proc_macro::TokenTree::Ident(ident))").unwrap(); - let full_stream: TokenStream = std::array::IntoIter::new([prefix, set_span_method, set_span_arg, suffix]).collect(); + let full_stream = TokenStream::from_iter([prefix, set_span_method, set_span_arg, suffix]); full_stream } _ => unreachable!() diff --git a/src/test/ui/proc-macro/cfg-eval-inner.stdout b/src/test/ui/proc-macro/cfg-eval-inner.stdout index 08ead5aaeee..debbad57a86 100644 --- a/src/test/ui/proc-macro/cfg-eval-inner.stdout +++ b/src/test/ui/proc-macro/cfg-eval-inner.stdout @@ -3,7 +3,7 @@ PRINT-ATTR INPUT (DISPLAY): impl Foo < { #! [rustc_dummy(cursed_inner)] #! [allow(unused)] struct Inner { field : [u8 ; { #! [rustc_dummy(another_cursed_inner)] 1 }] } 0 - }] > { #! [rustc_dummy(evaluated_attr)] fn bar() { } } + }] > { #! [rustc_dummy(evaluated_attr)] fn bar() {} } PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "impl", diff --git a/src/test/ui/proc-macro/crate-attrs-multiple.rs b/src/test/ui/proc-macro/crate-attrs-multiple.rs new file mode 100644 index 00000000000..29a0eca4172 --- /dev/null +++ b/src/test/ui/proc-macro/crate-attrs-multiple.rs @@ -0,0 +1,14 @@ +// Multiple custom crate-level attributes, both inert and active. + +// check-pass +// aux-crate:test_macros=test-macros.rs + +#![feature(custom_inner_attributes)] +#![feature(prelude_import)] + +#![test_macros::identity_attr] +#![rustfmt::skip] +#![test_macros::identity_attr] +#![rustfmt::skip] + +fn main() {} diff --git a/src/test/ui/proc-macro/derive-expand-order.stdout b/src/test/ui/proc-macro/derive-expand-order.stdout index 3ac1adf92c2..dffbbf1494b 100644 --- a/src/test/ui/proc-macro/derive-expand-order.stdout +++ b/src/test/ui/proc-macro/derive-expand-order.stdout @@ -1,5 +1,5 @@ -Derive First: #[derive(Second)] #[derive(Third, Fourth)] #[derive(Fifth)] pub struct Foo { } -Derive Second: #[derive(Third, Fourth)] #[derive(Fifth)] pub struct Foo { } -Derive Third: #[derive(Fifth)] pub struct Foo { } -Derive Fourth: #[derive(Fifth)] pub struct Foo { } -Derive Fifth: pub struct Foo { } +Derive First: #[derive(Second)] #[derive(Third, Fourth)] #[derive(Fifth)] pub struct Foo {} +Derive Second: #[derive(Third, Fourth)] #[derive(Fifth)] pub struct Foo {} +Derive Third: #[derive(Fifth)] pub struct Foo {} +Derive Fourth: #[derive(Fifth)] pub struct Foo {} +Derive Fifth: pub struct Foo {} diff --git a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout index e37a483cb87..686d53e8876 100644 --- a/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout +++ b/src/test/ui/proc-macro/expr-stmt-nonterminal-tokens.stdout @@ -202,7 +202,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: #8 bytes(430..483), }, ] -PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { { } } ; 0 }, } +PRINT-DERIVE INPUT (DISPLAY): enum E { V = { let _ = { {} } ; 0 }, } PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "enum", diff --git a/src/test/ui/proc-macro/inner-attrs.stdout b/src/test/ui/proc-macro/inner-attrs.stdout index 9b7865be622..eaa8882d6a6 100644 --- a/src/test/ui/proc-macro/inner-attrs.stdout +++ b/src/test/ui/proc-macro/inner-attrs.stdout @@ -269,7 +269,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:20:30: 20:36 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): fn foo() { } +PRINT-ATTR INPUT (DISPLAY): fn foo() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", @@ -552,7 +552,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:27:30: 27:40 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): mod inline_mod { } +PRINT-ATTR INPUT (DISPLAY): mod inline_mod {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "mod", @@ -933,7 +933,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:82:42: 82:47 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): fn weird_extern() { } +PRINT-ATTR INPUT (DISPLAY): fn weird_extern() {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", diff --git a/src/test/ui/proc-macro/input-interpolated.stdout b/src/test/ui/proc-macro/input-interpolated.stdout index 866608e4d8e..44baa37577c 100644 --- a/src/test/ui/proc-macro/input-interpolated.stdout +++ b/src/test/ui/proc-macro/input-interpolated.stdout @@ -53,7 +53,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: #4 bytes(432..433), }, ] -PRINT-DERIVE INPUT (DISPLAY): struct A { } +PRINT-DERIVE INPUT (DISPLAY): struct A {} PRINT-DERIVE INPUT (DEBUG): TokenStream [ Ident { ident: "struct", diff --git a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.rs b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.rs index 039878af56e..a4161d4fc3d 100644 --- a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.rs +++ b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.rs @@ -1,7 +1,10 @@ -// edition:2018 -// aux-crate:issue_59191=issue-59191.rs // Test that using a macro to replace the entire crate tree with a non-'mod' item errors out nicely. // `issue_59191::no_main` replaces whatever's passed in with `fn main() {}`. + +// edition:2018 +// aux-crate:issue_59191=issue-59191.rs +// error-pattern: requires `sized` lang_item + #![feature(custom_inner_attributes)] #![issue_59191::no_main] -//~^ ERROR expected crate top-level item to be a module after macro expansion, found a function +#![issue_59191::no_main] diff --git a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr index 126c52db548..f7516c7d377 100644 --- a/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr +++ b/src/test/ui/proc-macro/issue-59191-replace-root-with-fn.stderr @@ -1,10 +1,4 @@ -error: expected crate top-level item to be a module after macro expansion, found a function - --> $DIR/issue-59191-replace-root-with-fn.rs:6:1 - | -LL | #![issue_59191::no_main] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the attribute macro `issue_59191::no_main` (in Nightly builds, run with -Z macro-backtrace for more info) +error: requires `sized` lang_item error: aborting due to previous error diff --git a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout index ea03653c52f..0fda6654ff3 100644 --- a/src/test/ui/proc-macro/issue-75734-pp-paren.stdout +++ b/src/test/ui/proc-macro/issue-75734-pp-paren.stdout @@ -1,4 +1,4 @@ -PRINT-ATTR INPUT (DISPLAY): fn main() { & | _ : u8 | { } ; mul_2! (1 + 1) ; } +PRINT-ATTR INPUT (DISPLAY): fn main() { & | _ : u8 | {} ; mul_2! (1 + 1) ; } PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", diff --git a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout index 81b2b219c43..fdd178a5229 100644 --- a/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout +++ b/src/test/ui/proc-macro/issue-75930-derive-cfg.stdout @@ -8,8 +8,8 @@ struct Foo < #[cfg(FALSE)] A, B > #[cfg(FALSE)] struct Bar ; #[cfg(not(FALSE))] struct Inner ; #[cfg(FALSE)] let a = 25 ; match true { - #[cfg(FALSE)] true => { }, - #[cfg_attr(not(FALSE), allow(warnings))] false => { }, _ => { } + #[cfg(FALSE)] true => {}, + #[cfg_attr(not(FALSE), allow(warnings))] false => {}, _ => {} } ; #[print_helper(should_be_removed)] fn removed_fn() { #! [cfg(FALSE)] } #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn() { #! [cfg(not(FALSE))] let my_val = true ; } enum TupleEnum @@ -1278,7 +1278,7 @@ PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_hel [u8 ; { #[cfg(not(FALSE))] struct Inner ; match true - { #[allow(warnings)] false => { }, _ => { } } ; #[print_helper(c)] + { #[allow(warnings)] false => {}, _ => {} } ; #[print_helper(c)] #[cfg(not(FALSE))] fn kept_fn() { #! [cfg(not(FALSE))] let my_val = true ; } enum TupleEnum { Foo(#[cfg(not(FALSE))] i32, u8) } struct diff --git a/src/test/ui/proc-macro/issue-81007-item-attrs.stdout b/src/test/ui/proc-macro/issue-81007-item-attrs.stdout index 6f880a12021..3c001e9954b 100644 --- a/src/test/ui/proc-macro/issue-81007-item-attrs.stdout +++ b/src/test/ui/proc-macro/issue-81007-item-attrs.stdout @@ -1,4 +1,4 @@ -PRINT-ATTR INPUT (DISPLAY): #[doc = r" A doc comment"] struct Foo { } +PRINT-ATTR INPUT (DISPLAY): #[doc = r" A doc comment"] struct Foo {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', @@ -40,7 +40,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/issue-81007-item-attrs.rs:22:16: 22:18 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[doc = r" Another comment comment"] struct Bar { } +PRINT-ATTR INPUT (DISPLAY): #[rustc_dummy] #[doc = r" Another comment comment"] struct Bar {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Punct { ch: '#', diff --git a/src/test/ui/proc-macro/nested-macro-rules.stdout b/src/test/ui/proc-macro/nested-macro-rules.stdout index 8292617fc16..68f30c23a8d 100644 --- a/src/test/ui/proc-macro/nested-macro-rules.stdout +++ b/src/test/ui/proc-macro/nested-macro-rules.stdout @@ -11,7 +11,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ span: $DIR/auxiliary/nested-macro-rules.rs:9:30: 9:35 (#6), }, ] -PRINT-ATTR INPUT (DISPLAY): struct FirstAttrStruct { } +PRINT-ATTR INPUT (DISPLAY): struct FirstAttrStruct {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "struct", @@ -46,7 +46,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [ span: $DIR/auxiliary/nested-macro-rules.rs:9:30: 9:35 (#15), }, ] -PRINT-ATTR INPUT (DISPLAY): struct SecondAttrStruct { } +PRINT-ATTR INPUT (DISPLAY): struct SecondAttrStruct {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "struct", diff --git a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout index 709b2a2169e..c08e5308138 100644 --- a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -64,7 +64,7 @@ macro inner /* 0#4 */ { () => { print_bang! { struct S; } } } struct S /* 0#5 */; // OK, not a duplicate definition of `S` -fn main /* 0#0 */() { } +fn main /* 0#0 */() {} /* Expansions: diff --git a/src/test/ui/proc-macro/trailing-plus.stdout b/src/test/ui/proc-macro/trailing-plus.stdout index d60f400af2b..b90057cd6d5 100644 --- a/src/test/ui/proc-macro/trailing-plus.stdout +++ b/src/test/ui/proc-macro/trailing-plus.stdout @@ -1,4 +1,4 @@ -PRINT-ATTR INPUT (DISPLAY): fn foo < T > () where T : Copy + { } +PRINT-ATTR INPUT (DISPLAY): fn foo < T > () where T : Copy + {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "fn", diff --git a/src/test/ui/proc-macro/weird-braces.stdout b/src/test/ui/proc-macro/weird-braces.stdout index dc35df1159f..9bf56221734 100644 --- a/src/test/ui/proc-macro/weird-braces.stdout +++ b/src/test/ui/proc-macro/weird-braces.stdout @@ -445,7 +445,7 @@ PRINT-ATTR_ARGS INPUT (DEBUG): TokenStream [ span: $DIR/weird-braces.rs:20:30: 20:42 (#0), }, ] -PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } > { } +PRINT-ATTR INPUT (DISPLAY): impl Bar < { 1 > 0 } > for Foo < { true } > {} PRINT-ATTR INPUT (DEBUG): TokenStream [ Ident { ident: "impl", diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr deleted file mode 100644 index 9bb385b0dcd..00000000000 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to previous error - diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr index 6ae70ec672c..d9fd1aebf27 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:12 | LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:15 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:38:15 | LL | fn with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:18 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:38:18 | LL | fn with_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr index 9bb385b0dcd..ba7572ebe31 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:39:12 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:12 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs index 046d010002e..08bc64926fa 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs @@ -6,6 +6,11 @@ // revisions: migrate nll //[nll]compile-flags: -Z borrowck=mir +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + #![allow(dead_code)] pub trait TheTrait { diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr deleted file mode 100644 index 0d4694a64d0..00000000000 --- a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.nll.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:11:12 - | -LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | let z: Option<&'b &'a usize> = None; - | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - | - = help: consider adding the following bound: `'a: 'b` - -error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:17:12 - | -LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | let y: Paramd<'a> = Paramd { x: a }; -LL | let z: Option<&'b Paramd<'a>> = None; - | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` - | - = help: consider adding the following bound: `'a: 'b` - -error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:22:12 - | -LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -LL | let z: Option<&'a &'b usize> = None; - | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr index c0f3b24f68c..a27a010d7f3 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr @@ -1,50 +1,50 @@ error[E0491]: in type `&'b &'a usize`, reference has a longer lifetime than the data it references - --> $DIR/regions-free-region-ordering-caller.rs:11:12 + --> $DIR/regions-free-region-ordering-caller.rs:16:12 | LL | let z: Option<&'b &'a usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'b` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:10:14 + --> $DIR/regions-free-region-ordering-caller.rs:15:14 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:10:10 + --> $DIR/regions-free-region-ordering-caller.rs:15:10 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ error[E0491]: in type `&'b Paramd<'a>`, reference has a longer lifetime than the data it references - --> $DIR/regions-free-region-ordering-caller.rs:17:12 + --> $DIR/regions-free-region-ordering-caller.rs:22:12 | LL | let z: Option<&'b Paramd<'a>> = None; | ^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'b` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:15:14 + --> $DIR/regions-free-region-ordering-caller.rs:20:14 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:15:10 + --> $DIR/regions-free-region-ordering-caller.rs:20:10 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references - --> $DIR/regions-free-region-ordering-caller.rs:22:12 + --> $DIR/regions-free-region-ordering-caller.rs:27:12 | LL | let z: Option<&'a &'b usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:21:10 + --> $DIR/regions-free-region-ordering-caller.rs:26:10 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-free-region-ordering-caller.rs:21:14 + --> $DIR/regions-free-region-ordering-caller.rs:26:14 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr index 0d4694a64d0..546eb93d8ec 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:11:12 + --> $DIR/regions-free-region-ordering-caller.rs:16:12 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | -- -- lifetime `'b` defined here @@ -11,7 +11,7 @@ LL | let z: Option<&'b &'a usize> = None; = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:17:12 + --> $DIR/regions-free-region-ordering-caller.rs:22:12 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { | -- -- lifetime `'b` defined here @@ -24,7 +24,7 @@ LL | let z: Option<&'b Paramd<'a>> = None; = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/regions-free-region-ordering-caller.rs:22:12 + --> $DIR/regions-free-region-ordering-caller.rs:27:12 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.rs b/src/test/ui/regions/regions-free-region-ordering-caller.rs index 2bf4734cf73..11997a5fb56 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.rs +++ b/src/test/ui/regions/regions-free-region-ordering-caller.rs @@ -5,6 +5,11 @@ // revisions: migrate nll //[nll]compile-flags: -Z borrowck=mir +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + struct Paramd<'a> { x: &'a usize } fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr deleted file mode 100644 index 29e92f33ec9..00000000000 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.nll.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-hrtb.rs:30:12 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-hrtb.rs:50:12 - | -LL | fn with_assoc_sub<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr index 60c115b3f59..f2308bb7c78 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr @@ -1,33 +1,33 @@ error[E0491]: in type `&'a WithHrAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-hrtb.rs:30:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12 | LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container-hrtb.rs:27:15 + --> $DIR/regions-outlives-projection-container-hrtb.rs:32:15 | LL | fn with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container-hrtb.rs:27:18 + --> $DIR/regions-outlives-projection-container-hrtb.rs:32:18 | LL | fn with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithHrAssocSub<TheType<'b>>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-hrtb.rs:50:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:55:12 | LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container-hrtb.rs:46:19 + --> $DIR/regions-outlives-projection-container-hrtb.rs:51:19 | LL | fn with_assoc_sub<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container-hrtb.rs:46:22 + --> $DIR/regions-outlives-projection-container-hrtb.rs:51:22 | LL | fn with_assoc_sub<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr index 29e92f33ec9..472323772c1 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-hrtb.rs:30:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here @@ -12,7 +12,7 @@ LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { }; = help: consider adding the following bound: `'b: 'a` error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-hrtb.rs:50:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:55:12 | LL | fn with_assoc_sub<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs index cee741184ca..695a81dca27 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs @@ -4,6 +4,11 @@ // revisions: migrate nll //[nll]compile-flags: -Z borrowck=mir +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + #![allow(dead_code)] pub trait TheTrait<'b> { diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr deleted file mode 100644 index 70351443024..00000000000 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.nll.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-wc.rs:33:12 - | -LL | fn with_assoc<'a,'b>() { - | -- -- lifetime `'b` defined here - | | - | lifetime `'a` defined here -... -LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` - | - = help: consider adding the following bound: `'b: 'a` - -error: aborting due to previous error - diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr index 8430b69f998..bda2896fca4 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-wc.rs:33:12 + --> $DIR/regions-outlives-projection-container-wc.rs:38:12 | LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/regions-outlives-projection-container-wc.rs:27:15 + --> $DIR/regions-outlives-projection-container-wc.rs:32:15 | LL | fn with_assoc<'a,'b>() { | ^^ note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/regions-outlives-projection-container-wc.rs:27:18 + --> $DIR/regions-outlives-projection-container-wc.rs:32:18 | LL | fn with_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr index 70351443024..fc32a72d508 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.nll.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/regions-outlives-projection-container-wc.rs:33:12 + --> $DIR/regions-outlives-projection-container-wc.rs:38:12 | LL | fn with_assoc<'a,'b>() { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.rs b/src/test/ui/regions/regions-outlives-projection-container-wc.rs index 99965f33390..c9b714cffb6 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.rs +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.rs @@ -6,6 +6,11 @@ // revisions: migrate nll //[nll]compile-flags: -Z borrowck=mir +// Since we are testing nll (and migration) explicitly as a separate +// revisions, don't worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + #![allow(dead_code)] pub trait TheTrait { diff --git a/src/test/ui/repr/issue-83921-pretty.pretty.stdout b/src/test/ui/repr/issue-83921-pretty.pretty.stdout index dad3641f0f5..aaf3993538a 100644 --- a/src/test/ui/repr/issue-83921-pretty.pretty.stdout +++ b/src/test/ui/repr/issue-83921-pretty.pretty.stdout @@ -13,7 +13,6 @@ extern crate std; // [pretty]compile-flags: -Zunpretty=everybody_loops // [pretty]check-pass #[repr("C")] -struct A { -} +struct A {} -fn main() { loop { } } +fn main() { loop {} } diff --git a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs index 0098f087d10..cb2b585ab96 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs @@ -30,3 +30,15 @@ pub enum VariantNonExhaustive { pub enum NonExhaustiveSingleVariant { A(bool), } + +#[repr(u8)] +pub enum FieldLessWithNonExhaustiveVariant { + A, + B, + #[non_exhaustive] + C, +} + +impl Default for FieldLessWithNonExhaustiveVariant { + fn default() -> Self { Self::A } +} diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs new file mode 100644 index 00000000000..d9657bac776 --- /dev/null +++ b/src/test/ui/rfc-2008-non-exhaustive/enum-as-cast.rs @@ -0,0 +1,17 @@ +// aux-build:enums.rs +// run-pass + +extern crate enums; + +use enums::FieldLessWithNonExhaustiveVariant; + +fn main() { + let e = FieldLessWithNonExhaustiveVariant::default(); + // FIXME: https://github.com/rust-lang/rust/issues/91161 + // This `as` cast *should* be an error, since it would fail + // if the non-exhaustive variant got fields. But today it + // doesn't. The fix for that will update this test to + // show an error (and not be run-pass any more). + let d = e as u8; + assert_eq!(d, 0); +} diff --git a/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout b/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout index aeee43b01cc..6052ea95d0f 100644 --- a/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout +++ b/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.stdout @@ -7,4 +7,4 @@ extern crate std; // build-pass (FIXME(62277): could be check-pass?) // compile-flags: -Z unpretty=expanded -fn main() { if let 0 = 1 { } } +fn main() { if let 0 = 1 {} } diff --git a/src/test/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs b/src/test/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs index 2a172c8458d..8800d3e66f9 100644 --- a/src/test/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs +++ b/src/test/ui/rfc-2565-param-attrs/auxiliary/param-attrs.rs @@ -18,14 +18,14 @@ macro_rules! checker { } checker!(attr_extern, r#"extern "C" { fn ffi(#[a1] arg1 : i32, #[a2] ...) ; }"#); -checker!(attr_extern_cvar, r#"unsafe extern "C" fn cvar(arg1 : i32, #[a1] mut args : ...) { }"#); +checker!(attr_extern_cvar, r#"unsafe extern "C" fn cvar(arg1 : i32, #[a1] mut args : ...) {}"#); checker!(attr_alias, "type Alias = fn(#[a1] u8, #[a2] ...) ;"); checker!(attr_free, "fn free(#[a1] arg1 : u8) { let lam = | #[a2] W(x), #[a3] y | () ; }"); -checker!(attr_inherent_1, "fn inherent1(#[a1] self, #[a2] arg1 : u8) { }"); -checker!(attr_inherent_2, "fn inherent2(#[a1] & self, #[a2] arg1 : u8) { }"); -checker!(attr_inherent_3, "fn inherent3 < 'a > (#[a1] & 'a mut self, #[a2] arg1 : u8) { }"); -checker!(attr_inherent_4, "fn inherent4 < 'a > (#[a1] self : Box < Self >, #[a2] arg1 : u8) { }"); -checker!(attr_inherent_issue_64682, "fn inherent5(#[a1] #[a2] arg1 : u8, #[a3] arg2 : u8) { }"); +checker!(attr_inherent_1, "fn inherent1(#[a1] self, #[a2] arg1 : u8) {}"); +checker!(attr_inherent_2, "fn inherent2(#[a1] & self, #[a2] arg1 : u8) {}"); +checker!(attr_inherent_3, "fn inherent3 < 'a > (#[a1] & 'a mut self, #[a2] arg1 : u8) {}"); +checker!(attr_inherent_4, "fn inherent4 < 'a > (#[a1] self : Box < Self >, #[a2] arg1 : u8) {}"); +checker!(attr_inherent_issue_64682, "fn inherent5(#[a1] #[a2] arg1 : u8, #[a3] arg2 : u8) {}"); checker!(attr_trait_1, "fn trait1(#[a1] self, #[a2] arg1 : u8) ;"); checker!(attr_trait_2, "fn trait2(#[a1] & self, #[a2] arg1 : u8) ;"); checker!(attr_trait_3, "fn trait3 < 'a > (#[a1] & 'a mut self, #[a2] arg1 : u8) ;"); @@ -35,9 +35,9 @@ checker!(attr_trait_issue_64682, "fn trait5(#[a1] #[a2] arg1 : u8, #[a3] arg2 : checker!(rename_params, r#"impl Foo { fn hello(#[angery(true)] a : i32, #[a2] b : i32, #[what = "how"] c : u32) - { } fn + {} fn hello2(#[a1] #[a2] a : i32, #[what = "how"] b : i32, #[angery(true)] c : - u32) { } fn + u32) {} fn hello_self(#[a1] #[a2] & self, #[a1] #[a2] a : i32, #[what = "how"] b : - i32, #[angery(true)] c : u32) { } + i32, #[angery(true)] c : u32) {} }"#); diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.rs b/src/test/ui/rust-2018/uniform-paths/deadlock.rs index 83ed70a0459..2427bde6d18 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.rs +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.rs @@ -1,7 +1,8 @@ // edition:2018 // compile-flags:--extern foo --extern bar +use bar::foo; //~ ERROR can't find crate for `bar` use foo::bar; //~ ERROR can't find crate for `foo` -use bar::foo; +//~^^ ERROR unresolved imports `bar::foo`, `foo::bar` fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr index 9336e90afb7..8b9863948bd 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr @@ -1,9 +1,24 @@ -error[E0463]: can't find crate for `foo` +error[E0463]: can't find crate for `bar` --> $DIR/deadlock.rs:4:5 | +LL | use bar::foo; + | ^^^ can't find crate + +error[E0463]: can't find crate for `foo` + --> $DIR/deadlock.rs:5:5 + | LL | use foo::bar; | ^^^ can't find crate -error: aborting due to previous error +error[E0432]: unresolved imports `bar::foo`, `foo::bar` + --> $DIR/deadlock.rs:4:5 + | +LL | use bar::foo; + | ^^^^^^^^ +LL | use foo::bar; + | ^^^^^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0463`. +Some errors have detailed explanations: E0432, E0463. +For more information about an error, try `rustc --explain E0432`. diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.rs b/src/test/ui/span/issue-43927-non-ADT-derive.rs index 840c12e16e1..935bfa001bf 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.rs +++ b/src/test/ui/span/issue-43927-non-ADT-derive.rs @@ -1,5 +1,6 @@ #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! //~^ ERROR cannot determine resolution for the attribute macro `derive` +//~^^ ERROR `derive` attribute cannot be used at crate level struct DerivedOn; fn main() {} diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.stderr b/src/test/ui/span/issue-43927-non-ADT-derive.stderr index 9ef81c5150a..e3ae37e3689 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.stderr +++ b/src/test/ui/span/issue-43927-non-ADT-derive.stderr @@ -6,5 +6,16 @@ LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! | = note: import resolution is stuck, try simplifying macro imports -error: aborting due to previous error +error: `derive` attribute cannot be used at crate level + --> $DIR/issue-43927-non-ADT-derive.rs:1:1 + | +LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: perhaps you meant to use an outer attribute + | +LL | #[derive(Debug, PartialEq, Eq)] // should be an outer attribute! + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 4759ebea0e9..766db2a8356 100644 --- a/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/src/test/ui/suggestions/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -10,6 +10,7 @@ LL | bar(foo); | required by a bound introduced by this call | = help: the trait `Future` is not implemented for `fn() -> impl Future<Output = ()> {foo}` + = note: fn() -> impl Future<Output = ()> {foo} must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `bar` --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 | @@ -31,6 +32,7 @@ LL | bar(async_closure); | required by a bound introduced by this call | = help: the trait `Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` + = note: [closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36] must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `bar` --> $DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:7:16 | diff --git a/src/test/ui/suggestions/derive-macro-missing-bounds.rs b/src/test/ui/suggestions/derive-macro-missing-bounds.rs new file mode 100644 index 00000000000..56c218f97eb --- /dev/null +++ b/src/test/ui/suggestions/derive-macro-missing-bounds.rs @@ -0,0 +1,89 @@ +mod a { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + + impl Debug for Inner<()> { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); //~ ERROR `a::Inner<T>` doesn't implement `Debug` +} + +mod b { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + + impl<T: Debug> Debug for Inner<T> { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); +} + +mod c { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + trait Trait {} + + impl<T: Debug + Trait> Debug for Inner<T> { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: c::Trait` is not satisfied +} + +mod d { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + trait Trait {} + + impl<T> Debug for Inner<T> where T: Debug, T: Trait { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: d::Trait` is not satisfied +} + +mod e { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + trait Trait {} + + impl<T> Debug for Inner<T> where T: Debug + Trait { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: e::Trait` is not satisfied +} + +mod f { + use std::fmt::{Debug, Formatter, Result}; + struct Inner<T>(T); + trait Trait {} + + impl<T: Debug> Debug for Inner<T> where T: Trait { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + todo!() + } + } + + #[derive(Debug)] + struct Outer<T>(Inner<T>); //~ ERROR the trait bound `T: f::Trait` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/suggestions/derive-macro-missing-bounds.stderr b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr new file mode 100644 index 00000000000..7a4f7e209c1 --- /dev/null +++ b/src/test/ui/suggestions/derive-macro-missing-bounds.stderr @@ -0,0 +1,107 @@ +error[E0277]: `a::Inner<T>` doesn't implement `Debug` + --> $DIR/derive-macro-missing-bounds.rs:12:21 + | +LL | #[derive(Debug)] + | ----- in this derive macro expansion +LL | struct Outer<T>(Inner<T>); + | ^^^^^^^^ `a::Inner<T>` cannot be formatted using `{:?}` + | + = help: the trait `Debug` is not implemented for `a::Inner<T>` + = note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>` + = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement + | +LL | struct Outer<T>(Inner<T>) where a::Inner<T>: Debug; + | ++++++++++++++++++++++++ + +error[E0277]: the trait bound `T: c::Trait` is not satisfied + --> $DIR/derive-macro-missing-bounds.rs:41:21 + | +LL | #[derive(Debug)] + | ----- in this derive macro expansion +LL | struct Outer<T>(Inner<T>); + | ^^^^^^^^ the trait `c::Trait` is not implemented for `T` + | +note: required because of the requirements on the impl of `Debug` for `c::Inner<T>` + --> $DIR/derive-macro-missing-bounds.rs:34:28 + | +LL | impl<T: Debug + Trait> Debug for Inner<T> { + | ^^^^^ ^^^^^^^^ + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `Debug` for `&c::Inner<T>` + = note: required for the cast to the object type `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` + | +LL | struct Outer<T: c::Trait>(Inner<T>); + | ++++++++++ + +error[E0277]: the trait bound `T: d::Trait` is not satisfied + --> $DIR/derive-macro-missing-bounds.rs:56:21 + | +LL | #[derive(Debug)] + | ----- in this derive macro expansion +LL | struct Outer<T>(Inner<T>); + | ^^^^^^^^ the trait `d::Trait` is not implemented for `T` + | +note: required because of the requirements on the impl of `Debug` for `d::Inner<T>` + --> $DIR/derive-macro-missing-bounds.rs:49:13 + | +LL | impl<T> Debug for Inner<T> where T: Debug, T: Trait { + | ^^^^^ ^^^^^^^^ + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `Debug` for `&d::Inner<T>` + = note: required for the cast to the object type `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` + | +LL | struct Outer<T: d::Trait>(Inner<T>); + | ++++++++++ + +error[E0277]: the trait bound `T: e::Trait` is not satisfied + --> $DIR/derive-macro-missing-bounds.rs:71:21 + | +LL | #[derive(Debug)] + | ----- in this derive macro expansion +LL | struct Outer<T>(Inner<T>); + | ^^^^^^^^ the trait `e::Trait` is not implemented for `T` + | +note: required because of the requirements on the impl of `Debug` for `e::Inner<T>` + --> $DIR/derive-macro-missing-bounds.rs:64:13 + | +LL | impl<T> Debug for Inner<T> where T: Debug + Trait { + | ^^^^^ ^^^^^^^^ + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `Debug` for `&e::Inner<T>` + = note: required for the cast to the object type `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` + | +LL | struct Outer<T: e::Trait>(Inner<T>); + | ++++++++++ + +error[E0277]: the trait bound `T: f::Trait` is not satisfied + --> $DIR/derive-macro-missing-bounds.rs:86:21 + | +LL | #[derive(Debug)] + | ----- in this derive macro expansion +LL | struct Outer<T>(Inner<T>); + | ^^^^^^^^ the trait `f::Trait` is not implemented for `T` + | +note: required because of the requirements on the impl of `Debug` for `f::Inner<T>` + --> $DIR/derive-macro-missing-bounds.rs:79:20 + | +LL | impl<T: Debug> Debug for Inner<T> where T: Trait { + | ^^^^^ ^^^^^^^^ + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `Debug` for `&f::Inner<T>` + = note: required for the cast to the object type `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` + | +LL | struct Outer<T: f::Trait>(Inner<T>); + | ++++++++++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/svh/changing-crates.rs b/src/test/ui/svh/changing-crates.rs index 60c043bc43f..66298e06ed6 100644 --- a/src/test/ui/svh/changing-crates.rs +++ b/src/test/ui/svh/changing-crates.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:changing-crates-a1.rs // aux-build:changing-crates-b.rs diff --git a/src/test/ui/svh/changing-crates.stderr b/src/test/ui/svh/changing-crates.stderr index cc62a4d4d9d..7244919e86d 100644 --- a/src/test/ui/svh/changing-crates.stderr +++ b/src/test/ui/svh/changing-crates.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/changing-crates.rs:10:1 + --> $DIR/changing-crates.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-lit.rs b/src/test/ui/svh/svh-change-lit.rs index 7d991cc9971..ea500711bb7 100644 --- a/src/test/ui/svh/svh-change-lit.rs +++ b/src/test/ui/svh/svh-change-lit.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-lit.stderr b/src/test/ui/svh/svh-change-lit.stderr index bf51e31bfd6..1e97e9d0557 100644 --- a/src/test/ui/svh/svh-change-lit.stderr +++ b/src/test/ui/svh/svh-change-lit.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-lit.rs:10:1 + --> $DIR/svh-change-lit.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-significant-cfg.rs b/src/test/ui/svh/svh-change-significant-cfg.rs index 8cf0d9ccaf1..ff919ea83d5 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.rs +++ b/src/test/ui/svh/svh-change-significant-cfg.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-significant-cfg.stderr b/src/test/ui/svh/svh-change-significant-cfg.stderr index c747464db75..f04046f4c87 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.stderr +++ b/src/test/ui/svh/svh-change-significant-cfg.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-significant-cfg.rs:10:1 + --> $DIR/svh-change-significant-cfg.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-trait-bound.rs b/src/test/ui/svh/svh-change-trait-bound.rs index ddd10ac068d..a4ba06eaf2e 100644 --- a/src/test/ui/svh/svh-change-trait-bound.rs +++ b/src/test/ui/svh/svh-change-trait-bound.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-trait-bound.stderr b/src/test/ui/svh/svh-change-trait-bound.stderr index b144b3b70da..a778c61806a 100644 --- a/src/test/ui/svh/svh-change-trait-bound.stderr +++ b/src/test/ui/svh/svh-change-trait-bound.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-trait-bound.rs:10:1 + --> $DIR/svh-change-trait-bound.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-arg.rs b/src/test/ui/svh/svh-change-type-arg.rs index f845ab5bc6a..d1651814bf6 100644 --- a/src/test/ui/svh/svh-change-type-arg.rs +++ b/src/test/ui/svh/svh-change-type-arg.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-type-arg.stderr b/src/test/ui/svh/svh-change-type-arg.stderr index 473e4000d2d..f09babf93fd 100644 --- a/src/test/ui/svh/svh-change-type-arg.stderr +++ b/src/test/ui/svh/svh-change-type-arg.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-arg.rs:10:1 + --> $DIR/svh-change-type-arg.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-ret.rs b/src/test/ui/svh/svh-change-type-ret.rs index fb3e996c5fd..a4be50a6433 100644 --- a/src/test/ui/svh/svh-change-type-ret.rs +++ b/src/test/ui/svh/svh-change-type-ret.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-type-ret.stderr b/src/test/ui/svh/svh-change-type-ret.stderr index ecb332fc5b5..0998cd4b549 100644 --- a/src/test/ui/svh/svh-change-type-ret.stderr +++ b/src/test/ui/svh/svh-change-type-ret.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-ret.rs:10:1 + --> $DIR/svh-change-type-ret.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-static.rs b/src/test/ui/svh/svh-change-type-static.rs index 0dfcaa0003b..c470761be19 100644 --- a/src/test/ui/svh/svh-change-type-static.rs +++ b/src/test/ui/svh/svh-change-type-static.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/ui/svh/svh-change-type-static.stderr b/src/test/ui/svh/svh-change-type-static.stderr index 33f7e3c485a..9c48cbd30a5 100644 --- a/src/test/ui/svh/svh-change-type-static.stderr +++ b/src/test/ui/svh/svh-change-type-static.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-static.rs:10:1 + --> $DIR/svh-change-type-static.rs:8:1 | LL | extern crate b; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-use-trait.rs b/src/test/ui/svh/svh-use-trait.rs index e5c427e096a..e144fdffb52 100644 --- a/src/test/ui/svh/svh-use-trait.rs +++ b/src/test/ui/svh/svh-use-trait.rs @@ -1,5 +1,3 @@ -// ignore-msvc FIXME #31306 - // note that these aux-build directives must be in this order // aux-build:svh-uta-base.rs // aux-build:svh-utb.rs diff --git a/src/test/ui/svh/svh-use-trait.stderr b/src/test/ui/svh/svh-use-trait.stderr index 3230bb5c384..5780cfef357 100644 --- a/src/test/ui/svh/svh-use-trait.stderr +++ b/src/test/ui/svh/svh-use-trait.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `uta` which `utb` depends on - --> $DIR/svh-use-trait.rs:15:1 + --> $DIR/svh-use-trait.rs:13:1 | LL | extern crate utb; | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/project-modulo-regions.rs b/src/test/ui/traits/project-modulo-regions.rs new file mode 100644 index 00000000000..f0c0dd3ed95 --- /dev/null +++ b/src/test/ui/traits/project-modulo-regions.rs @@ -0,0 +1,55 @@ +// revisions: with_clause without_clause +// Tests that `EvaluatedToOkModuloRegions` from a projection sub-obligation +// is correctly propagated + +#![feature(rustc_attrs)] + +trait MyTrait { + type Assoc; +} + +struct MyStruct; + +impl MyTrait for MyStruct { + // Evaluating this projection will result in `EvaluatedToOkModuloRegions` + // (when `with_clause` is enabled) + type Assoc = <Bar as MyTrait>::Assoc; +} + +struct Bar; + +// The `where` clause on this impl will cause us to produce `EvaluatedToOkModuloRegions` +// when evaluating a projection involving this impl +#[cfg(with_clause)] +impl MyTrait for Bar where for<'b> &'b (): 'b { + type Assoc = bool; +} + +// This impl tests that the `EvaluatedToOkModuoRegions` result that we get +// is really due to the `where` clause on the `with_clause` impl +#[cfg(without_clause)] +impl MyTrait for Bar { + type Assoc = bool; +} + +// The implementation of `#[rustc_evaluate_where_clauses]` doesn't perform +// normalization, so we need to place the projection predicate behind a normal +// trait predicate +struct Helper {} +trait HelperTrait {} +impl HelperTrait for Helper where <MyStruct as MyTrait>::Assoc: Sized {} + +// Evaluating this 'where' clause will (recursively) end up evaluating +// `for<'b> &'b (): 'b`, which will produce `EvaluatedToOkModuloRegions` +#[rustc_evaluate_where_clauses] +fn test(val: MyStruct) where Helper: HelperTrait { + panic!() +} + +fn foo(val: MyStruct) { + test(val); + //[with_clause]~^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) + //[without_clause]~^^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOk) +} + +fn main() {} diff --git a/src/test/ui/traits/project-modulo-regions.with_clause.stderr b/src/test/ui/traits/project-modulo-regions.with_clause.stderr new file mode 100644 index 00000000000..2434c32c818 --- /dev/null +++ b/src/test/ui/traits/project-modulo-regions.with_clause.stderr @@ -0,0 +1,11 @@ +error: evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) + --> $DIR/project-modulo-regions.rs:50:5 + | +LL | fn test(val: MyStruct) where Helper: HelperTrait { + | ----------- predicate +... +LL | test(val); + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/traits/project-modulo-regions.without_clause.stderr b/src/test/ui/traits/project-modulo-regions.without_clause.stderr new file mode 100644 index 00000000000..9d35690d5f0 --- /dev/null +++ b/src/test/ui/traits/project-modulo-regions.without_clause.stderr @@ -0,0 +1,11 @@ +error: evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOk) + --> $DIR/project-modulo-regions.rs:50:5 + | +LL | fn test(val: MyStruct) where Helper: HelperTrait { + | ----------- predicate +... +LL | test(val); + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/type/issue-91268.rs b/src/test/ui/type/issue-91268.rs new file mode 100644 index 00000000000..fd2733c1c54 --- /dev/null +++ b/src/test/ui/type/issue-91268.rs @@ -0,0 +1,9 @@ +// error-pattern: this file contains an unclosed delimiter +// error-pattern: cannot find type `ţ` in this scope +// error-pattern: parenthesized type parameters may only be used with a `Fn` trait +// error-pattern: type arguments are not allowed for this type +// error-pattern: mismatched types +// ignore-tidy-trailing-newlines +// `ţ` must be the last character in this file, it cannot be followed by a newline +fn main() { + 0: u8(ţ \ No newline at end of file diff --git a/src/test/ui/type/issue-91268.stderr b/src/test/ui/type/issue-91268.stderr new file mode 100644 index 00000000000..2fe6ba6248c --- /dev/null +++ b/src/test/ui/type/issue-91268.stderr @@ -0,0 +1,50 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-91268.rs:9:12 + | +LL | fn main() { + | - unclosed delimiter +LL | 0: u8(ţ + | - ^ + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-91268.rs:9:12 + | +LL | fn main() { + | - unclosed delimiter +LL | 0: u8(ţ + | - ^ + | | + | unclosed delimiter + +error[E0412]: cannot find type `ţ` in this scope + --> $DIR/issue-91268.rs:9:11 + | +LL | 0: u8(ţ + | ^ expecting a type here because of type ascription + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-91268.rs:9:8 + | +LL | 0: u8(ţ + | ^^^^ only `Fn` traits may use parentheses + +error[E0109]: type arguments are not allowed for this type + --> $DIR/issue-91268.rs:9:11 + | +LL | 0: u8(ţ + | ^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/issue-91268.rs:9:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | 0: u8(ţ + | ^^^^^^^ expected `()`, found `u8` + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0109, E0214, E0308, E0412. +For more information about an error, try `rustc --explain E0109`. diff --git a/src/test/ui/typeck/issue-91210-ptr-method.fixed b/src/test/ui/typeck/issue-91210-ptr-method.fixed new file mode 100644 index 00000000000..94200cce73e --- /dev/null +++ b/src/test/ui/typeck/issue-91210-ptr-method.fixed @@ -0,0 +1,15 @@ +// Regression test for issue #91210. + +// run-rustfix + +#![allow(unused)] + +struct Foo { read: i32 } + +unsafe fn blah(x: *mut Foo) { + (*x).read = 4; + //~^ ERROR: attempted to take value of method + //~| HELP: to access the field, dereference first +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-91210-ptr-method.rs b/src/test/ui/typeck/issue-91210-ptr-method.rs new file mode 100644 index 00000000000..ed0ce6effe7 --- /dev/null +++ b/src/test/ui/typeck/issue-91210-ptr-method.rs @@ -0,0 +1,15 @@ +// Regression test for issue #91210. + +// run-rustfix + +#![allow(unused)] + +struct Foo { read: i32 } + +unsafe fn blah(x: *mut Foo) { + x.read = 4; + //~^ ERROR: attempted to take value of method + //~| HELP: to access the field, dereference first +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-91210-ptr-method.stderr b/src/test/ui/typeck/issue-91210-ptr-method.stderr new file mode 100644 index 00000000000..503a32373d5 --- /dev/null +++ b/src/test/ui/typeck/issue-91210-ptr-method.stderr @@ -0,0 +1,11 @@ +error[E0615]: attempted to take value of method `read` on type `*mut Foo` + --> $DIR/issue-91210-ptr-method.rs:10:7 + | +LL | x.read = 4; + | - ^^^^ method, not a field + | | + | help: to access the field, dereference first: `(*x)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0615`. diff --git a/src/test/ui/typeck/issue-91334.rs b/src/test/ui/typeck/issue-91334.rs new file mode 100644 index 00000000000..bf9a5a62620 --- /dev/null +++ b/src/test/ui/typeck/issue-91334.rs @@ -0,0 +1,10 @@ +// Regression test for the ICE described in issue #91334. + +// error-pattern: this file contains an unclosed delimiter +// error-pattern: expected one of +// error-pattern: mismatched closing delimiter +// error-pattern: mismatched types + +#![feature(generators)] + +fn f(){||yield(((){), diff --git a/src/test/ui/typeck/issue-91334.stderr b/src/test/ui/typeck/issue-91334.stderr new file mode 100644 index 00000000000..358cc771b7c --- /dev/null +++ b/src/test/ui/typeck/issue-91334.stderr @@ -0,0 +1,50 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-91334.rs:10:23 + | +LL | fn f(){||yield(((){), + | - - ^ + | | | + | | unclosed delimiter + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-91334.rs:10:23 + | +LL | fn f(){||yield(((){), + | - - ^ + | | | + | | unclosed delimiter + | unclosed delimiter + +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `{` + --> $DIR/issue-91334.rs:10:19 + | +LL | fn f(){||yield(((){), + | ^ + | | + | expected one of `)`, `,`, `.`, `?`, or an operator + | help: missing `,` + +error: mismatched closing delimiter: `)` + --> $DIR/issue-91334.rs:10:19 + | +LL | fn f(){||yield(((){), + | - ^^ mismatched closing delimiter + | | | + | | unclosed delimiter + | closing delimiter possibly meant for this + +error[E0308]: mismatched types + --> $DIR/issue-91334.rs:10:8 + | +LL | fn f(){||yield(((){), + | -^^^^^^^^^^^^^^^ expected `()`, found generator + | | + | help: try adding a return type: `-> [generator@$DIR/issue-91334.rs:10:8: 10:23]` + | + = note: expected unit type `()` + found generator `[generator@$DIR/issue-91334.rs:10:8: 10:23]` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/issue-91450-inner-ty-error.rs b/src/test/ui/typeck/issue-91450-inner-ty-error.rs new file mode 100644 index 00000000000..0b942d6d94f --- /dev/null +++ b/src/test/ui/typeck/issue-91450-inner-ty-error.rs @@ -0,0 +1,7 @@ +// Regression test for #91450. +// This test ensures that the compiler does not suggest `Foo<[type error]>` in diagnostic messages. + +fn foo() -> Option<_> {} //~ ERROR: [E0308] +//~^ ERROR: the type placeholder `_` is not allowed + +fn main() {} diff --git a/src/test/ui/typeck/issue-91450-inner-ty-error.stderr b/src/test/ui/typeck/issue-91450-inner-ty-error.stderr new file mode 100644 index 00000000000..314fe561803 --- /dev/null +++ b/src/test/ui/typeck/issue-91450-inner-ty-error.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-91450-inner-ty-error.rs:4:13 + | +LL | fn foo() -> Option<_> {} + | --- ^^^^^^^^^ expected enum `Option`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected enum `Option<_>` + found unit type `()` + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/issue-91450-inner-ty-error.rs:4:20 + | +LL | fn foo() -> Option<_> {} + | ^ not allowed in type signatures + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0121, E0308. +For more information about an error, try `rustc --explain E0121`. diff --git a/src/test/ui/union/issue-81199.rs b/src/test/ui/union/issue-81199.rs new file mode 100644 index 00000000000..628e7c6ed5d --- /dev/null +++ b/src/test/ui/union/issue-81199.rs @@ -0,0 +1,21 @@ +#[repr(C)] +union PtrRepr<T: ?Sized> { + const_ptr: *const T, + mut_ptr: *mut T, + components: PtrComponents<T>, + //~^ ERROR the trait bound +} + +#[repr(C)] +struct PtrComponents<T: Pointee + ?Sized> { + data_address: *const (), + metadata: <T as Pointee>::Metadata, +} + + + +pub trait Pointee { + type Metadata; +} + +fn main() {} diff --git a/src/test/ui/union/issue-81199.stderr b/src/test/ui/union/issue-81199.stderr new file mode 100644 index 00000000000..f26bfe3a0b0 --- /dev/null +++ b/src/test/ui/union/issue-81199.stderr @@ -0,0 +1,29 @@ +error[E0277]: the trait bound `T: Pointee` is not satisfied in `PtrComponents<T>` + --> $DIR/issue-81199.rs:5:17 + | +LL | components: PtrComponents<T>, + | ^^^^^^^^^^^^^^^^ within `PtrComponents<T>`, the trait `Pointee` is not implemented for `T` + | +note: required because it appears within the type `PtrComponents<T>` + --> $DIR/issue-81199.rs:10:8 + | +LL | struct PtrComponents<T: Pointee + ?Sized> { + | ^^^^^^^^^^^^^ + = note: no field of a union may have a dynamically sized type + = help: change the field's type to have a statically known size +help: consider further restricting this bound + | +LL | union PtrRepr<T: ?Sized + Pointee> { + | +++++++++ +help: borrowed types always have a statically known size + | +LL | components: &PtrComponents<T>, + | + +help: the `Box` type always has a statically known size and allocates its contents in the heap + | +LL | components: Box<PtrComponents<T>>, + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
