From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../traits/bound/assoc-fn-bound-root-obligation.rs | 11 -- .../bound/assoc-fn-bound-root-obligation.stderr | 20 --- src/test/ui/traits/bound/auxiliary/crate_a1.rs | 9 -- src/test/ui/traits/bound/auxiliary/crate_a2.rs | 13 -- .../bound/auxiliary/on_structs_and_enums_xc.rs | 13 -- src/test/ui/traits/bound/basic.rs | 25 --- src/test/ui/traits/bound/generic_trait.rs | 30 ---- .../ui/traits/bound/impl-comparison-duplicates.rs | 16 -- src/test/ui/traits/bound/in-arc.rs | 108 ------------- src/test/ui/traits/bound/multiple.rs | 9 -- src/test/ui/traits/bound/not-on-bare-trait.rs | 13 -- src/test/ui/traits/bound/not-on-bare-trait.stderr | 30 ---- src/test/ui/traits/bound/not-on-struct.rs | 38 ----- src/test/ui/traits/bound/not-on-struct.stderr | 175 --------------------- .../ui/traits/bound/on-structs-and-enums-in-fns.rs | 20 --- .../bound/on-structs-and-enums-in-fns.stderr | 27 ---- .../traits/bound/on-structs-and-enums-in-impls.rs | 25 --- .../bound/on-structs-and-enums-in-impls.stderr | 15 -- .../ui/traits/bound/on-structs-and-enums-locals.rs | 17 -- .../bound/on-structs-and-enums-locals.stderr | 27 ---- .../ui/traits/bound/on-structs-and-enums-rpass.rs | 21 --- .../ui/traits/bound/on-structs-and-enums-static.rs | 15 -- .../bound/on-structs-and-enums-static.stderr | 15 -- .../ui/traits/bound/on-structs-and-enums-xc.rs | 14 -- .../ui/traits/bound/on-structs-and-enums-xc.stderr | 27 ---- .../ui/traits/bound/on-structs-and-enums-xc1.rs | 15 -- .../traits/bound/on-structs-and-enums-xc1.stderr | 27 ---- src/test/ui/traits/bound/on-structs-and-enums.rs | 43 ----- .../ui/traits/bound/on-structs-and-enums.stderr | 99 ------------ src/test/ui/traits/bound/recursion.rs | 20 --- src/test/ui/traits/bound/same-crate-name.rs | 55 ------- src/test/ui/traits/bound/same-crate-name.stderr | 75 --------- src/test/ui/traits/bound/sugar.rs | 19 --- src/test/ui/traits/bound/sugar.stderr | 19 --- 34 files changed, 1105 deletions(-) delete mode 100644 src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs delete mode 100644 src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr delete mode 100644 src/test/ui/traits/bound/auxiliary/crate_a1.rs delete mode 100644 src/test/ui/traits/bound/auxiliary/crate_a2.rs delete mode 100644 src/test/ui/traits/bound/auxiliary/on_structs_and_enums_xc.rs delete mode 100644 src/test/ui/traits/bound/basic.rs delete mode 100644 src/test/ui/traits/bound/generic_trait.rs delete mode 100644 src/test/ui/traits/bound/impl-comparison-duplicates.rs delete mode 100644 src/test/ui/traits/bound/in-arc.rs delete mode 100644 src/test/ui/traits/bound/multiple.rs delete mode 100644 src/test/ui/traits/bound/not-on-bare-trait.rs delete mode 100644 src/test/ui/traits/bound/not-on-bare-trait.stderr delete mode 100644 src/test/ui/traits/bound/not-on-struct.rs delete mode 100644 src/test/ui/traits/bound/not-on-struct.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-in-fns.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-in-impls.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-locals.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-locals.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-rpass.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-static.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-static.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-xc.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-xc.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-xc1.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums.rs delete mode 100644 src/test/ui/traits/bound/on-structs-and-enums.stderr delete mode 100644 src/test/ui/traits/bound/recursion.rs delete mode 100644 src/test/ui/traits/bound/same-crate-name.rs delete mode 100644 src/test/ui/traits/bound/same-crate-name.stderr delete mode 100644 src/test/ui/traits/bound/sugar.rs delete mode 100644 src/test/ui/traits/bound/sugar.stderr (limited to 'src/test/ui/traits/bound') diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs deleted file mode 100644 index f9a934764..000000000 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn strip_lf(s: &str) -> &str { - s.strip_suffix(b'\n').unwrap_or(s) - //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8` - //~| NOTE expected an `FnMut<(char,)>` closure, found `u8` - //~| HELP the trait `FnMut<(char,)>` is not implemented for `u8` - //~| HELP the following other types implement trait `Pattern<'a>`: - //~| NOTE required for `u8` to implement `Pattern<'_>` - -} - -fn main() {} diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr deleted file mode 100644 index ce9ab2d81..000000000 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0277]: expected a `FnMut<(char,)>` closure, found `u8` - --> $DIR/assoc-fn-bound-root-obligation.rs:2:7 - | -LL | s.strip_suffix(b'\n').unwrap_or(s) - | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8` - | - = help: the trait `FnMut<(char,)>` is not implemented for `u8` - = help: the following other types implement trait `Pattern<'a>`: - &'b String - &'b [char; N] - &'b [char] - &'b str - &'c &'b str - [char; N] - char - = note: required for `u8` to implement `Pattern<'_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/auxiliary/crate_a1.rs b/src/test/ui/traits/bound/auxiliary/crate_a1.rs deleted file mode 100644 index 6aa010258..000000000 --- a/src/test/ui/traits/bound/auxiliary/crate_a1.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub trait Bar {} - -pub fn try_foo(x: impl Bar) {} - -pub struct ImplementsTraitForUsize { - _marker: std::marker::PhantomData, -} - -impl Bar for ImplementsTraitForUsize {} diff --git a/src/test/ui/traits/bound/auxiliary/crate_a2.rs b/src/test/ui/traits/bound/auxiliary/crate_a2.rs deleted file mode 100644 index d6057db5e..000000000 --- a/src/test/ui/traits/bound/auxiliary/crate_a2.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub struct Foo; - -pub trait Bar {} - -impl Bar for Foo {} - -pub struct DoesNotImplementTrait; - -pub struct ImplementsWrongTraitConditionally { - _marker: std::marker::PhantomData, -} - -impl Bar for ImplementsWrongTraitConditionally {} diff --git a/src/test/ui/traits/bound/auxiliary/on_structs_and_enums_xc.rs b/src/test/ui/traits/bound/auxiliary/on_structs_and_enums_xc.rs deleted file mode 100644 index 7e9592eee..000000000 --- a/src/test/ui/traits/bound/auxiliary/on_structs_and_enums_xc.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub trait Trait { - fn dummy(&self) { } -} - -pub struct Foo { - pub x: T, -} - -pub enum Bar { - ABar(isize), - BBar(T), - CBar(usize), -} diff --git a/src/test/ui/traits/bound/basic.rs b/src/test/ui/traits/bound/basic.rs deleted file mode 100644 index 8c8a7eb7d..000000000 --- a/src/test/ui/traits/bound/basic.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(unconditional_recursion)] - -// pretty-expanded FIXME #23616 - -trait Foo { -} - -fn b(_x: Box) { -} - -fn c(x: Box) { - e(x); -} - -fn d(x: Box) { - e(x); -} - -fn e(x: Box) { - e(x); -} - -pub fn main() { } diff --git a/src/test/ui/traits/bound/generic_trait.rs b/src/test/ui/traits/bound/generic_trait.rs deleted file mode 100644 index 18382bb59..000000000 --- a/src/test/ui/traits/bound/generic_trait.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -trait connection { - fn read(&self) -> isize; -} - -trait connection_factory { - fn create(&self) -> C; -} - -type my_connection = (); -type my_connection_factory = (); - -impl connection for () { - fn read(&self) -> isize { 43 } -} - -impl connection_factory for my_connection_factory { - fn create(&self) -> my_connection { () } -} - -pub fn main() { - let factory = (); - let connection = factory.create(); - let result = connection.read(); - assert_eq!(result, 43); -} diff --git a/src/test/ui/traits/bound/impl-comparison-duplicates.rs b/src/test/ui/traits/bound/impl-comparison-duplicates.rs deleted file mode 100644 index de6c2afa2..000000000 --- a/src/test/ui/traits/bound/impl-comparison-duplicates.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -// Tests that type parameter bounds on an implementation need not match the -// trait exactly, as long as the implementation doesn't demand *more* bounds -// than the trait. - -// pretty-expanded FIXME #23616 - -trait A { - fn foo(&self); -} - -impl A for isize { - fn foo(&self) {} // Ord implies Eq, so this is ok. -} - -fn main() {} diff --git a/src/test/ui/traits/bound/in-arc.rs b/src/test/ui/traits/bound/in-arc.rs deleted file mode 100644 index a1492c0b9..000000000 --- a/src/test/ui/traits/bound/in-arc.rs +++ /dev/null @@ -1,108 +0,0 @@ -// run-pass -#![allow(unused_must_use)] -// Tests that a heterogeneous list of existential `dyn` types can be put inside an Arc -// and shared between threads as long as all types fulfill Send. - -// ignore-emscripten no threads support - -use std::sync::Arc; -use std::sync::mpsc::channel; -use std::thread; - -trait Pet { - fn name(&self, blk: Box); - fn num_legs(&self) -> usize; - fn of_good_pedigree(&self) -> bool; -} - -struct Catte { - num_whiskers: usize, - name: String, -} - -struct Dogge { - bark_decibels: usize, - tricks_known: usize, - name: String, -} - -struct Goldfyshe { - swim_speed: usize, - name: String, -} - -impl Pet for Catte { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 4 } - fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } -} -impl Pet for Dogge { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 4 } - fn of_good_pedigree(&self) -> bool { - self.bark_decibels < 70 || self.tricks_known > 20 - } -} -impl Pet for Goldfyshe { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 0 } - fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } -} - -pub fn main() { - let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_string() }; - let dogge1 = Dogge { - bark_decibels: 100, - tricks_known: 42, - name: "alan_turing".to_string(), - }; - let dogge2 = Dogge { - bark_decibels: 55, - tricks_known: 11, - name: "albert_einstein".to_string(), - }; - let fishe = Goldfyshe { - swim_speed: 998, - name: "alec_guinness".to_string(), - }; - let arc = Arc::new(vec![ - Box::new(catte) as Box, - Box::new(dogge1) as Box, - Box::new(fishe) as Box, - Box::new(dogge2) as Box]); - let (tx1, rx1) = channel(); - let arc1 = arc.clone(); - let t1 = thread::spawn(move|| { check_legs(arc1); tx1.send(()); }); - let (tx2, rx2) = channel(); - let arc2 = arc.clone(); - let t2 = thread::spawn(move|| { check_names(arc2); tx2.send(()); }); - let (tx3, rx3) = channel(); - let arc3 = arc.clone(); - let t3 = thread::spawn(move|| { check_pedigree(arc3); tx3.send(()); }); - rx1.recv(); - rx2.recv(); - rx3.recv(); - t1.join(); - t2.join(); - t3.join(); -} - -fn check_legs(arc: Arc>>) { - let mut legs = 0; - for pet in arc.iter() { - legs += pet.num_legs(); - } - assert!(legs == 12); -} -fn check_names(arc: Arc>>) { - for pet in arc.iter() { - pet.name(Box::new(|name| { - assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); - })) - } -} -fn check_pedigree(arc: Arc>>) { - for pet in arc.iter() { - assert!(pet.of_good_pedigree()); - } -} diff --git a/src/test/ui/traits/bound/multiple.rs b/src/test/ui/traits/bound/multiple.rs deleted file mode 100644 index 868b33407..000000000 --- a/src/test/ui/traits/bound/multiple.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -fn f(_: T) { -} - -pub fn main() { - f(3); -} diff --git a/src/test/ui/traits/bound/not-on-bare-trait.rs b/src/test/ui/traits/bound/not-on-bare-trait.rs deleted file mode 100644 index daf18c670..000000000 --- a/src/test/ui/traits/bound/not-on-bare-trait.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait Foo { - fn dummy(&self) {} -} - -// This should emit the less confusing error, not the more confusing one. - -fn foo(_x: Foo + Send) { - //~^ ERROR the size for values of type - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition -} - -fn main() {} diff --git a/src/test/ui/traits/bound/not-on-bare-trait.stderr b/src/test/ui/traits/bound/not-on-bare-trait.stderr deleted file mode 100644 index 8da0b6d6b..000000000 --- a/src/test/ui/traits/bound/not-on-bare-trait.stderr +++ /dev/null @@ -1,30 +0,0 @@ -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/not-on-bare-trait.rs:7:12 - | -LL | fn foo(_x: Foo + Send) { - | ^^^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see - = note: `#[warn(bare_trait_objects)]` on by default -help: use `dyn` - | -LL | fn foo(_x: dyn Foo + Send) { - | +++ - -error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time - --> $DIR/not-on-bare-trait.rs:7:8 - | -LL | fn foo(_x: Foo + Send) { - | ^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Foo + Send + 'static)` - = help: unsized fn params are gated as an unstable feature -help: function arguments must have a statically known size, borrowed types always have a known size - | -LL | fn foo(_x: &Foo + Send) { - | + - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/not-on-struct.rs b/src/test/ui/traits/bound/not-on-struct.rs deleted file mode 100644 index 8633e9d7a..000000000 --- a/src/test/ui/traits/bound/not-on-struct.rs +++ /dev/null @@ -1,38 +0,0 @@ -// We don't need those errors. Ideally we would silence them, but to do so we need to move the -// lint from being an early-lint during parsing to a late-lint, because it needs to be aware of -// the types involved. -#![allow(bare_trait_objects)] - -struct Foo; - -fn foo(_x: Box) { } //~ ERROR expected trait, found struct `Foo` - -type TypeAlias = Box>; //~ ERROR expected trait, found struct `Vec` - -struct A; -fn a() -> A + 'static { //~ ERROR expected trait, found - A -} -fn b<'a,T,E>(iter: Iterator + 'a>) { //~ ERROR expected trait, found - panic!() -} -fn c() -> 'static + A { //~ ERROR expected trait, found - A -} -fn d<'a,T,E>(iter: Iterator>) { //~ ERROR expected trait, found - panic!() -} -fn e() -> 'static + A + 'static { //~ ERROR expected trait, found -//~^ ERROR only a single explicit lifetime bound is permitted - A -} -fn f<'a,T,E>(iter: Iterator + 'a>) { //~ ERROR expected trait, found -//~^ ERROR only a single explicit lifetime bound is permitted - panic!() -} -struct Traitor; -trait Trait {} -fn g() -> Traitor + 'static { //~ ERROR expected trait, found struct `Traitor` - A -} -fn main() {} diff --git a/src/test/ui/traits/bound/not-on-struct.stderr b/src/test/ui/traits/bound/not-on-struct.stderr deleted file mode 100644 index 2de35dc7f..000000000 --- a/src/test/ui/traits/bound/not-on-struct.stderr +++ /dev/null @@ -1,175 +0,0 @@ -error[E0226]: only a single explicit lifetime bound is permitted - --> $DIR/not-on-struct.rs:25:25 - | -LL | fn e() -> 'static + A + 'static { - | ^^^^^^^ - -error[E0226]: only a single explicit lifetime bound is permitted - --> $DIR/not-on-struct.rs:29:53 - | -LL | fn f<'a,T,E>(iter: Iterator + 'a>) { - | ^^ - -error[E0404]: expected trait, found struct `Foo` - --> $DIR/not-on-struct.rs:8:16 - | -LL | fn foo(_x: Box) { } - | ^^^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:8:22 - | -LL | fn foo(_x: Box) { } - | --- ^^^^ ...because of this bound - | | - | expected this type to be a trait... - -error[E0404]: expected trait, found struct `Vec` - --> $DIR/not-on-struct.rs:10:29 - | -LL | type TypeAlias = Box>; - | ^^^^^^ not a trait - -error[E0404]: expected trait, found struct `A` - --> $DIR/not-on-struct.rs:13:11 - | -LL | fn a() -> A + 'static { - | ^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:13:15 - | -LL | fn a() -> A + 'static { - | - ^^^^^^^ ...because of this bound - | | - | expected this type to be a trait... -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn a() -> A + 'static { -LL + fn a() -> A { - | - -error[E0404]: expected trait, found enum `Result` - --> $DIR/not-on-struct.rs:16:34 - | -LL | fn b<'a,T,E>(iter: Iterator + 'a>) { - | ^^^^^^^^^^^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:16:48 - | -LL | fn b<'a,T,E>(iter: Iterator + 'a>) { - | ----------- ^^ ...because of this bound - | | - | expected this type to be a trait... -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn b<'a,T,E>(iter: Iterator + 'a>) { -LL + fn b<'a,T,E>(iter: Iterator>) { - | - -error[E0404]: expected trait, found struct `A` - --> $DIR/not-on-struct.rs:19:21 - | -LL | fn c() -> 'static + A { - | ^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:19:11 - | -LL | fn c() -> 'static + A { - | ^^^^^^^ - expected this type to be a trait... - | | - | ...because of this bound -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn c() -> 'static + A { -LL + fn c() -> A { - | - -error[E0404]: expected trait, found enum `Result` - --> $DIR/not-on-struct.rs:22:39 - | -LL | fn d<'a,T,E>(iter: Iterator>) { - | ^^^^^^^^^^^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:22:34 - | -LL | fn d<'a,T,E>(iter: Iterator>) { - | ^^ ----------- expected this type to be a trait... - | | - | ...because of this bound -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn d<'a,T,E>(iter: Iterator>) { -LL + fn d<'a,T,E>(iter: Iterator>) { - | - -error[E0404]: expected trait, found struct `A` - --> $DIR/not-on-struct.rs:25:21 - | -LL | fn e() -> 'static + A + 'static { - | ^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:25:11 - | -LL | fn e() -> 'static + A + 'static { - | ^^^^^^^ - ^^^^^^^ ...because of these bounds - | | - | expected this type to be a trait... -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn e() -> 'static + A + 'static { -LL + fn e() -> A { - | - -error[E0404]: expected trait, found enum `Result` - --> $DIR/not-on-struct.rs:29:39 - | -LL | fn f<'a,T,E>(iter: Iterator + 'a>) { - | ^^^^^^^^^^^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:29:34 - | -LL | fn f<'a,T,E>(iter: Iterator + 'a>) { - | ^^ ----------- ^^ ...because of these bounds - | | - | expected this type to be a trait... -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn f<'a,T,E>(iter: Iterator + 'a>) { -LL + fn f<'a,T,E>(iter: Iterator>) { - | - -error[E0404]: expected trait, found struct `Traitor` - --> $DIR/not-on-struct.rs:35:11 - | -LL | trait Trait {} - | ----------- similarly named trait `Trait` defined here -LL | fn g() -> Traitor + 'static { - | ^^^^^^^ not a trait - | -help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way - --> $DIR/not-on-struct.rs:35:21 - | -LL | fn g() -> Traitor + 'static { - | ------- ^^^^^^^ ...because of this bound - | | - | expected this type to be a trait... -help: if you meant to use a type and not a trait here, remove the bounds - | -LL - fn g() -> Traitor + 'static { -LL + fn g() -> Traitor { - | -help: a trait with a similar name exists - | -LL | fn g() -> Trait + 'static { - | ~~~~~ - -error: aborting due to 11 previous errors - -Some errors have detailed explanations: E0226, E0404. -For more information about an error, try `rustc --explain E0226`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.rs b/src/test/ui/traits/bound/on-structs-and-enums-in-fns.rs deleted file mode 100644 index 6a6fcf530..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.rs +++ /dev/null @@ -1,20 +0,0 @@ -trait Trait {} - -struct Foo { - x: T, -} - -enum Bar { - ABar(isize), - BBar(T), - CBar(usize), -} - -fn explode(x: Foo) {} -//~^ ERROR E0277 - -fn kaboom(y: Bar) {} -//~^ ERROR E0277 - -fn main() { -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr b/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr deleted file mode 100644 index 61237a63e..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-fns.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `u32: Trait` is not satisfied - --> $DIR/on-structs-and-enums-in-fns.rs:13:15 - | -LL | fn explode(x: Foo) {} - | ^^^^^^^^ the trait `Trait` is not implemented for `u32` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums-in-fns.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `f32: Trait` is not satisfied - --> $DIR/on-structs-and-enums-in-fns.rs:16:14 - | -LL | fn kaboom(y: Bar) {} - | ^^^^^^^^ the trait `Trait` is not implemented for `f32` - | -note: required by a bound in `Bar` - --> $DIR/on-structs-and-enums-in-fns.rs:7:12 - | -LL | enum Bar { - | ^^^^^ required by this bound in `Bar` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.rs b/src/test/ui/traits/bound/on-structs-and-enums-in-impls.rs deleted file mode 100644 index d37949952..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.rs +++ /dev/null @@ -1,25 +0,0 @@ -trait Trait {} - -struct Foo { - x: T, -} - -enum Bar { - ABar(isize), - BBar(T), - CBar(usize), -} - -trait PolyTrait -{ - fn whatever(&self, t: T) {} -} - -struct Struct; - -impl PolyTrait> for Struct { -//~^ ERROR E0277 -} - -fn main() { -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr b/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr deleted file mode 100644 index 8a4374226..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-in-impls.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `u16: Trait` is not satisfied - --> $DIR/on-structs-and-enums-in-impls.rs:20:6 - | -LL | impl PolyTrait> for Struct { - | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums-in-impls.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.rs b/src/test/ui/traits/bound/on-structs-and-enums-locals.rs deleted file mode 100644 index 60ba343bb..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.rs +++ /dev/null @@ -1,17 +0,0 @@ -trait Trait { - fn dummy(&self) { } -} - -struct Foo { - x: T, -} - -fn main() { - let foo = Foo { - x: 3 - //~^ ERROR E0277 - }; - - let baz: Foo = loop { }; - //~^ ERROR E0277 -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr b/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr deleted file mode 100644 index 20bbe69c0..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-locals.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/on-structs-and-enums-locals.rs:15:14 - | -LL | let baz: Foo = loop { }; - | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums-locals.rs:5:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `{integer}: Trait` is not satisfied - --> $DIR/on-structs-and-enums-locals.rs:11:12 - | -LL | x: 3 - | ^ the trait `Trait` is not implemented for `{integer}` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums-locals.rs:5:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-rpass.rs b/src/test/ui/traits/bound/on-structs-and-enums-rpass.rs deleted file mode 100644 index 4dc4fecc9..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-rpass.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass -#![allow(dead_code)] -#![allow(unused_variables)] -// pretty-expanded FIXME #23616 - -trait U {} -trait T { fn get(self) -> X; } - -trait S2 { - fn m(x: Box+'static>) {} -} - -struct St { - f: Box+'static>, -} - -impl St { - fn blah() {} -} - -fn main() {} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-static.rs b/src/test/ui/traits/bound/on-structs-and-enums-static.rs deleted file mode 100644 index df3f8b8a5..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-static.rs +++ /dev/null @@ -1,15 +0,0 @@ -trait Trait { - fn dummy(&self) { } -} - -struct Foo { - x: T, -} - -static X: Foo = Foo { -//~^ ERROR E0277 - x: 1, -}; - -fn main() { -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-static.stderr b/src/test/ui/traits/bound/on-structs-and-enums-static.stderr deleted file mode 100644 index fda734e85..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-static.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/on-structs-and-enums-static.rs:9:11 - | -LL | static X: Foo = Foo { - | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums-static.rs:5:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc.rs b/src/test/ui/traits/bound/on-structs-and-enums-xc.rs deleted file mode 100644 index 94316d240..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc.rs +++ /dev/null @@ -1,14 +0,0 @@ -// aux-build:on_structs_and_enums_xc.rs - -extern crate on_structs_and_enums_xc; - -use on_structs_and_enums_xc::{Bar, Foo, Trait}; - -fn explode(x: Foo) {} -//~^ ERROR E0277 - -fn kaboom(y: Bar) {} -//~^ ERROR E0277 - -fn main() { -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr deleted file mode 100644 index 5064b60bf..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/on-structs-and-enums-xc.rs:7:15 - | -LL | fn explode(x: Foo) {} - | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` - | -note: required by a bound in `Foo` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 - | -LL | pub struct Foo { - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `f32: Trait` is not satisfied - --> $DIR/on-structs-and-enums-xc.rs:10:14 - | -LL | fn kaboom(y: Bar) {} - | ^^^^^^^^ the trait `Trait` is not implemented for `f32` - | -note: required by a bound in `Bar` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 - | -LL | pub enum Bar { - | ^^^^^ required by this bound in `Bar` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs b/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs deleted file mode 100644 index 5ef35b513..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// aux-build:on_structs_and_enums_xc.rs - -extern crate on_structs_and_enums_xc; - -use on_structs_and_enums_xc::{Bar, Foo, Trait}; - -fn main() { - let foo = Foo { - x: 3 - //~^ ERROR E0277 - }; - let bar: Bar = return; - //~^ ERROR E0277 - let _ = bar; -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr b/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr deleted file mode 100644 index 3fb5decb7..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums-xc1.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0277]: the trait bound `f64: Trait` is not satisfied - --> $DIR/on-structs-and-enums-xc1.rs:12:14 - | -LL | let bar: Bar = return; - | ^^^^^^^^ the trait `Trait` is not implemented for `f64` - | -note: required by a bound in `Bar` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:9:16 - | -LL | pub enum Bar { - | ^^^^^ required by this bound in `Bar` - -error[E0277]: the trait bound `{integer}: Trait` is not satisfied - --> $DIR/on-structs-and-enums-xc1.rs:9:12 - | -LL | x: 3 - | ^ the trait `Trait` is not implemented for `{integer}` - | -note: required by a bound in `Foo` - --> $DIR/auxiliary/on_structs_and_enums_xc.rs:5:18 - | -LL | pub struct Foo { - | ^^^^^ required by this bound in `Foo` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/on-structs-and-enums.rs b/src/test/ui/traits/bound/on-structs-and-enums.rs deleted file mode 100644 index 024084fa7..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums.rs +++ /dev/null @@ -1,43 +0,0 @@ -trait Trait {} - -struct Foo { - x: T, -} - -enum Bar { - ABar(isize), - BBar(T), - CBar(usize), -} - -impl Foo { -//~^ ERROR `T: Trait` is not satisfied - fn uhoh() {} -} - -struct Baz { - a: Foo, //~ ERROR E0277 -} - -enum Boo { - Quux(Bar), //~ ERROR E0277 -} - -struct Badness { - b: Foo, //~ ERROR E0277 -} - -enum MoreBadness { - EvenMoreBadness(Bar), //~ ERROR E0277 -} - -struct TupleLike( - Foo, //~ ERROR E0277 -); - -enum Enum { - DictionaryLike { field: Bar }, //~ ERROR E0277 -} - -fn main() { -} diff --git a/src/test/ui/traits/bound/on-structs-and-enums.stderr b/src/test/ui/traits/bound/on-structs-and-enums.stderr deleted file mode 100644 index fe05b8634..000000000 --- a/src/test/ui/traits/bound/on-structs-and-enums.stderr +++ /dev/null @@ -1,99 +0,0 @@ -error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:13:9 - | -LL | impl Foo { - | ^^^^^^ the trait `Trait` is not implemented for `T` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `T` - | -LL | impl Foo { - | +++++++ - -error[E0277]: the trait bound `isize: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:19:8 - | -LL | a: Foo, - | ^^^^^^^^^^ the trait `Trait` is not implemented for `isize` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:23:10 - | -LL | Quux(Bar), - | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` - | -note: required by a bound in `Bar` - --> $DIR/on-structs-and-enums.rs:7:12 - | -LL | enum Bar { - | ^^^^^ required by this bound in `Bar` - -error[E0277]: the trait bound `U: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:27:8 - | -LL | b: Foo, - | ^^^^^^ the trait `Trait` is not implemented for `U` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` -help: consider restricting type parameter `U` - | -LL | struct Badness { - | +++++++ - -error[E0277]: the trait bound `V: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:31:21 - | -LL | EvenMoreBadness(Bar), - | ^^^^^^ the trait `Trait` is not implemented for `V` - | -note: required by a bound in `Bar` - --> $DIR/on-structs-and-enums.rs:7:12 - | -LL | enum Bar { - | ^^^^^ required by this bound in `Bar` -help: consider restricting type parameter `V` - | -LL | enum MoreBadness { - | +++++++ - -error[E0277]: the trait bound `i32: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:35:5 - | -LL | Foo, - | ^^^^^^^^ the trait `Trait` is not implemented for `i32` - | -note: required by a bound in `Foo` - --> $DIR/on-structs-and-enums.rs:3:14 - | -LL | struct Foo { - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `u8: Trait` is not satisfied - --> $DIR/on-structs-and-enums.rs:39:29 - | -LL | DictionaryLike { field: Bar }, - | ^^^^^^^ the trait `Trait` is not implemented for `u8` - | -note: required by a bound in `Bar` - --> $DIR/on-structs-and-enums.rs:7:12 - | -LL | enum Bar { - | ^^^^^ required by this bound in `Bar` - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/recursion.rs b/src/test/ui/traits/bound/recursion.rs deleted file mode 100644 index 0023ff654..000000000 --- a/src/test/ui/traits/bound/recursion.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -trait I { fn i(&self) -> Self; } - -trait A { - fn id(x:T) -> T { x.i() } -} - -trait J { fn j(&self) -> T; } - -trait B> { - fn id(x:T) -> T { x.j() } -} - -trait C { - fn id>(x:T) -> T { x.j() } -} - -pub fn main() { } diff --git a/src/test/ui/traits/bound/same-crate-name.rs b/src/test/ui/traits/bound/same-crate-name.rs deleted file mode 100644 index 8d646a414..000000000 --- a/src/test/ui/traits/bound/same-crate-name.rs +++ /dev/null @@ -1,55 +0,0 @@ -// aux-build:crate_a1.rs -// aux-build:crate_a2.rs - -// Issue 22750 -// This tests the extra help message reported when a trait bound -// is not met but the struct implements a trait with the same path. - -fn main() { - let foo = { - extern crate crate_a2 as a; - a::Foo - }; - - let implements_no_traits = { - extern crate crate_a2 as a; - a::DoesNotImplementTrait - }; - - let other_variant_implements_mismatched_trait = { - extern crate crate_a2 as a; - a::ImplementsWrongTraitConditionally { _marker: std::marker::PhantomData:: } - }; - - let other_variant_implements_correct_trait = { - extern crate crate_a1 as a; - a::ImplementsTraitForUsize { _marker: std::marker::PhantomData:: } - }; - - { - extern crate crate_a1 as a; - a::try_foo(foo); - //~^ ERROR E0277 - //~| trait impl with same name found - //~| perhaps two different versions of crate `crate_a2` - - // We don't want to see the "version mismatch" help message here - // because `implements_no_traits` has no impl for `Foo` - a::try_foo(implements_no_traits); - //~^ ERROR E0277 - - // We don't want to see the "version mismatch" help message here - // because `other_variant_implements_mismatched_trait` - // does not have an impl for its `` variant, - // only for its `` variant. - a::try_foo(other_variant_implements_mismatched_trait); - //~^ ERROR E0277 - - // We don't want to see the "version mismatch" help message here - // because `ImplementsTraitForUsize` only has - // impls for the correct trait where the path is not misleading. - a::try_foo(other_variant_implements_correct_trait); - //~^ ERROR E0277 - //~| the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` - } -} diff --git a/src/test/ui/traits/bound/same-crate-name.stderr b/src/test/ui/traits/bound/same-crate-name.stderr deleted file mode 100644 index f66cad77f..000000000 --- a/src/test/ui/traits/bound/same-crate-name.stderr +++ /dev/null @@ -1,75 +0,0 @@ -error[E0277]: the trait bound `Foo: main::a::Bar` is not satisfied - --> $DIR/same-crate-name.rs:31:20 - | -LL | a::try_foo(foo); - | ---------- ^^^ the trait `main::a::Bar` is not implemented for `Foo` - | | - | required by a bound introduced by this call - | -help: trait impl with same name found - --> $DIR/auxiliary/crate_a2.rs:5:1 - | -LL | impl Bar for Foo {} - | ^^^^^^^^^^^^^^^^ - = note: perhaps two different versions of crate `crate_a2` are being used? - = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` -note: required by a bound in `try_foo` - --> $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | ^^^ required by this bound in `try_foo` - -error[E0277]: the trait bound `DoesNotImplementTrait: main::a::Bar` is not satisfied - --> $DIR/same-crate-name.rs:38:20 - | -LL | a::try_foo(implements_no_traits); - | ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `DoesNotImplementTrait` - | | - | required by a bound introduced by this call - | - = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` -note: required by a bound in `try_foo` - --> $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | ^^^ required by this bound in `try_foo` - -error[E0277]: the trait bound `ImplementsWrongTraitConditionally: main::a::Bar` is not satisfied - --> $DIR/same-crate-name.rs:45:20 - | -LL | a::try_foo(other_variant_implements_mismatched_trait); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsWrongTraitConditionally` - | | - | required by a bound introduced by this call - | -help: trait impl with same name found - --> $DIR/auxiliary/crate_a2.rs:13:1 - | -LL | impl Bar for ImplementsWrongTraitConditionally {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: perhaps two different versions of crate `crate_a2` are being used? - = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` -note: required by a bound in `try_foo` - --> $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | ^^^ required by this bound in `try_foo` - -error[E0277]: the trait bound `ImplementsTraitForUsize: main::a::Bar` is not satisfied - --> $DIR/same-crate-name.rs:51:20 - | -LL | a::try_foo(other_variant_implements_correct_trait); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsTraitForUsize` - | | - | required by a bound introduced by this call - | - = help: the trait `main::a::Bar` is implemented for `ImplementsTraitForUsize` -note: required by a bound in `try_foo` - --> $DIR/auxiliary/crate_a1.rs:3:24 - | -LL | pub fn try_foo(x: impl Bar) {} - | ^^^ required by this bound in `try_foo` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/bound/sugar.rs b/src/test/ui/traits/bound/sugar.rs deleted file mode 100644 index 65b6f6faa..000000000 --- a/src/test/ui/traits/bound/sugar.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Tests for "default" bounds inferred for traits with no bounds list. - -trait Foo {} - -fn a(_x: Box) { -} - -fn b(_x: &'static (dyn Foo + 'static)) { -} - -fn c(x: Box) { - a(x); //~ ERROR mismatched types -} - -fn d(x: &'static (dyn Foo + Sync)) { - b(x); -} - -fn main() {} diff --git a/src/test/ui/traits/bound/sugar.stderr b/src/test/ui/traits/bound/sugar.stderr deleted file mode 100644 index b67648c7b..000000000 --- a/src/test/ui/traits/bound/sugar.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/sugar.rs:12:7 - | -LL | a(x); - | - ^ expected trait `Foo + Send`, found trait `Foo + Sync` - | | - | arguments to this function are incorrect - | - = note: expected struct `Box<(dyn Foo + Send + 'static)>` - found struct `Box<(dyn Foo + Sync + 'static)>` -note: function defined here - --> $DIR/sugar.rs:5:4 - | -LL | fn a(_x: Box) { - | ^ ----------------------- - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. -- cgit v1.2.3