diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-16 08:57:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-16 08:57:07 +0100 |
| commit | f0205d55ced197fbbee099ef682d5d9503bbb30d (patch) | |
| tree | 91ae4badf5de77ed71ed1d44d0bbb0eb4df7e221 /src | |
| parent | 36b82373e0e62201133c0287e33a7bf3172d4cb3 (diff) | |
| parent | d2b7604db9d3262fd9fe9ab39efb60652e252448 (diff) | |
| download | rust-f0205d55ced197fbbee099ef682d5d9503bbb30d.tar.gz rust-f0205d55ced197fbbee099ef682d5d9503bbb30d.zip | |
Rollup merge of #109166 - lcnr:define_opaque_types-explicit, r=oli-obk
make `define_opaque_types` fully explicit based on the idea of #108389. Moved `define_opaque_types` into the actual operations, e.g. `eq`, instead of `infcx.at` because normalization doesn't use `define_opaque_types` and even creates it's own `At` with a different `define_opaque_types` internally. Somewhat surprisingly, coherence actually relies on `DefineOpaqueTypes::Yes` for soundness which was revealed because I've incorrectly used `DefineOpaqueTypes::No` in `equate_impl_headers`. It feels concerning that even though this is the case, we still sometimes use `DefineOpaqueTypes::No` in coherence. I did not look into this as part of this PR as it is purely changing the structure of the code without changing behavior in any way. r? ```@oli-obk```
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/blanket_impl.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index bcdbbcacc4b..3a3bf6a7ab9 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -1,6 +1,6 @@ use crate::rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt; use rustc_hir as hir; -use rustc_infer::infer::{InferOk, TyCtxtInferExt}; +use rustc_infer::infer::{DefineOpaqueTypes, InferOk, TyCtxtInferExt}; use rustc_infer::traits; use rustc_middle::ty::ToPredicate; use rustc_span::DUMMY_SP; @@ -47,8 +47,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { // Require the type the impl is implemented on to match // our type, and ignore the impl if there was a mismatch. - let cause = traits::ObligationCause::dummy(); - let Ok(eq_result) = infcx.at(&cause, param_env).eq(impl_trait_ref.self_ty(), impl_ty) else { + let Ok(eq_result) = infcx.at(&traits::ObligationCause::dummy(), param_env).eq(DefineOpaqueTypes::No, impl_trait_ref.self_ty(), impl_ty) else { continue }; let InferOk { value: (), obligations } = eq_result; |
