Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2252f7a

Browse files
Rollup merge of #103611 - Rageking8:fix-103574, r=lcnr
Add test for issue 103574 Fixes #103574 Together with some slight formatting. r? `@lcnr`
2 parents 0f0c044 + 2f2a97e commit 2252f7a

6 files changed

+56
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
#![feature(marker_trait_attr)]
3+
4+
#[marker]
5+
trait Marker {}
6+
7+
impl Marker for &'static () {}
8+
impl Marker for &'static () {}
9+
10+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(marker_trait_attr)]
2+
3+
#[marker]
4+
trait Marker {}
5+
6+
impl Marker for &'_ () {} //~ ERROR type annotations needed
7+
impl Marker for &'_ () {} //~ ERROR type annotations needed
8+
9+
fn main() {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
2+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:6
3+
|
4+
LL | impl Marker for &'_ () {}
5+
| ^^^^^^
6+
|
7+
note: multiple `impl`s satisfying `&(): Marker` found
8+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1
9+
|
10+
LL | impl Marker for &'_ () {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
LL | impl Marker for &'_ () {}
13+
| ^^^^^^^^^^^^^^^^^^^^^^
14+
15+
error[E0283]: type annotations needed: cannot satisfy `&(): Marker`
16+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:6
17+
|
18+
LL | impl Marker for &'_ () {}
19+
| ^^^^^^
20+
|
21+
note: multiple `impl`s satisfying `&(): Marker` found
22+
--> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1
23+
|
24+
LL | impl Marker for &'_ () {}
25+
| ^^^^^^^^^^^^^^^^^^^^^^
26+
LL | impl Marker for &'_ () {}
27+
| ^^^^^^^^^^^^^^^^^^^^^^
28+
29+
error: aborting due to 2 previous errors
30+
31+
For more information about this error, try `rustc --explain E0283`.

‎src/test/ui/marker_trait_attr/overlap-marker-trait.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
use std::fmt::{Debug, Display};
99

10-
#[marker] trait Marker {}
10+
#[marker]
11+
trait Marker {}
1112

1213
impl<T: Debug> Marker for T {}
1314
impl<T: Display> Marker for T {}

‎src/test/ui/marker_trait_attr/overlap-marker-trait.stderr‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
2-
--> $DIR/overlap-marker-trait.rs:27:17
2+
--> $DIR/overlap-marker-trait.rs:28:17
33
|
44
LL | is_marker::<NotDebugOrDisplay>();
55
| ^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
66
|
77
note: required by a bound in `is_marker`
8-
--> $DIR/overlap-marker-trait.rs:15:17
8+
--> $DIR/overlap-marker-trait.rs:16:17
99
|
1010
LL | fn is_marker<T: Marker>() { }
1111
| ^^^^^^ required by this bound in `is_marker`

‎src/test/ui/marker_trait_attr/overlap-permitted-for-annotated-marker-traits.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
use std::fmt::{Debug, Display};
99

10-
#[marker] trait MyMarker {}
10+
#[marker]
11+
trait MyMarker {}
1112

1213
impl<T: Debug> MyMarker for T {}
1314
impl<T: Display> MyMarker for T {}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /