Auto merge of #56862 - arielb1:fundamentally-clean, r=nikomatsakis
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 #56503. r? @nikomatsakis
This commit is contained in:
commit
9966590422
4 changed files with 37 additions and 4 deletions
|
|
@ -0,0 +1,7 @@
|
|||
#![crate_type = "rlib"]
|
||||
#![feature(fundamental)]
|
||||
|
||||
pub trait Misc {}
|
||||
|
||||
#[fundamental]
|
||||
pub trait Fundamental<T> {}
|
||||
15
src/test/ui/coherence/coherence-fundamental-trait-objects.rs
Normal file
15
src/test/ui/coherence/coherence-fundamental-trait-objects.rs
Normal file
|
|
@ -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() {}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue