Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers
This commit is contained in:
parent
bda32a4023
commit
88a7b6803b
15 changed files with 51 additions and 26 deletions
|
@ -821,6 +821,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
self.infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
// needed for tests/ui/type-alias-impl-trait/assoc-projection-ice.rs
|
||||
.define_opaque_types(true)
|
||||
.sup(obligation_trait_ref, expected_trait_ref)
|
||||
.map(|InferOk { mut obligations, .. }| {
|
||||
obligations.extend(nested);
|
||||
|
|
|
@ -1752,7 +1752,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
});
|
||||
self.infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
.define_opaque_types(false)
|
||||
.sup(ty::Binder::dummy(placeholder_trait_ref), trait_bound)
|
||||
.map(|InferOk { obligations: _, value: () }| {
|
||||
// This method is called within a probe, so we can't have
|
||||
|
@ -1815,7 +1814,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let is_match = self
|
||||
.infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
.define_opaque_types(false)
|
||||
.sup(obligation.predicate, infer_projection)
|
||||
.map_or(false, |InferOk { obligations, value: () }| {
|
||||
self.evaluate_predicates_recursively(
|
||||
|
@ -2507,7 +2505,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let InferOk { obligations, .. } = self
|
||||
.infcx
|
||||
.at(&cause, obligation.param_env)
|
||||
.define_opaque_types(false)
|
||||
.eq(placeholder_obligation_trait_ref, impl_trait_ref)
|
||||
.map_err(|e| {
|
||||
debug!("match_impl: failed eq_trait_refs due to `{}`", e.to_string(self.tcx()))
|
||||
|
@ -2558,11 +2555,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
) -> Result<Vec<PredicateObligation<'tcx>>, ()> {
|
||||
self.infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
// We don't want predicates for opaque types to just match all other types,
|
||||
// if there is an obligation on the opaque type, then that obligation must be met
|
||||
// opaquely. Otherwise we'd match any obligation to the opaque type and then error
|
||||
// out later.
|
||||
.define_opaque_types(false)
|
||||
.sup(obligation.predicate.to_poly_trait_ref(), poly_trait_ref)
|
||||
.map(|InferOk { obligations, .. }| obligations)
|
||||
.map_err(|_| ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue