diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-08 21:02:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-08 21:02:02 +0100 |
| commit | 9829ff67baa3bd2b2e2ba265ecf9b92f1a8d23ac (patch) | |
| tree | 72c52aff62f99ac816b19471cfc74291321c77b2 | |
| parent | 2b6ae95d3f3f7a45b1d1852b7e850d363143b481 (diff) | |
| parent | 8dd4e2b5cad4814fd1556496448377958e77e5fe (diff) | |
| download | rust-9829ff67baa3bd2b2e2ba265ecf9b92f1a8d23ac.tar.gz rust-9829ff67baa3bd2b2e2ba265ecf9b92f1a8d23ac.zip | |
Rollup merge of #122171 - compiler-errors:next-solver-tests, r=lcnr
Add some new solver tests Fixes #119607 Fixes #119608 r? lcnr
| -rw-r--r-- | tests/ui/traits/next-solver/assembly/param-env-alias-bound-conflict.rs | 26 | ||||
| -rw-r--r-- | tests/ui/traits/next-solver/env-shadows-impls/param-env-impl-conflict.rs | 23 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/assembly/param-env-alias-bound-conflict.rs b/tests/ui/traits/next-solver/assembly/param-env-alias-bound-conflict.rs new file mode 100644 index 00000000000..ddda1a71d7e --- /dev/null +++ b/tests/ui/traits/next-solver/assembly/param-env-alias-bound-conflict.rs @@ -0,0 +1,26 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// Regression test for #119607. + +pub trait IntoFoo { + type Item; + type IntoIter: Foo<Item = Self::Item>; + + fn into_iter(self) -> Self::IntoIter; +} + +pub trait Foo { + type Item; + + fn next(self) -> Option<Self::Item>; +} + +pub fn foo<'a, Iter1, Elem1>(a: &'a Iter1) +where + &'a Iter1: IntoFoo<Item = Elem1>, +{ + a.into_iter().next(); +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/env-shadows-impls/param-env-impl-conflict.rs b/tests/ui/traits/next-solver/env-shadows-impls/param-env-impl-conflict.rs new file mode 100644 index 00000000000..1b9e9866cd6 --- /dev/null +++ b/tests/ui/traits/next-solver/env-shadows-impls/param-env-impl-conflict.rs @@ -0,0 +1,23 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// Regression test for #119608. + +pub trait Foo {} + +pub trait Bar { + type Assoc; +} + +impl<T: Foo> Bar for T { + type Assoc = T; +} + +pub fn foo<I>(_input: <I as Bar>::Assoc) +where + I: Bar, + <I as Bar>::Assoc: Foo, +{ +} + +fn main() {} |
