add tests and slight formatting
This commit is contained in:
parent
1898c34e92
commit
2f2a97ee16
@ -0,0 +1,10 @@
|
||||
// check-pass
|
||||
#![feature(marker_trait_attr)]
|
||||
|
||||
#[marker]
|
||||
trait Marker {}
|
||||
|
||||
impl Marker for &'static () {}
|
||||
impl Marker for &'static () {}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,9 @@
|
||||
#![feature(marker_trait_attr)]
|
||||
|
||||
#[marker]
|
||||
trait Marker {}
|
||||
|
||||
impl Marker for &'_ () {} //~ ERROR type annotations needed
|
||||
impl Marker for &'_ () {} //~ ERROR type annotations needed
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,31 @@
|
||||
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`.
|
@ -7,7 +7,8 @@
|
||||
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
#[marker] trait Marker {}
|
||||
#[marker]
|
||||
trait Marker {}
|
||||
|
||||
impl<T: Debug> Marker for T {}
|
||||
impl<T: Display> Marker for T {}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
|
||||
--> $DIR/overlap-marker-trait.rs:27:17
|
||||
--> $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:15:17
|
||||
--> $DIR/overlap-marker-trait.rs:16:17
|
||||
|
|
||||
LL | fn is_marker<T: Marker>() { }
|
||||
| ^^^^^^ required by this bound in `is_marker`
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
#[marker] trait MyMarker {}
|
||||
#[marker]
|
||||
trait MyMarker {}
|
||||
|
||||
impl<T: Debug> MyMarker for T {}
|
||||
impl<T: Display> MyMarker for T {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user