diff options
| author | Michael Goulet <michael@errs.io> | 2022-07-24 10:34:35 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-07-25 23:38:41 +0000 |
| commit | b7cf9f72f647f05cc2b028c569735a91caf2a79a (patch) | |
| tree | de280177e1d63dbfb4a15a6f412983c1ba76a1d0 /src | |
| parent | 6dbae3ad19309bb541d9e76638e6aa4b5449f29a (diff) | |
| download | rust-b7cf9f72f647f05cc2b028c569735a91caf2a79a.tar.gz rust-b7cf9f72f647f05cc2b028c569735a91caf2a79a.zip | |
Restore Opaque behavior to coherence check
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/coherence/issue-99663-2.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/coherence/issue-99663.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/negative-reasoning.stderr | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/src/test/ui/coherence/issue-99663-2.rs b/src/test/ui/coherence/issue-99663-2.rs new file mode 100644 index 00000000000..10a0a568849 --- /dev/null +++ b/src/test/ui/coherence/issue-99663-2.rs @@ -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() {} diff --git a/src/test/ui/coherence/issue-99663.rs b/src/test/ui/coherence/issue-99663.rs new file mode 100644 index 00000000000..a2d4d398ce1 --- /dev/null +++ b/src/test/ui/coherence/issue-99663.rs @@ -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() {} diff --git a/src/test/ui/impl-trait/negative-reasoning.stderr b/src/test/ui/impl-trait/negative-reasoning.stderr index 2eea726a19c..479b451855d 100644 --- a/src/test/ui/impl-trait/negative-reasoning.stderr +++ b/src/test/ui/impl-trait/negative-reasoning.stderr @@ -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 |
