-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
110: Add ui test for marker_trait_attr feature r=taiki-e a=taiki-e cc #105 Co-authored-by: Taiki Endo <te316e89@gmail.com>
- Loading branch information
Showing
5 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/ui/unstable-features/marker_trait_attr-feature-gate.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// compile-fail | ||
|
||
// NB: If you change this test, change 'marker_trait_attr.rs' at the same time. | ||
|
||
use pin_project::pin_project; | ||
use std::marker::PhantomPinned; | ||
|
||
#[pin_project] //~ ERROR E0119 | ||
struct Foo<T> { | ||
#[pin] | ||
x: T, | ||
} | ||
|
||
// unsound Unpin impl | ||
impl<T> Unpin for Foo<T> {} | ||
|
||
fn is_unpin<T: Unpin>() {} | ||
|
||
fn foo_is_unpin() { | ||
is_unpin::<Foo<PhantomPinned>>() | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
tests/ui/unstable-features/marker_trait_attr-feature-gate.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_>`: | ||
--> $DIR/marker_trait_attr-feature-gate.rs:8:1 | ||
| | ||
8 | #[pin_project] //~ ERROR E0119 | ||
| ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_>` | ||
... | ||
15 | impl<T> Unpin for Foo<T> {} | ||
| ------------------------ first implementation here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// compile-fail | ||
|
||
// NB: If you change this test, change 'marker_trait_attr-feature-gate.rs' at the same time. | ||
|
||
// marker_trait_attr | ||
// Tracking issue: https://github.com/rust-lang/rust/issues/29864 | ||
#![feature(marker_trait_attr)] | ||
|
||
// See https://github.com/taiki-e/pin-project/issues/105#issuecomment-535355974 | ||
|
||
use pin_project::pin_project; | ||
use std::marker::PhantomPinned; | ||
|
||
#[pin_project] //~ ERROR E0119 | ||
struct Foo<T> { | ||
#[pin] | ||
x: T, | ||
} | ||
|
||
// unsound Unpin impl | ||
impl<T> Unpin for Foo<T> {} | ||
|
||
fn is_unpin<T: Unpin>() {} | ||
|
||
fn foo_is_unpin() { | ||
is_unpin::<Foo<PhantomPinned>>() | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0119]: conflicting implementations of trait `std::marker::Unpin` for type `Foo<_>`: | ||
--> $DIR/marker_trait_attr.rs:14:1 | ||
| | ||
14 | #[pin_project] //~ ERROR E0119 | ||
| ^^^^^^^^^^^^^^ conflicting implementation for `Foo<_>` | ||
... | ||
21 | impl<T> Unpin for Foo<T> {} | ||
| ------------------------ first implementation here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0119`. |