diff options
| author | bors <bors@rust-lang.org> | 2023-09-13 22:21:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-13 22:21:27 +0000 |
| commit | d5c2e9c342b358556da91d61ed4133f6f50fc0c3 (patch) | |
| tree | deb699298bf1099d5cd455e3b03c70fe5db546cd /tests/ui/implied-bounds | |
| parent | 5680fa18feaa87f3ff04063800aec256c3d4b4be (diff) | |
| parent | 7900923b259380461d21071e2fbd0c604338fb9c (diff) | |
| download | rust-1.72.1.tar.gz rust-1.72.1.zip | |
Auto merge of #115787 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.72.1
[stable] 1.72.1 release This backports: * Remove assert that checks type equality #115215 * implied bounds: do not ICE on unconstrained region vars #115559 * rustdoc: correctly deal with self ty params when eliding default object lifetimes #115276 * Stop emitting non-power-of-two vectors in (non-portable-SIMD) codegen #115236 * Normalize before checking if local is freeze in deduced_param_attrs #114948 Some cherry-picks required merge conflict resolution, we'll see if I got it right based on CI (rustdoc fix and LLVM codegen test). r? `@Mark-Simulacrum`
Diffstat (limited to 'tests/ui/implied-bounds')
| -rw-r--r-- | tests/ui/implied-bounds/implied-bounds-unconstrained-1.rs | 28 | ||||
| -rw-r--r-- | tests/ui/implied-bounds/implied-bounds-unconstrained-2.rs | 20 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/implied-bounds/implied-bounds-unconstrained-1.rs b/tests/ui/implied-bounds/implied-bounds-unconstrained-1.rs new file mode 100644 index 00000000000..025e5176ff7 --- /dev/null +++ b/tests/ui/implied-bounds/implied-bounds-unconstrained-1.rs @@ -0,0 +1,28 @@ +// check-pass + +// Regression test for #112832. +pub trait QueryDb { + type Db; +} + +pub struct QueryTable<Q, DB> { + db: DB, + storage: Q, +} + +// We normalize `<Q as QueryDb>::Db` to `<Q as AsyncQueryFunction<'d>>::SendDb` +// using the where-bound. 'd is an unconstrained region variable which previously +// triggered an assert. +impl<Q> QueryTable<Q, <Q as QueryDb>::Db> where Q: for<'d> AsyncQueryFunction<'d> {} + +pub trait AsyncQueryFunction<'d>: QueryDb<Db = <Self as AsyncQueryFunction<'d>>::SendDb> { + type SendDb: 'd; +} + +pub trait QueryStorageOpsAsync<Q> +where + Q: for<'d> AsyncQueryFunction<'d>, +{ +} + +fn main() {} diff --git a/tests/ui/implied-bounds/implied-bounds-unconstrained-2.rs b/tests/ui/implied-bounds/implied-bounds-unconstrained-2.rs new file mode 100644 index 00000000000..976054facee --- /dev/null +++ b/tests/ui/implied-bounds/implied-bounds-unconstrained-2.rs @@ -0,0 +1,20 @@ +// check-pass + +// Another minimized regression test for #112832. +trait Trait { + type Assoc; +} + +trait Sub<'a>: Trait<Assoc = <Self as Sub<'a>>::SubAssoc> { + type SubAssoc; +} + +// By using the where-clause we normalize `<T as Trait>::Assoc` to +// `<T as Sub<'a>>::SubAssoc` where `'a` is an unconstrained region +// variable. +fn foo<T>(x: <T as Trait>::Assoc) +where + for<'a> T: Sub<'a>, +{} + +fn main() {} |
