diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-06-16 14:46:15 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-16 14:46:15 +0530 |
| commit | 64f6c00772321324d77dfd8a0ee708fbb0d9a277 (patch) | |
| tree | bf5761fe7042f156c7b39836c99faeee00c64907 /tests | |
| parent | b41db841e8fe01af6b1f2d17a25a2704950b937f (diff) | |
| parent | 01377e8064a5b3d987b177c16e18da4bffec03a4 (diff) | |
| download | rust-64f6c00772321324d77dfd8a0ee708fbb0d9a277.tar.gz rust-64f6c00772321324d77dfd8a0ee708fbb0d9a277.zip | |
Rollup merge of #112443 - compiler-errors:next-solver-opportunistically-resolve-regions, r=lcnr
Opportunistically resolve regions in new solver Use `opportunistic_resolve_var` during canonicalization to collapse some regions. We have to start using `CanonicalVarValues::is_identity_modulo_regions`. We also have to modify that function to consider responses like `['static, ^0, '^1, ^2]` to be an "identity" response, since because we opportunistically resolve regions, there's no longer a 1:1 mapping between canonical var values and bound var indices in the response... There's one nasty side-effect -- one test (`tests/ui/dyn-star/param-env-infer.rs`) starts to ICE because the certainty goes from `Yes` to `Maybe(Overflow)`... Not exactly sure why, though? Putting this up for discussion/investigation. r? ```@lcnr```
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/traits/new-solver/opportunistic-region-resolve.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/traits/new-solver/opportunistic-region-resolve.rs b/tests/ui/traits/new-solver/opportunistic-region-resolve.rs new file mode 100644 index 00000000000..2610789cd48 --- /dev/null +++ b/tests/ui/traits/new-solver/opportunistic-region-resolve.rs @@ -0,0 +1,19 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +#![feature(rustc_attrs)] + +#[rustc_coinductive] +trait Trait {} + +#[rustc_coinductive] +trait Indirect {} +impl<T: Trait + ?Sized> Indirect for T {} + +impl<'a> Trait for &'a () where &'a (): Indirect {} + +fn impls_trait<T: Trait>() {} + +fn main() { + impls_trait::<&'static ()>(); +} |
