Skip to content

Commit

Permalink
Rollup merge of rust-lang#112667 - compiler-errors:wf-goal-is-clause,…
Browse files Browse the repository at this point in the history
… r=lcnr

Move WF/ConstEvaluatable goal to clause

It can show up in a param-env, so I think it needs to be a clause kind.

r? ``@lcnr`` or ``@oli-obk``
  • Loading branch information
compiler-errors authored Jun 18, 2023
2 parents 996c4ba + 4343d36 commit eb07f47
Show file tree
Hide file tree
Showing 40 changed files with 719 additions and 685 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ fn check_opaque_type_well_formed<'tcx>(
// Require the hidden type to be well-formed with only the generics of the opaque type.
// Defining use functions may have more bounds than the opaque type, which is ok, as long as the
// hidden type is well formed even without those bounds.
let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
let predicate =
ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::WellFormed(definition_ty.into())));
ocx.register_obligation(Obligation::misc(tcx, definition_span, def_id, param_env, predicate));

// Check that all obligations are satisfied by the implementation's
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
//
// See #91068 for an example.
self.prove_predicates(
sig.inputs_and_output
.iter()
.map(|ty| ty::Binder::dummy(ty::PredicateKind::WellFormed(ty.into()))),
sig.inputs_and_output.iter().map(|ty| {
ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::WellFormed(
ty.into(),
)))
}),
term_location.to_locations(),
ConstraintCategory::Boring,
);
Expand Down Expand Up @@ -1850,7 +1852,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {

let array_ty = rvalue.ty(body.local_decls(), tcx);
self.prove_predicate(
ty::PredicateKind::WellFormed(array_ty.into()),
ty::PredicateKind::Clause(ty::Clause::WellFormed(array_ty.into())),
Locations::Single(location),
ConstraintCategory::Boring,
);
Expand Down
Loading

0 comments on commit eb07f47

Please sign in to comment.