Restore Opaque behavior to coherence check
This commit is contained in:
parent
6dbae3ad19
commit
b7cf9f72f6
4 changed files with 75 additions and 2 deletions
22
src/test/ui/coherence/issue-99663-2.rs
Normal file
22
src/test/ui/coherence/issue-99663-2.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
struct Outer<T: ?Sized> {
|
||||
i: InnerSend<T>,
|
||||
}
|
||||
|
||||
type InnerSend<T: ?Sized> = impl Send;
|
||||
|
||||
fn constrain<T: ?Sized>() -> InnerSend<T> {
|
||||
()
|
||||
}
|
||||
|
||||
trait SendMustNotImplDrop {}
|
||||
|
||||
#[allow(drop_bounds)]
|
||||
impl<T: ?Sized + Send + Drop> SendMustNotImplDrop for T {}
|
||||
|
||||
impl<T: ?Sized> SendMustNotImplDrop for Outer<T> {}
|
||||
|
||||
fn main() {}
|
||||
22
src/test/ui/coherence/issue-99663.rs
Normal file
22
src/test/ui/coherence/issue-99663.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
struct Send<T> {
|
||||
i: InnerSend<T>,
|
||||
}
|
||||
|
||||
type InnerSend<T> = impl Sized;
|
||||
|
||||
fn constrain<T>() -> InnerSend<T> {
|
||||
()
|
||||
}
|
||||
|
||||
trait SendMustNotImplDrop {}
|
||||
|
||||
#[allow(drop_bounds)]
|
||||
impl<T: Drop> SendMustNotImplDrop for T {}
|
||||
|
||||
impl<T> SendMustNotImplDrop for Send<T> {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -7,7 +7,7 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
|
|||
LL | impl AnotherTrait for D<OpaqueType> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
||||
|
|
||||
= note: downstream crates may implement trait `std::fmt::Debug` for type `OpaqueType`
|
||||
= note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
|
||||
|
||||
error: cannot implement trait on type alias impl trait
|
||||
--> $DIR/negative-reasoning.rs:19:25
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue