Skip to content

Commit

Permalink
Rollup merge of #117637 - lqd:trivial-bounds-with-binder-vars, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Check binders with bound vars for global bounds that don't hold

This fixes `soa_derive-0.13.0` from #117589's crater run.

r? `@compiler-errors`
  • Loading branch information
matthiaskrgr committed Nov 6, 2023
2 parents 2a1f8bc + 58351ae commit 9efe60b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _
use rustc_trait_selection::traits::{
self, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc,
};
use rustc_type_ir::TypeFlags;

use std::cell::LazyCell;
use std::ops::{ControlFlow, Deref};
Expand Down Expand Up @@ -1877,7 +1878,7 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
continue;
}
// Match the existing behavior.
if pred.is_global() && !pred.has_late_bound_vars() {
if pred.is_global() && !pred.has_type_flags(TypeFlags::HAS_BINDER_VARS) {
let pred = self.normalize(span, None, pred);
let hir_node = tcx.hir().find_by_def_id(self.body_def_id);

Expand Down
8 changes: 8 additions & 0 deletions tests/ui/late-bound-lifetimes/predicate-is-global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ impl Inherent {
fn inherent(&self) {}
}

// This trivial bound doesn't hold, but the unused lifetime tripped up that check after #117589, and
// showed up in its crater results (in `soa-derive 0.13.0`).
fn do_it()
where
for<'a> Inherent: Clone,
{
}

fn main() {}

0 comments on commit 9efe60b

Please sign in to comment.