forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#56862 - arielb1:fundamentally-clean, r=nikoma…
…tsakis stop treating trait objects from #[fundamental] traits as fundamental This is a [breaking-change] to code that exploits this functionality (which should be limited to code using `#![feature(fundamental)]`. Fixes rust-lang#56503. r? @nikomatsakis
- Loading branch information
Showing
4 changed files
with
37 additions
and
4 deletions.
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
7 changes: 7 additions & 0 deletions
7
src/test/ui/coherence/auxiliary/coherence_fundamental_trait_lib.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,7 @@ | ||
#![crate_type = "rlib"] | ||
#![feature(fundamental)] | ||
|
||
pub trait Misc {} | ||
|
||
#[fundamental] | ||
pub trait Fundamental<T> {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/coherence/coherence-fundamental-trait-objects.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,15 @@ | ||
// Check that trait objects from #[fundamental] traits are not | ||
// treated as #[fundamental] types - the 2 meanings of #[fundamental] | ||
// are distinct. | ||
|
||
// aux-build:coherence_fundamental_trait_lib.rs | ||
|
||
extern crate coherence_fundamental_trait_lib; | ||
|
||
use coherence_fundamental_trait_lib::{Fundamental, Misc}; | ||
|
||
pub struct Local; | ||
impl Misc for dyn Fundamental<Local> {} | ||
//~^ ERROR E0117 | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/coherence/coherence-fundamental-trait-objects.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[E0117]: only traits defined in the current crate can be implemented for arbitrary types | ||
--> $DIR/coherence-fundamental-trait-objects.rs:12:1 | ||
| | ||
LL | impl Misc for dyn Fundamental<Local> {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | ||
| | ||
= note: the impl does not reference any types defined in this crate | ||
= note: define and implement a trait or new type instead | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0117`. |