-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a lint to plug autotrait impl soundness hole (#263)
- Loading branch information
Showing
6 changed files
with
94 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
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
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
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
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,9 @@ | ||
#![crate_type = "lib"] | ||
|
||
pub struct Foo(pub std::cell::Cell<i32>, pub std::marker::PhantomPinned); | ||
|
||
impl std::panic::UnwindSafe for Foo {} | ||
|
||
impl std::panic::RefUnwindSafe for Foo {} | ||
|
||
impl std::marker::Unpin for Foo {} |
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,22 @@ | ||
error: explicit implementations of auto traits are forbidden in PL/Rust | ||
--> $DIR/impl_auto_trait.rs:5:1 | ||
| | ||
LL | impl std::panic::UnwindSafe for Foo {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-F plrust-autotrait-impls` implied by `-F plrust-lints` | ||
|
||
error: explicit implementations of auto traits are forbidden in PL/Rust | ||
--> $DIR/impl_auto_trait.rs:7:1 | ||
| | ||
LL | impl std::panic::RefUnwindSafe for Foo {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: explicit implementations of auto traits are forbidden in PL/Rust | ||
--> $DIR/impl_auto_trait.rs:9:1 | ||
| | ||
LL | impl std::marker::Unpin for Foo {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|