Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for issue 103574 #103611

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// check-pass
#![feature(marker_trait_attr)]

#[marker]
trait Marker {}

impl Marker for &'static () {}
impl Marker for &'static () {}

fn main() {}
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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`.
3 changes: 2 additions & 1 deletion src/test/ui/marker_trait_attr/overlap-marker-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/marker_trait_attr/overlap-marker-trait.stderr
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down