Rollup merge of #103611 - Rageking8:fix-103574, r=lcnr
Add test for issue 103574 Fixes #103574 Together with some slight formatting. r? `@lcnr`
This commit is contained in:
commit
2252f7aa78
6 changed files with 56 additions and 4 deletions
|
@ -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};
|
use std::fmt::{Debug, Display};
|
||||||
|
|
||||||
#[marker] trait Marker {}
|
#[marker]
|
||||||
|
trait Marker {}
|
||||||
|
|
||||||
impl<T: Debug> Marker for T {}
|
impl<T: Debug> Marker for T {}
|
||||||
impl<T: Display> Marker for T {}
|
impl<T: Display> Marker for T {}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
|
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>();
|
LL | is_marker::<NotDebugOrDisplay>();
|
||||||
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
|
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
|
||||||
|
|
|
|
||||||
note: required by a bound in `is_marker`
|
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>() { }
|
LL | fn is_marker<T: Marker>() { }
|
||||||
| ^^^^^^ required by this bound in `is_marker`
|
| ^^^^^^ required by this bound in `is_marker`
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
use std::fmt::{Debug, Display};
|
use std::fmt::{Debug, Display};
|
||||||
|
|
||||||
#[marker] trait MyMarker {}
|
#[marker]
|
||||||
|
trait MyMarker {}
|
||||||
|
|
||||||
impl<T: Debug> MyMarker for T {}
|
impl<T: Debug> MyMarker for T {}
|
||||||
impl<T: Display> MyMarker for T {}
|
impl<T: Display> MyMarker for T {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue