diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-10-13 18:19:20 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-13 18:19:20 +0530 |
| commit | 42991e551b56290cc7cbd70fc93a1de4243acbd2 (patch) | |
| tree | 3d4170a563a08e0fc824d185082b326cab0b1fc6 /src/test | |
| parent | dbff6a91c1e50344f56bfa45fda3512afc8669a0 (diff) | |
| parent | 4a8cfe9d14f479ebc2e156f08ac33e8b4ed0d08a (diff) | |
| download | rust-42991e551b56290cc7cbd70fc93a1de4243acbd2.tar.gz rust-42991e551b56290cc7cbd70fc93a1de4243acbd2.zip | |
Rollup merge of #102947 - compiler-errors:sort-elaborated-existentials, r=cjgillot
Sort elaborated existential predicates in `object_ty_for_trait` r? `@cjgillot` I think that #102845 caused #102933. Depending on the order that we elaborate these existential projection predicates, there's no guarantee that they'll be sorted by def id, which is what is failing the assertion in the issue. Fixes #102933 Fixes #102973
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/object-safety/issue-102933.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/object-safety/issue-102933.rs b/src/test/ui/object-safety/issue-102933.rs new file mode 100644 index 00000000000..843391cffb2 --- /dev/null +++ b/src/test/ui/object-safety/issue-102933.rs @@ -0,0 +1,25 @@ +// check-pass + +use std::future::Future; + +pub trait Service { + type Response; + type Future: Future<Output = Self::Response>; +} + +pub trait A1: Service<Response = i32> {} + +pub trait A2: Service<Future = Box<dyn Future<Output = i32>>> + A1 { + fn foo(&self) {} +} + +pub trait B1: Service<Future = Box<dyn Future<Output = i32>>> {} + +pub trait B2: Service<Response = i32> + B1 { + fn foo(&self) {} +} + +fn main() { + let x: &dyn A2 = todo!(); + let x: &dyn B2 = todo!(); +} |
