Skip to content

Commit 9efe60b

Browse files
authored
Rollup merge of #117637 - lqd:trivial-bounds-with-binder-vars, r=compiler-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`
2 parents 2a1f8bc + 58351ae commit 9efe60b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _
3232
use rustc_trait_selection::traits::{
3333
self, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc,
3434
};
35+
use rustc_type_ir::TypeFlags;
3536

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

tests/ui/late-bound-lifetimes/predicate-is-global.rs

+8
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ impl Inherent {
2929
fn inherent(&self) {}
3030
}
3131

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

0 commit comments

Comments
 (0)