diff options
Diffstat (limited to 'src/test/ui/marker_trait_attr')
22 files changed, 0 insertions, 479 deletions
diff --git a/src/test/ui/marker_trait_attr/issue-61651-type-mismatch.rs b/src/test/ui/marker_trait_attr/issue-61651-type-mismatch.rs deleted file mode 100644 index 0af706615..000000000 --- a/src/test/ui/marker_trait_attr/issue-61651-type-mismatch.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass -// Regression test for issue #61651 -// Verifies that we don't try to constrain inference -// variables due to the presence of multiple applicable -// marker trait impls - -#![feature(marker_trait_attr)] - -#[marker] // Remove this line and it works?!? -trait Foo<T> {} -impl Foo<u16> for u8 {} -impl Foo<[u8; 1]> for u8 {} -fn foo<T: Foo<U>, U>(_: T) -> U { unimplemented!() } - -fn main() { - let _: u16 = foo(0_u8); -} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs deleted file mode 100644 index 0bf620934..000000000 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker] //~ ERROR attribute should be applied to a trait -struct Struct {} - -#[marker] //~ ERROR attribute should be applied to a trait -impl Struct {} - -#[marker] //~ ERROR attribute should be applied to a trait -union Union { - x: i32, -} - -#[marker] //~ ERROR attribute should be applied to a trait -const CONST: usize = 10; - -#[marker] //~ ERROR attribute should be applied to a trait -fn function() {} - -#[marker] //~ ERROR attribute should be applied to a trait -type Type = (); - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr deleted file mode 100644 index 19a5290dd..000000000 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr +++ /dev/null @@ -1,52 +0,0 @@ -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:3:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | struct Struct {} - | ---------------- not a trait - -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:6:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | impl Struct {} - | -------------- not a trait - -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:9:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | / union Union { -LL | | x: i32, -LL | | } - | |_- not a trait - -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:14:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | const CONST: usize = 10; - | ------------------------ not a trait - -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:17:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | fn function() {} - | ---------------- not a trait - -error: attribute should be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:20:1 - | -LL | #[marker] - | ^^^^^^^^^ -LL | type Type = (); - | --------------- not a trait - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs deleted file mode 100644 index 9e07f0eae..000000000 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker(always)] //~ ERROR malformed `marker` attribute -trait Marker1 {} - -#[marker("never")] //~ ERROR malformed `marker` attribute -trait Marker2 {} - -#[marker(key = "value")] //~ ERROR malformed `marker` attribute -trait Marker3 {} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr deleted file mode 100644 index 6f9c9508e..000000000 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: malformed `marker` attribute input - --> $DIR/marker-attribute-with-values.rs:3:1 - | -LL | #[marker(always)] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` - -error: malformed `marker` attribute input - --> $DIR/marker-attribute-with-values.rs:6:1 - | -LL | #[marker("never")] - | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` - -error: malformed `marker` attribute input - --> $DIR/marker-attribute-with-values.rs:9:1 - | -LL | #[marker(key = "value")] - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[marker]` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs deleted file mode 100644 index a6e00ecc9..000000000 --- a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![feature(marker_trait_attr)] -#![feature(associated_type_defaults)] - -#[marker] -trait MarkerConst { - const N: usize; - //~^ ERROR marker traits cannot have associated items -} - -#[marker] -trait MarkerType { - type Output; - //~^ ERROR marker traits cannot have associated items -} - -#[marker] -trait MarkerFn { - fn foo(); - //~^ ERROR marker traits cannot have associated items -} - -#[marker] -trait MarkerConstWithDefault { - const N: usize = 43; - //~^ ERROR marker traits cannot have associated items -} - -#[marker] -trait MarkerTypeWithDefault { - type Output = (); - //~^ ERROR marker traits cannot have associated items -} - -#[marker] -trait MarkerFnWithDefault { - fn foo() {} - //~^ ERROR marker traits cannot have associated items -} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr deleted file mode 100644 index ac218e30b..000000000 --- a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:6:5 - | -LL | const N: usize; - | ^^^^^^^^^^^^^^ - -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:12:5 - | -LL | type Output; - | ^^^^^^^^^^^ - -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:18:5 - | -LL | fn foo(); - | ^^^^^^^^^ - -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:24:5 - | -LL | const N: usize = 43; - | ^^^^^^^^^^^^^^ - -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:30:5 - | -LL | type Output = (); - | ^^^^^^^^^^^ - -error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:36:5 - | -LL | fn foo() {} - | ^^^^^^^^ - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0714`. diff --git a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs deleted file mode 100644 index 1e413120a..000000000 --- a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass - -#![feature(marker_trait_attr)] -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete - -#[marker] -trait MyMarker {} - -impl<T> MyMarker for T {} -impl<T> MyMarker for Vec<T> {} - -fn foo<T: MyMarker>(t: T) -> T { - t -} - -fn main() { - assert_eq!(1, foo(1)); - assert_eq!(2.0, foo(2.0)); - assert_eq!(vec![1], foo(vec![1])); -} diff --git a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr b/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr deleted file mode 100644 index 649e58915..000000000 --- a/src/test/ui/marker_trait_attr/overlap-doesnt-conflict-with-specialization.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/overlap-doesnt-conflict-with-specialization.rs:4:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs deleted file mode 100644 index 62aa22d41..000000000 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs +++ /dev/null @@ -1,10 +0,0 @@ -// check-pass -#![feature(marker_trait_attr)] - -#[marker] -trait Marker {} - -impl Marker for &'static () {} -impl Marker for &'static () {} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs deleted file mode 100644 index eabce1aef..000000000 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker] -trait Marker {} - -impl Marker for &'_ () {} //~ ERROR type annotations needed -impl Marker for &'_ () {} //~ ERROR type annotations needed - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr deleted file mode 100644 index 235c89e20..000000000 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0283]: type annotations needed: cannot satisfy `&(): Marker` - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:6 - | -LL | impl Marker for &'_ () {} - | ^^^^^^ - | -note: multiple `impl`s satisfying `&(): Marker` found - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 - | -LL | impl Marker for &'_ () {} - | ^^^^^^^^^^^^^^^^^^^^^^ -LL | impl Marker for &'_ () {} - | ^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `&(): Marker` - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:6 - | -LL | impl Marker for &'_ () {} - | ^^^^^^ - | -note: multiple `impl`s satisfying `&(): Marker` found - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 - | -LL | impl Marker for &'_ () {} - | ^^^^^^^^^^^^^^^^^^^^^^ -LL | impl Marker for &'_ () {} - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait.rs deleted file mode 100644 index 67e551797..000000000 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Test for RFC 1268: we allow overlapping impls of marker traits, -// that is, traits with #[marker]. In this case, a type `T` is -// `MyMarker` if it is either `Debug` or `Display`. This test just -// checks that we don't consider **all** types to be `MyMarker`. - -#![feature(marker_trait_attr)] - -use std::fmt::{Debug, Display}; - -#[marker] -trait Marker {} - -impl<T: Debug> Marker for T {} -impl<T: Display> Marker for T {} - -fn is_marker<T: Marker>() { } - -struct NotDebugOrDisplay; - -fn main() { - // Debug && Display: - is_marker::<i32>(); - - // Debug && !Display: - is_marker::<Vec<i32>>(); - - // !Debug && !Display - is_marker::<NotDebugOrDisplay>(); //~ ERROR -} diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr deleted file mode 100644 index 133bc0484..000000000 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied - --> $DIR/overlap-marker-trait.rs:28:17 - | -LL | is_marker::<NotDebugOrDisplay>(); - | ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` - | -note: required by a bound in `is_marker` - --> $DIR/overlap-marker-trait.rs:16:17 - | -LL | fn is_marker<T: Marker>() { } - | ^^^^^^ required by this bound in `is_marker` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs b/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs deleted file mode 100644 index f7654458f..000000000 --- a/src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -// Tests for RFC 1268: we allow overlapping impls of marker traits, -// that is, traits with #[marker]. In this case, a type `T` is -// `MyMarker` if it is either `Debug` or `Display`. - -#![feature(marker_trait_attr)] - -use std::fmt::{Debug, Display}; - -#[marker] -trait MyMarker {} - -impl<T: Debug> MyMarker for T {} -impl<T: Display> MyMarker for T {} - -fn foo<T: MyMarker>(t: T) -> T { - t -} - -fn main() { - // Debug && Display: - assert_eq!(1, foo(1)); - assert_eq!(2.0, foo(2.0)); - - // Debug && !Display: - assert_eq!(vec![1], foo(vec![1])); -} diff --git a/src/test/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs b/src/test/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs deleted file mode 100644 index a8f3db5f5..000000000 --- a/src/test/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass -#![feature(marker_trait_attr)] - -#[marker] -pub trait F {} -impl<T> F for T where T: Copy {} -impl<T> F for T where T: 'static {} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs deleted file mode 100644 index 5376fc89d..000000000 --- a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker] -trait Marker { - const N: usize = 0; - fn do_something() {} -} - -struct OverrideConst; -impl Marker for OverrideConst { -//~^ ERROR impls for marker traits cannot contain items - const N: usize = 1; -} - -struct OverrideFn; -impl Marker for OverrideFn { -//~^ ERROR impls for marker traits cannot contain items - fn do_something() { - println!("Hello world!"); - } -} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr deleted file mode 100644 index 1d30c6d56..000000000 --- a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:10:1 - | -LL | impl Marker for OverrideConst { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:16:1 - | -LL | impl Marker for OverrideFn { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0715`. diff --git a/src/test/ui/marker_trait_attr/region-overlap.rs b/src/test/ui/marker_trait_attr/region-overlap.rs deleted file mode 100644 index b3c667103..000000000 --- a/src/test/ui/marker_trait_attr/region-overlap.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker] -trait A {} -impl<'a> A for (&'static (), &'a ()) {} //~ ERROR type annotations needed -impl<'a> A for (&'a (), &'static ()) {} //~ ERROR type annotations needed - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/region-overlap.stderr b/src/test/ui/marker_trait_attr/region-overlap.stderr deleted file mode 100644 index 6631fe987..000000000 --- a/src/test/ui/marker_trait_attr/region-overlap.stderr +++ /dev/null @@ -1,31 +0,0 @@ -error[E0283]: type annotations needed: cannot satisfy `(&'static (), &'a ()): A` - --> $DIR/region-overlap.rs:5:10 - | -LL | impl<'a> A for (&'static (), &'a ()) {} - | ^ - | -note: multiple `impl`s satisfying `(&'static (), &'a ()): A` found - --> $DIR/region-overlap.rs:5:1 - | -LL | impl<'a> A for (&'static (), &'a ()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl<'a> A for (&'a (), &'static ()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0283]: type annotations needed: cannot satisfy `(&'a (), &'static ()): A` - --> $DIR/region-overlap.rs:6:10 - | -LL | impl<'a> A for (&'a (), &'static ()) {} - | ^ - | -note: multiple `impl`s satisfying `(&'a (), &'static ()): A` found - --> $DIR/region-overlap.rs:5:1 - | -LL | impl<'a> A for (&'static (), &'a ()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl<'a> A for (&'a (), &'static ()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/marker_trait_attr/unsound-overlap.rs b/src/test/ui/marker_trait_attr/unsound-overlap.rs deleted file mode 100644 index 2e5101b82..000000000 --- a/src/test/ui/marker_trait_attr/unsound-overlap.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![feature(marker_trait_attr)] - -#[marker] -trait A {} - -trait B {} - -impl<T: A> B for T {} -impl<T: B> A for T {} -impl A for &str {} -impl<T: A + B> A for (T,) {} -trait TraitWithAssoc { - type Assoc; -} - -impl<T: A> TraitWithAssoc for T { - type Assoc = T; -} - -impl TraitWithAssoc for ((&str,),) { - //~^ ERROR conflicting implementations - type Assoc = ((&'static str,),); -} - -fn main() {} diff --git a/src/test/ui/marker_trait_attr/unsound-overlap.stderr b/src/test/ui/marker_trait_attr/unsound-overlap.stderr deleted file mode 100644 index 5ebac8270..000000000 --- a/src/test/ui/marker_trait_attr/unsound-overlap.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `TraitWithAssoc` for type `((&str,),)` - --> $DIR/unsound-overlap.rs:20:1 - | -LL | impl<T: A> TraitWithAssoc for T { - | ------------------------------- first implementation here -... -LL | impl TraitWithAssoc for ((&str,),) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((&str,),)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. |