diff options
Diffstat (limited to 'tests/ui/issues')
91 files changed, 169 insertions, 1028 deletions
diff --git a/tests/ui/issues/auxiliary/issue-111011.rs b/tests/ui/issues/auxiliary/issue-111011.rs new file mode 100644 index 000000000..927134a58 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-111011.rs @@ -0,0 +1,12 @@ +#![feature(async_closure)] + +// edition:2021 + +fn foo<X>(x: impl FnOnce() -> Box<X>) {} +// just to make sure async closures can still be suggested for boxing. +fn bar<X>(x: Box<dyn FnOnce() -> X>) {} + +fn main() { + foo(async move || {}); //~ ERROR mismatched types + bar(async move || {}); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/auxiliary/issue-111011.stderr b/tests/ui/issues/auxiliary/issue-111011.stderr new file mode 100644 index 000000000..082f0f035 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-111011.stderr @@ -0,0 +1,34 @@ +error[E0308]: mismatched types + --> $DIR/issue-111011.rs:10:23 + | +LL | foo(async move || {}); + | ^^ expected `Box<_>`, found `async` closure body + | + = note: expected struct `Box<_>` + found `async` closure body `[async closure body@$DIR/issue-111011.rs:10:23: 10:25]` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html + +error[E0308]: mismatched types + --> $DIR/issue-111011.rs:11:9 + | +LL | bar(async move || {}); + | --- ^^^^^^^^^^^^^^^^ expected `Box<dyn FnOnce() -> _>`, found closure + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<(dyn FnOnce() -> _ + 'static)>` + found closure `[closure@$DIR/issue-111011.rs:11:9: 11:22]` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: function defined here + --> $DIR/issue-111011.rs:7:4 + | +LL | fn bar<X>(x: Box<dyn FnOnce() -> X>) {} + | ^^^ ------------------------- +help: store this in the heap by calling `Box::new` + | +LL | bar(Box::new(async move || {})); + | +++++++++ + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/auxiliary/issue-3136-a.rc b/tests/ui/issues/auxiliary/issue-3136-a.rc deleted file mode 100644 index cd5fd3145..000000000 --- a/tests/ui/issues/auxiliary/issue-3136-a.rc +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -#[path = "issue-3136-a.rs"] -pub mod issue_3136_a; diff --git a/tests/ui/issues/auxiliary/issue-3136-a.rs b/tests/ui/issues/auxiliary/issue-3136-a.rs index 9bb546ab3..22bb1c8f9 100644 --- a/tests/ui/issues/auxiliary/issue-3136-a.rs +++ b/tests/ui/issues/auxiliary/issue-3136-a.rs @@ -1,11 +1,14 @@ +#![crate_type = "lib"] + trait x { fn use_x<T>(&self); } struct y(()); impl x for y { fn use_x<T>(&self) { - struct foo { //~ ERROR quux - i: () + struct foo { + //~ ERROR quux + i: (), } fn new_foo<T>(i: ()) -> foo { foo { i: i } diff --git a/tests/ui/issues/auxiliary/issue-41394.rs b/tests/ui/issues/auxiliary/issue-41394.rs deleted file mode 100644 index 2e650efc7..000000000 --- a/tests/ui/issues/auxiliary/issue-41394.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![crate_type = "lib"] - -#[repr(u32)] -pub enum Foo { - Foo = Private::Variant as u32 -} - -#[repr(u8)] -enum Private { - Variant = 42 -} - -#[inline(always)] -pub fn foo() -> Foo { - Foo::Foo -} diff --git a/tests/ui/issues/issue-11374.stderr b/tests/ui/issues/issue-11374.stderr index 6e1fb1540..879dc5b76 100644 --- a/tests/ui/issues/issue-11374.stderr +++ b/tests/ui/issues/issue-11374.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-11374.rs:26:15 | LL | c.read_to(v); - | ------- ^ - | | | - | | expected `&mut [u8]`, found `Vec<_>` - | | help: consider mutably borrowing here: `&mut v` + | ------- ^ expected `&mut [u8]`, found `Vec<_>` + | | | arguments to this method are incorrect | = note: expected mutable reference `&mut [u8]` @@ -15,6 +13,10 @@ note: method defined here | LL | pub fn read_to(&mut self, vec: &mut [u8]) { | ^^^^^^^ -------------- +help: consider mutably borrowing here + | +LL | c.read_to(&mut v); + | ++++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-12511.rs b/tests/ui/issues/issue-12511.rs deleted file mode 100644 index ea83e3fd9..000000000 --- a/tests/ui/issues/issue-12511.rs +++ /dev/null @@ -1,8 +0,0 @@ -trait T1 : T2 { -//~^ ERROR cycle detected -} - -trait T2 : T1 { -} - -fn main() { } diff --git a/tests/ui/issues/issue-12511.stderr b/tests/ui/issues/issue-12511.stderr deleted file mode 100644 index 558aad109..000000000 --- a/tests/ui/issues/issue-12511.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0391]: cycle detected when computing the super predicates of `T1` - --> $DIR/issue-12511.rs:1:12 - | -LL | trait T1 : T2 { - | ^^ - | -note: ...which requires computing the super predicates of `T2`... - --> $DIR/issue-12511.rs:5:12 - | -LL | trait T2 : T1 { - | ^^ - = note: ...which again requires computing the super predicates of `T1`, completing the cycle -note: cycle used when collecting item types in top-level module - --> $DIR/issue-12511.rs:1:1 - | -LL | / trait T1 : T2 { -LL | | -LL | | } - | |_^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/issues/issue-12997-1.rs b/tests/ui/issues/issue-12997-1.rs deleted file mode 100644 index 9f808dac3..000000000 --- a/tests/ui/issues/issue-12997-1.rs +++ /dev/null @@ -1,11 +0,0 @@ -// compile-flags: --test - -//! Test that makes sure wrongly-typed bench functions aren't ignored - -#![feature(test)] - -#[bench] -fn foo() { } //~ ERROR functions used as benches - -#[bench] -fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches diff --git a/tests/ui/issues/issue-12997-1.stderr b/tests/ui/issues/issue-12997-1.stderr deleted file mode 100644 index 00c605174..000000000 --- a/tests/ui/issues/issue-12997-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` - --> $DIR/issue-12997-1.rs:8:1 - | -LL | fn foo() { } - | ^^^^^^^^^^^^ - -error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` - --> $DIR/issue-12997-1.rs:11:1 - | -LL | fn bar(x: isize, y: isize) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-12997-2.rs b/tests/ui/issues/issue-12997-2.rs deleted file mode 100644 index 9df965315..000000000 --- a/tests/ui/issues/issue-12997-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: --test - -//! Test that makes sure wrongly-typed bench functions are rejected - -#![feature(test)] - -#[bench] -fn bar(x: isize) { } -//~^ ERROR mismatched types diff --git a/tests/ui/issues/issue-12997-2.stderr b/tests/ui/issues/issue-12997-2.stderr deleted file mode 100644 index 2a3d0e345..000000000 --- a/tests/ui/issues/issue-12997-2.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-12997-2.rs:8:1 - | -LL | #[bench] - | -------- in this procedural macro expansion -LL | fn bar(x: isize) { } - | ^^^^^^^^^^^^^^^^^^^^ - | | - | expected `isize`, found `&mut Bencher` - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/issue-12997-2.rs:8:4 - | -LL | fn bar(x: isize) { } - | ^^^ -------- - = note: this error originates in the attribute macro `bench` (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 E0308`. diff --git a/tests/ui/issues/issue-14366.stderr b/tests/ui/issues/issue-14366.stderr index 10a73b245..df61aabf0 100644 --- a/tests/ui/issues/issue-14366.stderr +++ b/tests/ui/issues/issue-14366.stderr @@ -5,8 +5,8 @@ LL | let _x = "test" as &dyn (::std::any::Any); | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` - = note: required for the cast from `str` to the object type `dyn Any` -help: consider borrowing the value, since `&str` can be coerced into `dyn Any` + = note: required for the cast from `&'static str` to `&(dyn Any + 'static)` +help: consider borrowing the value, since `&&'static str` can be coerced into `&(dyn Any + 'static)` | LL | let _x = &"test" as &dyn (::std::any::Any); | + diff --git a/tests/ui/issues/issue-15689-1.rs b/tests/ui/issues/issue-15689-1.rs deleted file mode 100644 index d143926b2..000000000 --- a/tests/ui/issues/issue-15689-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -#[derive(PartialEq, Debug)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() { - assert_eq!(Test::Slice(&1), Test::Slice(&1)) -} diff --git a/tests/ui/issues/issue-15689-2.rs b/tests/ui/issues/issue-15689-2.rs deleted file mode 100644 index 83dcb1406..000000000 --- a/tests/ui/issues/issue-15689-2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() {} diff --git a/tests/ui/issues/issue-17033.stderr b/tests/ui/issues/issue-17033.stderr index f26bee5ff..3419c0798 100644 --- a/tests/ui/issues/issue-17033.stderr +++ b/tests/ui/issues/issue-17033.stderr @@ -2,11 +2,14 @@ error[E0308]: mismatched types --> $DIR/issue-17033.rs:2:10 | LL | (*p)(()) - | ---- ^^ - | | | - | | expected `&mut ()`, found `()` - | | help: consider mutably borrowing here: `&mut ()` + | ---- ^^ expected `&mut ()`, found `()` + | | | arguments to this function are incorrect + | +help: consider mutably borrowing here + | +LL | (*p)(&mut ()) + | ++++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-18107.stderr b/tests/ui/issues/issue-18107.stderr index 1669b550a..cf4e06316 100644 --- a/tests/ui/issues/issue-18107.stderr +++ b/tests/ui/issues/issue-18107.stderr @@ -4,14 +4,18 @@ error[E0746]: return type cannot have an unboxed trait object LL | dyn AbstractRenderer | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | -help: use `impl AbstractRenderer` as the return type if all return paths have the same type but you want to expose only the trait in the signature +help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type | LL | impl AbstractRenderer + | ~~~~ +help: box the return type, and wrap all of the returned values in `Box::new` | -help: use a boxed trait object if all return paths implement trait `AbstractRenderer` +LL ~ Box<dyn AbstractRenderer> +LL | +LL | { +LL | match 0 { +LL ~ _ => Box::new(unimplemented!()) | -LL | Box<dyn AbstractRenderer> - | ++++ + error: aborting due to previous error diff --git a/tests/ui/issues/issue-1821.rs b/tests/ui/issues/issue-1821.rs deleted file mode 100644 index 76ee9c3ed..000000000 --- a/tests/ui/issues/issue-1821.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -// Issue #1821 - Don't recurse trying to typecheck this - - -// pretty-expanded FIXME #23616 - -enum t { - foo(Vec<t>) -} -pub fn main() {} diff --git a/tests/ui/issues/issue-18819.stderr b/tests/ui/issues/issue-18819.stderr index 1fc974b60..40098f962 100644 --- a/tests/ui/issues/issue-18819.stderr +++ b/tests/ui/issues/issue-18819.stderr @@ -19,7 +19,7 @@ LL | fn print_x(_: &dyn Foo<Item=bool>, extra: &str) { help: consider borrowing here | LL | print_x(&X); - | ~~ + | + help: provide the argument | LL | print_x(/* &dyn Foo<Item = bool> */, /* &str */); diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs index 5beb1d8b8..38103ff4f 100644 --- a/tests/ui/issues/issue-21763.rs +++ b/tests/ui/issues/issue-21763.rs @@ -1,5 +1,7 @@ // Regression test for HashMap only impl'ing Send/Sync if its contents do +// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" + use std::collections::HashMap; use std::rc::Rc; diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr index 04379f07b..df50118ac 100644 --- a/tests/ui/issues/issue-21763.stderr +++ b/tests/ui/issues/issue-21763.stderr @@ -1,5 +1,5 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/issue-21763.rs:9:11 + --> $DIR/issue-21763.rs:11:11 | LL | foo::<HashMap<Rc<()>, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely @@ -7,10 +7,15 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>(); = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` = note: required because it appears within the type `(Rc<()>, Rc<()>)` = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` - = note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>` - = note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` +note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>` + --> $HASHBROWN_SRC_LOCATION + | +LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> { + | ^^^^^^^ +note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` + --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL note: required by a bound in `foo` - --> $DIR/issue-21763.rs:6:11 + --> $DIR/issue-21763.rs:8:11 | LL | fn foo<T: Send>() {} | ^^^^ required by this bound in `foo` diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/issues/issue-22034.stderr index b32de5b24..9833e559c 100644 --- a/tests/ui/issues/issue-22034.stderr +++ b/tests/ui/issues/issue-22034.stderr @@ -6,7 +6,7 @@ LL | &mut *(ptr as *mut dyn Fn()) | = help: the trait `Fn<()>` is not implemented for `()` = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }` - = note: required for the cast from `()` to the object type `dyn Fn()` + = note: required for the cast from `*mut ()` to `*mut dyn Fn()` error: aborting due to previous error diff --git a/tests/ui/issues/issue-22384.rs b/tests/ui/issues/issue-22384.rs deleted file mode 100644 index 98988f27e..000000000 --- a/tests/ui/issues/issue-22384.rs +++ /dev/null @@ -1,8 +0,0 @@ -trait Trait { - fn foo(); -} - -fn main() { - <<i32 as Copy>::foobar as Trait>::foo(); - //~^ ERROR cannot find associated type `foobar` in trait `Copy` -} diff --git a/tests/ui/issues/issue-22384.stderr b/tests/ui/issues/issue-22384.stderr deleted file mode 100644 index 1f767a443..000000000 --- a/tests/ui/issues/issue-22384.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0576]: cannot find associated type `foobar` in trait `Copy` - --> $DIR/issue-22384.rs:6:21 - | -LL | <<i32 as Copy>::foobar as Trait>::foo(); - | ^^^^^^ not found in `Copy` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0576`. diff --git a/tests/ui/issues/issue-22644.rs b/tests/ui/issues/issue-22644.rs index b1d69dcd8..e3ada6504 100644 --- a/tests/ui/issues/issue-22644.rs +++ b/tests/ui/issues/issue-22644.rs @@ -1,18 +1,12 @@ -#![feature(type_ascription)] - fn main() { - let a : usize = 0; - let long_name : usize = 0; + let a: usize = 0; + let long_name: usize = 0; println!("{}", a as usize > long_name); println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic println!("{}{}", a as usize < long_name, long_name); //~^ ERROR `<` is interpreted as a start of generic println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic - println!("{}", a: usize > long_name); - println!("{}{}", a: usize < long_name, long_name); - //~^ ERROR `<` is interpreted as a start of generic - println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic println!("{}", a as @@ -30,6 +24,4 @@ fn main() { 5); println!("{}", a as usize << long_name); //~ ERROR `<<` is interpreted as a start of generic - - println!("{}", a: &mut 4); //~ ERROR expected type, found `4` } diff --git a/tests/ui/issues/issue-22644.stderr b/tests/ui/issues/issue-22644.stderr index 45027afa7..0799e9ef1 100644 --- a/tests/ui/issues/issue-22644.stderr +++ b/tests/ui/issues/issue-22644.stderr @@ -1,5 +1,5 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:8:31 + --> $DIR/issue-22644.rs:6:31 | LL | println!("{}", a as usize < long_name); | ^ --------- interpreted as generic arguments @@ -12,7 +12,7 @@ LL | println!("{}", (a as usize) < long_name); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:9:33 + --> $DIR/issue-22644.rs:7:33 | LL | println!("{}{}", a as usize < long_name, long_name); | ^ -------------------- interpreted as generic arguments @@ -25,7 +25,7 @@ LL | println!("{}{}", (a as usize) < long_name, long_name); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:11:31 + --> $DIR/issue-22644.rs:9:31 | LL | println!("{}", a as usize < 4); | ^ - interpreted as generic arguments @@ -38,33 +38,7 @@ LL | println!("{}", (a as usize) < 4); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:13:31 - | -LL | println!("{}{}", a: usize < long_name, long_name); - | ^ -------------------- interpreted as generic arguments - | | - | not interpreted as comparison - | -help: try comparing the cast value - | -LL | println!("{}{}", (a: usize) < long_name, long_name); - | + + - -error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:15:29 - | -LL | println!("{}", a: usize < 4); - | ^ - interpreted as generic arguments - | | - | not interpreted as comparison - | -help: try comparing the cast value - | -LL | println!("{}", (a: usize) < 4); - | + + - -error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:20:20 + --> $DIR/issue-22644.rs:14:20 | LL | < | ^ not interpreted as comparison @@ -79,7 +53,7 @@ LL ~ usize) | error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:29:20 + --> $DIR/issue-22644.rs:23:20 | LL | < | ^ not interpreted as comparison @@ -96,7 +70,7 @@ LL ~ usize) | error: `<<` is interpreted as a start of generic arguments for `usize`, not a shift - --> $DIR/issue-22644.rs:32:31 + --> $DIR/issue-22644.rs:26:31 | LL | println!("{}", a as usize << long_name); | ^^ --------- interpreted as generic arguments @@ -108,16 +82,5 @@ help: try shifting the cast value LL | println!("{}", (a as usize) << long_name); | + + -error: expected type, found `4` - --> $DIR/issue-22644.rs:34:28 - | -LL | println!("{}", a: &mut 4); - | - ^ expected type - | | - | tried to parse a type due to this type ascription - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` - = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information - -error: aborting due to 9 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/issues/issue-22872.stderr b/tests/ui/issues/issue-22872.stderr index 951019719..63222d25c 100644 --- a/tests/ui/issues/issue-22872.stderr +++ b/tests/ui/issues/issue-22872.stderr @@ -13,7 +13,7 @@ LL | impl<'b, P> Wrap<'b> for Wrapper<P> LL | where P: Process<'b>, LL | <P as Process<'b>>::Item: Iterator { | -------- unsatisfied trait bound introduced here - = note: required for the cast from `Wrapper<P>` to the object type `dyn for<'b> Wrap<'b>` + = note: required for the cast from `Box<Wrapper<P>>` to `Box<dyn for<'b> Wrap<'b>>` help: consider further restricting the associated type | LL | fn push_process<P>(process: P) where P: Process<'static>, <P as Process<'_>>::Item: Iterator { diff --git a/tests/ui/issues/issue-25901.rs b/tests/ui/issues/issue-25901.rs index 1f7b341a9..85e12463a 100644 --- a/tests/ui/issues/issue-25901.rs +++ b/tests/ui/issues/issue-25901.rs @@ -2,7 +2,7 @@ struct A; struct B; static S: &'static B = &A; -//~^ ERROR the trait bound +//~^ ERROR cannot perform deref coercion use std::ops::Deref; diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr index b9cac3222..1427e4385 100644 --- a/tests/ui/issues/issue-25901.stderr +++ b/tests/ui/issues/issue-25901.stderr @@ -1,15 +1,24 @@ -error[E0277]: the trait bound `A: Deref` is not satisfied +error[E0015]: cannot perform deref coercion on `A` in statics --> $DIR/issue-25901.rs:4:24 | LL | static S: &'static B = &A; - | ^^ the trait `~const Deref` is not implemented for `A` + | ^^ | -note: the trait `Deref` is implemented for `A`, but that implementation is not `const` - --> $DIR/issue-25901.rs:4:24 + = note: attempting to deref into `B` +note: deref defined here + --> $DIR/issue-25901.rs:10:5 | -LL | static S: &'static B = &A; - | ^^ +LL | type Target = B; + | ^^^^^^^^^^^ +note: impl defined here, but it is not `const` + --> $DIR/issue-25901.rs:9:1 + | +LL | impl Deref for A { + | ^^^^^^^^^^^^^^^^ + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/issues/issue-26094.rs b/tests/ui/issues/issue-26094.rs deleted file mode 100644 index 2742529ed..000000000 --- a/tests/ui/issues/issue-26094.rs +++ /dev/null @@ -1,12 +0,0 @@ -macro_rules! some_macro { - ($other: expr) => {{ - $other(None) //~ NOTE unexpected argument of type `Option<_>` - }}; -} - -fn some_function() {} //~ NOTE defined here - -fn main() { - some_macro!(some_function); - //~^ ERROR function takes 0 arguments but 1 argument was supplied -} diff --git a/tests/ui/issues/issue-26094.stderr b/tests/ui/issues/issue-26094.stderr deleted file mode 100644 index ecdf48470..000000000 --- a/tests/ui/issues/issue-26094.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/issue-26094.rs:10:17 - | -LL | $other(None) - | ---- unexpected argument of type `Option<_>` -... -LL | some_macro!(some_function); - | ^^^^^^^^^^^^^ - | -note: function defined here - --> $DIR/issue-26094.rs:7:4 - | -LL | fn some_function() {} - | ^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/issues/issue-2748-a.rs b/tests/ui/issues/issue-2748-a.rs deleted file mode 100644 index cbb9bcc28..000000000 --- a/tests/ui/issues/issue-2748-a.rs +++ /dev/null @@ -1,17 +0,0 @@ -// build-pass -#![allow(dead_code)] -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -struct CMap<'a> { - buf: &'a [u8], -} - -fn CMap(buf: &[u8]) -> CMap { - CMap { - buf: buf - } -} - -pub fn main() { } diff --git a/tests/ui/issues/issue-27901.rs b/tests/ui/issues/issue-27901.rs deleted file mode 100644 index ffd90b689..000000000 --- a/tests/ui/issues/issue-27901.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -trait Stream { type Item; } -impl<'a> Stream for &'a str { type Item = u8; } -fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { - (s, 42) -} - -fn main() { - let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); - assert_eq!(fx("hi"), ("hi", 42)); -} diff --git a/tests/ui/issues/issue-2804-2.rs b/tests/ui/issues/issue-2804-2.rs deleted file mode 100644 index d02725505..000000000 --- a/tests/ui/issues/issue-2804-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -#![allow(dead_code)] -// Minimized version of issue-2804.rs. Both check that callee IDs don't -// clobber the previous node ID in a macro expr - -use std::collections::HashMap; - -fn add_interfaces(managed_ip: String, device: HashMap<String, isize>) { - println!("{}, {}", managed_ip, device["interfaces"]); -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-30438-a.rs b/tests/ui/issues/issue-30438-a.rs deleted file mode 100644 index 0d4eb796a..000000000 --- a/tests/ui/issues/issue-30438-a.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Original regression test for Issue #30438. - -use std::ops::Index; - -struct Test<'a> { - s: &'a String -} - -impl <'a> Index<usize> for Test<'a> { - type Output = Test<'a>; - fn index(&self, _: usize) -> &Self::Output { - return &Test { s: &self.s}; - //~^ ERROR: cannot return reference to temporary value - } -} - -fn main() { - let s = "Hello World".to_string(); - let test = Test{s: &s}; - let r = &test[0]; - println!("{}", test.s); // OK since test is valid - println!("{}", r.s); // Segfault since value pointed by r has already been dropped -} diff --git a/tests/ui/issues/issue-30438-a.stderr b/tests/ui/issues/issue-30438-a.stderr deleted file mode 100644 index 53845af82..000000000 --- a/tests/ui/issues/issue-30438-a.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0515]: cannot return reference to temporary value - --> $DIR/issue-30438-a.rs:12:16 - | -LL | return &Test { s: &self.s}; - | ^------------------ - | || - | |temporary value created here - | returns a reference to data owned by the current function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-30438-b.rs b/tests/ui/issues/issue-30438-b.rs deleted file mode 100644 index 79510cdb6..000000000 --- a/tests/ui/issues/issue-30438-b.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Modified regression test for Issue #30438 that exposed an -// independent issue (see discussion on ticket). - -use std::ops::Index; - -struct Test<'a> { - s: &'a String -} - -impl <'a> Index<usize> for Test<'a> { - type Output = Test<'a>; - fn index(&self, _: usize) -> &Self::Output { - &Test { s: &self.s} - //~^ ERROR: cannot return reference to temporary value - } -} - -fn main() { - let s = "Hello World".to_string(); - let test = Test{s: &s}; - let r = &test[0]; - println!("{}", test.s); // OK since test is valid - println!("{}", r.s); // Segfault since value pointed by r has already been dropped -} diff --git a/tests/ui/issues/issue-30438-b.stderr b/tests/ui/issues/issue-30438-b.stderr deleted file mode 100644 index fd6bd25b1..000000000 --- a/tests/ui/issues/issue-30438-b.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0515]: cannot return reference to temporary value - --> $DIR/issue-30438-b.rs:13:9 - | -LL | &Test { s: &self.s} - | ^------------------ - | || - | |temporary value created here - | returns a reference to data owned by the current function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-30438-c.rs b/tests/ui/issues/issue-30438-c.rs deleted file mode 100644 index 813c1d3e2..000000000 --- a/tests/ui/issues/issue-30438-c.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Simplified regression test for #30438, inspired by arielb1. - -trait Trait { type Out; } - -struct Test<'a> { s: &'a str } - -fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static { - let x = Test { s: "this cannot last" }; - &x - //~^ ERROR: cannot return reference to local variable `x` -} - -impl<'b> Trait for Test<'b> { type Out = Test<'b>; } - -fn main() { - let orig = Test { s: "Hello World" }; - let r = silly(&orig); - println!("{}", orig.s); // OK since `orig` is valid - println!("{}", r.s); // Segfault (method does not return a sane value) -} diff --git a/tests/ui/issues/issue-30438-c.stderr b/tests/ui/issues/issue-30438-c.stderr deleted file mode 100644 index 7c0010880..000000000 --- a/tests/ui/issues/issue-30438-c.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-30438-c.rs:9:5 - | -LL | &x - | ^^ returns a reference to data owned by the current function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-3099-a.rs b/tests/ui/issues/issue-3099-a.rs deleted file mode 100644 index 9c3d8cf5a..000000000 --- a/tests/ui/issues/issue-3099-a.rs +++ /dev/null @@ -1,5 +0,0 @@ -enum A { B, C } - -enum A { D, E } //~ ERROR the name `A` is defined multiple times - -fn main() {} diff --git a/tests/ui/issues/issue-3099-a.stderr b/tests/ui/issues/issue-3099-a.stderr deleted file mode 100644 index e3733cebb..000000000 --- a/tests/ui/issues/issue-3099-a.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0428]: the name `A` is defined multiple times - --> $DIR/issue-3099-a.rs:3:1 - | -LL | enum A { B, C } - | ------ previous definition of the type `A` here -LL | -LL | enum A { D, E } - | ^^^^^^ `A` redefined here - | - = note: `A` must be defined only once in the type namespace of this module - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-3099-b.rs b/tests/ui/issues/issue-3099-b.rs deleted file mode 100644 index 71952c3b0..000000000 --- a/tests/ui/issues/issue-3099-b.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod a {} - -pub mod a {} //~ ERROR the name `a` is defined multiple times - -fn main() {} diff --git a/tests/ui/issues/issue-3099-b.stderr b/tests/ui/issues/issue-3099-b.stderr deleted file mode 100644 index c0cfefeb9..000000000 --- a/tests/ui/issues/issue-3099-b.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0428]: the name `a` is defined multiple times - --> $DIR/issue-3099-b.rs:3:1 - | -LL | pub mod a {} - | --------- previous definition of the module `a` here -LL | -LL | pub mod a {} - | ^^^^^^^^^ `a` redefined here - | - = note: `a` must be defined only once in the type namespace of this module - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-3099.rs b/tests/ui/issues/issue-3099.rs deleted file mode 100644 index ee75b3593..000000000 --- a/tests/ui/issues/issue-3099.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn a(x: String) -> String { - format!("First function with {}", x) -} - -fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times - format!("Second function with {} and {}", x, y) -} - -fn main() { - println!("Result: "); -} diff --git a/tests/ui/issues/issue-3099.stderr b/tests/ui/issues/issue-3099.stderr deleted file mode 100644 index 32ee2e1d2..000000000 --- a/tests/ui/issues/issue-3099.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0428]: the name `a` is defined multiple times - --> $DIR/issue-3099.rs:5:1 - | -LL | fn a(x: String) -> String { - | ------------------------- previous definition of the value `a` here -... -LL | fn a(x: String, y: String) -> String { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here - | - = note: `a` must be defined only once in the value namespace of this module - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui/issues/issue-3136-b.rs b/tests/ui/issues/issue-3136-b.rs index c4ca7236e..33d97fe7c 100644 --- a/tests/ui/issues/issue-3136-b.rs +++ b/tests/ui/issues/issue-3136-b.rs @@ -1,5 +1,5 @@ // run-pass -// aux-build:issue-3136-a.rc +// aux-build:issue-3136-a.rs // pretty-expanded FIXME #23616 diff --git a/tests/ui/issues/issue-32709.stderr b/tests/ui/issues/issue-32709.stderr index 1d595ca56..a4ba5da4d 100644 --- a/tests/ui/issues/issue-32709.stderr +++ b/tests/ui/issues/issue-32709.stderr @@ -7,9 +7,16 @@ LL | Err(5)?; | ^ the trait `From<{integer}>` is not implemented for `()` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the following other types implement trait `FromResidual<R>`: - <Result<T, F> as FromResidual<Result<Infallible, E>>> - <Result<T, F> as FromResidual<Yeet<E>>> + = help: the following other types implement trait `From<T>`: + <(T, T) as From<[T; 2]>> + <(T, T, T) as From<[T; 3]>> + <(T, T, T, T) as From<[T; 4]>> + <(T, T, T, T, T) as From<[T; 5]>> + <(T, T, T, T, T, T) as From<[T; 6]>> + <(T, T, T, T, T, T, T) as From<[T; 7]>> + <(T, T, T, T, T, T, T, T) as From<[T; 8]>> + <(T, T, T, T, T, T, T, T, T) as From<[T; 9]>> + and 4 others = note: required for `Result<i32, ()>` to implement `FromResidual<Result<Infallible, {integer}>>` error: aborting due to previous error diff --git a/tests/ui/issues/issue-33287.rs b/tests/ui/issues/issue-33287.rs index 770eb7c02..b3f873057 100644 --- a/tests/ui/issues/issue-33287.rs +++ b/tests/ui/issues/issue-33287.rs @@ -1,6 +1,7 @@ // build-pass #![allow(dead_code)] #![allow(unused_variables)] +#![allow(unconditional_panic)] const A: [u32; 1] = [0]; fn test() { diff --git a/tests/ui/issues/issue-3344.stderr b/tests/ui/issues/issue-3344.stderr index 11d599967..e849f5d04 100644 --- a/tests/ui/issues/issue-3344.stderr +++ b/tests/ui/issues/issue-3344.stderr @@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `partial_cmp` LL | impl PartialOrd for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation | - = help: implement the missing item: `fn partial_cmp(&self, _: &Rhs) -> Option<std::cmp::Ordering> { todo!() }` + = help: implement the missing item: `fn partial_cmp(&self, _: &Thing) -> Option<std::cmp::Ordering> { todo!() }` error: aborting due to previous error diff --git a/tests/ui/issues/issue-34932.rs b/tests/ui/issues/issue-34932.rs deleted file mode 100644 index ab568fd01..000000000 --- a/tests/ui/issues/issue-34932.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -// compile-flags:--test -#![cfg(any())] // This test should be configured away -#![feature(rustc_attrs)] // Test that this is allowed on stable/beta -#![feature(iter_arith_traits)] // Test that this is not unused -#![deny(unused_features)] - -#[test] -fn dummy() { - let () = "this should not reach type-checking"; -} diff --git a/tests/ui/issues/issue-36744-without-calls.rs b/tests/ui/issues/issue-36744-without-calls.rs deleted file mode 100644 index dc5dc4f13..000000000 --- a/tests/ui/issues/issue-36744-without-calls.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-pass -// Tests for an LLVM abort when storing a lifetime-parametric fn into -// context that is expecting one that is not lifetime-parametric -// (i.e., has no `for <'_>`). - -pub struct A<'a>(&'a ()); -pub struct S<T>(T); - -pub fn bad<'s>(v: &mut S<fn(A<'s>)>, y: S<for<'b> fn(A<'b>)>) { - *v = y; -} - -fn main() {} diff --git a/tests/ui/issues/issue-36792.rs b/tests/ui/issues/issue-36792.rs deleted file mode 100644 index 99ae633dd..000000000 --- a/tests/ui/issues/issue-36792.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass -fn foo() -> impl Copy { - foo -} -fn main() { - foo(); -} diff --git a/tests/ui/issues/issue-41394-rpass.rs b/tests/ui/issues/issue-41394-rpass.rs deleted file mode 100644 index 37c652523..000000000 --- a/tests/ui/issues/issue-41394-rpass.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -// aux-build:issue-41394.rs - -extern crate issue_41394 as lib; - -fn main() { - assert_eq!(lib::foo() as u32, 42); -} diff --git a/tests/ui/issues/issue-41394.rs b/tests/ui/issues/issue-41394.rs deleted file mode 100644 index 07cad8796..000000000 --- a/tests/ui/issues/issue-41394.rs +++ /dev/null @@ -1,11 +0,0 @@ -enum Foo { - A = "" + 1 - //~^ ERROR cannot add `{integer}` to `&str` -} - -enum Bar { - A = Foo::A as isize - //~^ const -} - -fn main() {} diff --git a/tests/ui/issues/issue-41394.stderr b/tests/ui/issues/issue-41394.stderr deleted file mode 100644 index 1b5c64628..000000000 --- a/tests/ui/issues/issue-41394.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0369]: cannot add `{integer}` to `&str` - --> $DIR/issue-41394.rs:2:12 - | -LL | A = "" + 1 - | -- ^ - {integer} - | | - | &str - -note: erroneous constant used - --> $DIR/issue-41394.rs:7:9 - | -LL | A = Foo::A as isize - | ^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/issues/issue-46302.stderr b/tests/ui/issues/issue-46302.stderr index a6f97c3c9..6e126038c 100644 --- a/tests/ui/issues/issue-46302.stderr +++ b/tests/ui/issues/issue-46302.stderr @@ -2,10 +2,12 @@ error[E0308]: mismatched types --> $DIR/issue-46302.rs:3:27 | LL | let u: &str = if true { s[..2] } else { s }; - | ^^^^^^ - | | - | expected `&str`, found `str` - | help: consider borrowing here: `&s[..2]` + | ^^^^^^ expected `&str`, found `str` + | +help: consider borrowing here + | +LL | let u: &str = if true { &s[..2] } else { s }; + | + error: aborting due to previous error diff --git a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr index e874ded8e..211dd5128 100644 --- a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr +++ b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:42 | LL | light_flows_our_war_of_mocking_words(behold as usize); - | ------------------------------------ ^^^^^^^^^^^^^^^ - | | | - | | expected `&usize`, found `usize` - | | help: consider borrowing here: `&(behold as usize)` + | ------------------------------------ ^^^^^^^^^^^^^^^ expected `&usize`, found `usize` + | | | arguments to this function are incorrect | note: function defined here @@ -13,15 +11,17 @@ note: function defined here | LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: consider borrowing here + | +LL | light_flows_our_war_of_mocking_words(&(behold as usize)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:42 | LL | light_flows_our_war_of_mocking_words(with_tears + 4); - | ------------------------------------ ^^^^^^^^^^^^^^ - | | | - | | expected `&usize`, found `usize` - | | help: consider borrowing here: `&(with_tears + 4)` + | ------------------------------------ ^^^^^^^^^^^^^^ expected `&usize`, found `usize` + | | | arguments to this function are incorrect | note: function defined here @@ -29,6 +29,10 @@ note: function defined here | LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: consider borrowing here + | +LL | light_flows_our_war_of_mocking_words(&(with_tears + 4)); + | ++ + error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-47646.rs b/tests/ui/issues/issue-47646.rs deleted file mode 100644 index ace6cdce8..000000000 --- a/tests/ui/issues/issue-47646.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::collections::BinaryHeap; - -fn main() { - let mut heap: BinaryHeap<i32> = BinaryHeap::new(); - let borrow = heap.peek_mut(); - - match (borrow, ()) { - (Some(_), ()) => { - println!("{:?}", heap); //~ ERROR cannot borrow `heap` as immutable - } - _ => {} - }; -} diff --git a/tests/ui/issues/issue-47646.stderr b/tests/ui/issues/issue-47646.stderr deleted file mode 100644 index 84cf9237a..000000000 --- a/tests/ui/issues/issue-47646.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as mutable - --> $DIR/issue-47646.rs:9:30 - | -LL | let borrow = heap.peek_mut(); - | --------------- mutable borrow occurs here -LL | -LL | match (borrow, ()) { - | ------------ a temporary with access to the mutable borrow is created here ... -LL | (Some(_), ()) => { -LL | println!("{:?}", heap); - | ^^^^ immutable borrow occurs here -... -LL | }; - | - ... and the mutable borrow might be used here, when that temporary is dropped and runs the destructor for type `(Option<PeekMut<'_, i32>>, ())` - | - = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/issues/issue-49298.rs b/tests/ui/issues/issue-49298.rs index e3ffa8e7c..6e58fa12c 100644 --- a/tests/ui/issues/issue-49298.rs +++ b/tests/ui/issues/issue-49298.rs @@ -6,7 +6,7 @@ // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it // -// ignore-test +// ignore-test (#54987) // This test is checking that the space allocated for `x.1` does not // overlap with `y`. (The reason why such a thing happened at one diff --git a/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs deleted file mode 100644 index f30d7e2ed..000000000 --- a/tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![allow(unused_variables)] -#![deny(non_shorthand_field_patterns)] - -pub struct Value<A> { pub value: A } - -#[macro_export] -macro_rules! pat { - ($a:pat) => { - Value { value: $a } - }; -} - -fn main() { - let pat!(value) = Value { value: () }; -} diff --git a/tests/ui/issues/issue-50582.stderr b/tests/ui/issues/issue-50582.stderr index 53ecc6112..3d527eb6b 100644 --- a/tests/ui/issues/issue-50582.stderr +++ b/tests/ui/issues/issue-50582.stderr @@ -7,13 +7,13 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information = help: add `#![feature(const_for)]` to the crate attributes to enable -error[E0277]: cannot add `()` to `{integer}` in const contexts +error[E0277]: cannot add `()` to `{integer}` --> $DIR/issue-50582.rs:2:18 | LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | ^ no implementation for `{integer} + ()` | - = help: the trait `~const Add<()>` is not implemented for `{integer}` + = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add<Rhs>`: <&'a f32 as Add<f32>> <&'a f64 as Add<f64>> diff --git a/tests/ui/issues/issue-51515.rs b/tests/ui/issues/issue-51515.rs index 84e09afac..33a9bf85e 100644 --- a/tests/ui/issues/issue-51515.rs +++ b/tests/ui/issues/issue-51515.rs @@ -1,7 +1,6 @@ fn main() { let foo = &16; //~^ HELP consider changing this to be a mutable reference - //~| SUGGESTION &mut 16 *foo = 32; //~^ ERROR cannot assign to `*foo`, which is behind a `&` reference let bar = foo; diff --git a/tests/ui/issues/issue-51515.stderr b/tests/ui/issues/issue-51515.stderr index 94e5c9f1b..88b8d2109 100644 --- a/tests/ui/issues/issue-51515.stderr +++ b/tests/ui/issues/issue-51515.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*foo`, which is behind a `&` reference - --> $DIR/issue-51515.rs:5:5 + --> $DIR/issue-51515.rs:4:5 | LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written @@ -7,10 +7,10 @@ LL | *foo = 32; help: consider changing this to be a mutable reference | LL | let foo = &mut 16; - | ~~~~~~~ + | +++ error[E0594]: cannot assign to `*bar`, which is behind a `&` reference - --> $DIR/issue-51515.rs:9:5 + --> $DIR/issue-51515.rs:8:5 | LL | *bar = 64; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written diff --git a/tests/ui/issues/issue-54302-cases.rs b/tests/ui/issues/issue-54302-cases.rs deleted file mode 100644 index faa116269..000000000 --- a/tests/ui/issues/issue-54302-cases.rs +++ /dev/null @@ -1,85 +0,0 @@ -trait Mirror { - type Image; - fn coerce(self) -> Self::Image; -} - -impl<T> Mirror for T { - type Image = T; - fn coerce(self) -> Self { self } -} - -trait Foo<'x, T> { - fn foo(self) -> &'x T; -} - -impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> { - fn foo(self) -> &'x T { self.foo2() } -} - -trait Foo2<'x, T> { - fn foo2(self) -> &'x T; -} - -// example 1 - fails leak check -impl<'x> Foo2<'x, u32> for &'x u32 -{ - fn foo2(self) -> &'x u32 { self } -} - -// example 2 - OK with this issue -impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32 -{ - fn foo2(self) -> &'x i32 { self } -} - -// example 3 - fails due to issue #XYZ + Leak-check -impl<'x, T> Foo2<'x, u64> for T - where T: Mirror<Image=&'x u64> -{ - fn foo2(self) -> &'x u64 { self.coerce() } -} - -// example 4 - fails due to issue #XYZ -impl<'x, 'a: 'x, T> Foo2<'x, i64> for T - where T: Mirror<Image=&'a i64> -{ - fn foo2(self) -> &'x i64 { self.coerce() } -} - - -trait RefFoo<T> { - fn ref_foo(&self) -> &'static T; -} - -impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> { - fn ref_foo(&self) -> &'static T { - self.foo() - } -} - - -fn coerce_lifetime1(a: &u32) -> &'static u32 -{ - <u32 as RefFoo<u32>>::ref_foo(a) - //~^ ERROR not general enough -} - -fn coerce_lifetime2(a: &i32) -> &'static i32 -{ - <i32 as RefFoo<i32>>::ref_foo(a) - //~^ ERROR not general enough -} - -fn coerce_lifetime3(a: &u64) -> &'static u64 -{ - <u64 as RefFoo<u64>>::ref_foo(a) - //~^ ERROR not general enough -} - -fn coerce_lifetime4(a: &i64) -> &'static i64 -{ - <i64 as RefFoo<i64>>::ref_foo(a) - //~^ ERROR not general enough -} - -fn main() {} diff --git a/tests/ui/issues/issue-54302-cases.stderr b/tests/ui/issues/issue-54302-cases.stderr deleted file mode 100644 index 6e8b69c4b..000000000 --- a/tests/ui/issues/issue-54302-cases.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: implementation of `Foo` is not general enough - --> $DIR/issue-54302-cases.rs:63:5 - | -LL | <u32 as RefFoo<u32>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`... - = note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` - -error: implementation of `Foo` is not general enough - --> $DIR/issue-54302-cases.rs:69:5 - | -LL | <i32 as RefFoo<i32>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`... - = note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` - -error: implementation of `Foo` is not general enough - --> $DIR/issue-54302-cases.rs:75:5 - | -LL | <u64 as RefFoo<u64>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`... - = note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` - -error: implementation of `Foo` is not general enough - --> $DIR/issue-54302-cases.rs:81:5 - | -LL | <i64 as RefFoo<i64>>::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough - | - = note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`... - = note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/issues/issue-54302.rs b/tests/ui/issues/issue-54302.rs deleted file mode 100644 index 1bfaebc38..000000000 --- a/tests/ui/issues/issue-54302.rs +++ /dev/null @@ -1,19 +0,0 @@ -trait Deserialize<'de> {} - -trait DeserializeOwned: for<'de> Deserialize<'de> {} -impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {} - -// Based on this impl, `&'static str` only implements Deserialize<'static>. -// It does not implement for<'de> Deserialize<'de>. -impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} - -fn main() { - // Then why does it implement DeserializeOwned? This compiles. - fn assert_deserialize_owned<T: DeserializeOwned>() {} - assert_deserialize_owned::<&'static str>(); - //~^ ERROR not general enough - - // It correctly does not implement for<'de> Deserialize<'de>. - //fn assert_hrtb<T: for<'de> Deserialize<'de>>() {} - //assert_hrtb::<&'static str>(); -} diff --git a/tests/ui/issues/issue-54302.stderr b/tests/ui/issues/issue-54302.stderr deleted file mode 100644 index 26c46571f..000000000 --- a/tests/ui/issues/issue-54302.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `Deserialize` is not general enough - --> $DIR/issue-54302.rs:13:5 - | -LL | assert_deserialize_owned::<&'static str>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough - | - = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0`... - = note: ...but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` - -error: aborting due to previous error - diff --git a/tests/ui/issues/issue-58857.stderr b/tests/ui/issues/issue-58857.stderr index e2acec47e..6aef35f0b 100644 --- a/tests/ui/issues/issue-58857.stderr +++ b/tests/ui/issues/issue-58857.stderr @@ -1,8 +1,8 @@ error: negative bounds are not supported - --> $DIR/issue-58857.rs:4:7 + --> $DIR/issue-58857.rs:4:9 | LL | impl<A: !Valid> Conj<A>{} - | ^^^^^^^^ negative bounds are not supported + | ^ error: aborting due to previous error diff --git a/tests/ui/issues/issue-59756.rs b/tests/ui/issues/issue-59756.rs index d6df0592b..3742f31ab 100644 --- a/tests/ui/issues/issue-59756.rs +++ b/tests/ui/issues/issue-59756.rs @@ -1,5 +1,5 @@ // run-rustfix -// ignore-test +// ignore-test (rustfix needs multiple suggestions) // // FIXME: Re-enable this test once we support choosing // between multiple mutually exclusive suggestions for the same span diff --git a/tests/ui/issues/issue-61106.stderr b/tests/ui/issues/issue-61106.stderr index eff3e6e78..aa922e268 100644 --- a/tests/ui/issues/issue-61106.stderr +++ b/tests/ui/issues/issue-61106.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-61106.rs:3:9 | LL | foo(x.clone()); - | --- ^^^^^^^^^ - | | | - | | expected `&str`, found `String` - | | help: consider borrowing here: `&x` + | --- ^^^^^^^^^ expected `&str`, found `String` + | | | arguments to this function are incorrect | note: function defined here @@ -13,6 +11,10 @@ note: function defined here | LL | fn foo(_: &str) {} | ^^^ ------- +help: consider borrowing here + | +LL | foo(&x.clone()); + | + error: aborting due to previous error diff --git a/tests/ui/issues/issue-61623.stderr b/tests/ui/issues/issue-61623.stderr index 5fcc33855..bedea3890 100644 --- a/tests/ui/issues/issue-61623.stderr +++ b/tests/ui/issues/issue-61623.stderr @@ -7,7 +7,7 @@ LL | f2(|| x.0, f1(x.1)) help: consider changing this to be a mutable reference | LL | fn f3<'a>(x: &'a mut ((), &'a mut ())) { - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr index a6fd3700e..f6d7968c0 100644 --- a/tests/ui/issues/issue-62375.stderr +++ b/tests/ui/issues/issue-62375.stderr @@ -6,16 +6,20 @@ LL | a == A::Value; | | | A | -note: an implementation of `PartialEq<_>` might be missing for `A` +note: an implementation of `PartialEq<fn(()) -> A {A::Value}>` might be missing for `A` --> $DIR/issue-62375.rs:1:1 | LL | enum A { - | ^^^^^^ must implement `PartialEq<_>` + | ^^^^^^ must implement `PartialEq<fn(()) -> A {A::Value}>` help: consider annotating `A` with `#[derive(PartialEq)]` | LL + #[derive(PartialEq)] LL | enum A { | +help: use parentheses to construct this tuple variant + | +LL | a == A::Value(/* () */); + | ++++++++++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-6458-1.rs b/tests/ui/issues/issue-6458-1.rs deleted file mode 100644 index 184e4832b..000000000 --- a/tests/ui/issues/issue-6458-1.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-fail -// error-pattern:explicit panic -// ignore-emscripten no processes - -fn foo<T>(t: T) {} -fn main() { - foo(panic!()) -} diff --git a/tests/ui/issues/issue-6458-2.rs b/tests/ui/issues/issue-6458-2.rs deleted file mode 100644 index b18cae3ed..000000000 --- a/tests/ui/issues/issue-6458-2.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - // Unconstrained type: - format!("{:?}", None); - //~^ ERROR type annotations needed [E0282] -} diff --git a/tests/ui/issues/issue-6458-2.stderr b/tests/ui/issues/issue-6458-2.stderr deleted file mode 100644 index 8dbdd9a27..000000000 --- a/tests/ui/issues/issue-6458-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-6458-2.rs:3:21 - | -LL | format!("{:?}", None); - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` - | -help: consider specifying the generic argument - | -LL | format!("{:?}", None::<T>); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-6458-3.rs b/tests/ui/issues/issue-6458-3.rs deleted file mode 100644 index d4f8886e9..000000000 --- a/tests/ui/issues/issue-6458-3.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::mem; - -fn main() { - mem::transmute(0); - //~^ ERROR type annotations needed [E0282] -} diff --git a/tests/ui/issues/issue-6458-3.stderr b/tests/ui/issues/issue-6458-3.stderr deleted file mode 100644 index 520efccae..000000000 --- a/tests/ui/issues/issue-6458-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-6458-3.rs:4:5 - | -LL | mem::transmute(0); - | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `Dst` declared on the function `transmute` - | -help: consider specifying the generic arguments - | -LL | mem::transmute::<i32, Dst>(0); - | ++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-6458-4.rs b/tests/ui/issues/issue-6458-4.rs deleted file mode 100644 index 054a5c15c..000000000 --- a/tests/ui/issues/issue-6458-4.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn foo(b: bool) -> Result<bool,String> { //~ ERROR mismatched types - Err("bar".to_string()); -} - -fn main() { - foo(false); -} diff --git a/tests/ui/issues/issue-6458-4.stderr b/tests/ui/issues/issue-6458-4.stderr deleted file mode 100644 index 66ccfdff2..000000000 --- a/tests/ui/issues/issue-6458-4.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-6458-4.rs:1:20 - | -LL | fn foo(b: bool) -> Result<bool,String> { - | --- ^^^^^^^^^^^^^^^^^^^ expected `Result<bool, String>`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression -LL | Err("bar".to_string()); - | - help: remove this semicolon to return this value - | - = note: expected enum `Result<bool, String>` - found unit type `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-6458.rs b/tests/ui/issues/issue-6458.rs deleted file mode 100644 index 16718e90d..000000000 --- a/tests/ui/issues/issue-6458.rs +++ /dev/null @@ -1,14 +0,0 @@ -use std::marker; - -pub struct TypeWithState<State>(marker::PhantomData<State>); -pub struct MyState; - -pub fn foo<State>(_: TypeWithState<State>) {} - -pub fn bar() { - foo(TypeWithState(marker::PhantomData)); - //~^ ERROR type annotations needed [E0282] -} - -fn main() { -} diff --git a/tests/ui/issues/issue-6458.stderr b/tests/ui/issues/issue-6458.stderr deleted file mode 100644 index 2e93c1385..000000000 --- a/tests/ui/issues/issue-6458.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-6458.rs:9:22 - | -LL | foo(TypeWithState(marker::PhantomData)); - | ^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` - | -help: consider specifying the generic argument - | -LL | foo(TypeWithState(marker::PhantomData::<T>)); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-69396-const-no-type-in-macro.rs b/tests/ui/issues/issue-69396-const-no-type-in-macro.rs deleted file mode 100644 index 45a308574..000000000 --- a/tests/ui/issues/issue-69396-const-no-type-in-macro.rs +++ /dev/null @@ -1,17 +0,0 @@ -macro_rules! suite { - ( $( $fn:ident; )* ) => { - $( - const A = "A".$fn(); - //~^ ERROR the name `A` is defined multiple times - //~| ERROR missing type for `const` item - //~| ERROR the placeholder `_` is not allowed within types on item signatures for constants - )* - } -} - -suite! { - len; - is_empty; -} - -fn main() {} diff --git a/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr b/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr deleted file mode 100644 index 89aeafeba..000000000 --- a/tests/ui/issues/issue-69396-const-no-type-in-macro.stderr +++ /dev/null @@ -1,50 +0,0 @@ -error[E0428]: the name `A` is defined multiple times - --> $DIR/issue-69396-const-no-type-in-macro.rs:4:13 - | -LL | const A = "A".$fn(); - | ^^^^^^^^^^^^^^^^^^^^ `A` redefined here -... -LL | / suite! { -LL | | len; -LL | | is_empty; -LL | | } - | |_- in this macro invocation - | - = note: `A` must be defined only once in the value namespace of this module - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: missing type for `const` item - --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 - | -LL | const A = "A".$fn(); - | ^ help: provide a type for the constant: `: usize` -... -LL | / suite! { -LL | | len; -LL | | is_empty; -LL | | } - | |_- in this macro invocation - | - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants - --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20 - | -LL | const A = "A".$fn(); - | ^ - | | - | not allowed in type signatures - | help: replace with the correct type: `bool` -... -LL | / suite! { -LL | | len; -LL | | is_empty; -LL | | } - | |_- in this macro invocation - | - = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0121, E0428. -For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/issues/issue-71584.rs b/tests/ui/issues/issue-71584.rs deleted file mode 100644 index 7bf3ed60e..000000000 --- a/tests/ui/issues/issue-71584.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - let n: u32 = 1; - let mut d: u64 = 2; - d = d % n.into(); - //~^ ERROR type annotations needed -} diff --git a/tests/ui/issues/issue-71584.stderr b/tests/ui/issues/issue-71584.stderr deleted file mode 100644 index 6ddb76573..000000000 --- a/tests/ui/issues/issue-71584.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0284]: type annotations needed - --> $DIR/issue-71584.rs:4:15 - | -LL | d = d % n.into(); - | - ^^^^ - | | - | type must be known at this point - | - = note: cannot satisfy `<u64 as Rem<_>>::Output == u64` -help: try using a fully qualified path to specify the expected types - | -LL | d = d % <u32 as Into<T>>::into(n); - | +++++++++++++++++++++++ ~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr index aee73380f..7449fe697 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/issues/issue-7364.stderr @@ -7,7 +7,8 @@ LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); = help: the trait `Sync` is not implemented for `RefCell<isize>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Unique<RefCell<isize>>` to implement `Sync` - = note: required because it appears within the type `Box<RefCell<isize>>` +note: required because it appears within the type `Box<RefCell<isize>>` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL = note: shared static variables must have a type that implements `Sync` error: aborting due to previous error diff --git a/tests/ui/issues/issue-868.rs b/tests/ui/issues/issue-868.rs deleted file mode 100644 index ce0a3c7ca..000000000 --- a/tests/ui/issues/issue-868.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -#![allow(unused_parens)] -// pretty-expanded FIXME #23616 - -fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() } - -pub fn main() { - let _x = f( | | { 10 }); - // used to be: cannot determine a type for this expression - f(| | { }); - // ditto - f( | | { ()}); - // always worked - let _: () = f(| | { }); - // empty block with no type info should compile too - let _ = f(||{}); - let _ = (||{}); -} diff --git a/tests/ui/issues/issue-948.rs b/tests/ui/issues/issue-948.rs deleted file mode 100644 index b9bbeb395..000000000 --- a/tests/ui/issues/issue-948.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-fail -// error-pattern:beep boop -// ignore-emscripten no processes - -#![allow(unused_variables)] - -struct Point { - x: isize, - y: isize, -} - -fn main() { - let origin = Point { x: 0, y: 0 }; - let f: Point = Point { x: (panic!("beep boop")), ..origin }; -} diff --git a/tests/ui/issues/issue-979.rs b/tests/ui/issues/issue-979.rs deleted file mode 100644 index 57a99b325..000000000 --- a/tests/ui/issues/issue-979.rs +++ /dev/null @@ -1,29 +0,0 @@ -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -struct r<'a> { - b: &'a Cell<isize>, -} - -impl<'a> Drop for r<'a> { - fn drop(&mut self) { - self.b.set(self.b.get() + 1); - } -} - -fn r(b: &Cell<isize>) -> r { - r { - b: b - } -} - -pub fn main() { - let b = &Cell::new(0); - { - let _p = Some(r(b)); - } - - assert_eq!(b.get(), 1); -} |