Skip to content

Commit 1249bd0

Browse files
committed
only trigger in leaf crate
1 parent ff873fb commit 1249bd0

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4755,6 +4755,7 @@ dependencies = [
47554755
"rustc_errors",
47564756
"rustc_hir",
47574757
"rustc_infer",
4758+
"rustc_lint_defs",
47584759
"rustc_macros",
47594760
"rustc_middle",
47604761
"rustc_next_trait_solver",

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_hir as hir;
66
use rustc_hir::def::DefKind;
77
use rustc_hir::def_id::{DefId, LocalDefId};
88
use rustc_hir::find_attr;
9+
use rustc_lint_defs;
910
use rustc_middle::ty::{
1011
self, Binder, Clause, GenericArgKind, GenericArgs, GenericPredicates, ImplTraitInTraitData, Ty,
1112
TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitor, Upcast, UpcastFrom,
@@ -31,7 +32,10 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
3132
let mut result = tcx.explicit_predicates_of(def_id);
3233
debug!("predicates_of: explicit_predicates_of({:?}) = {:?}", def_id, result);
3334

34-
if tcx.sess.opts.unstable_opts.strict_projection_item_bounds {
35+
// Check lint cap level to avoid triggering this flag on deps.
36+
if tcx.sess.opts.lint_cap != Some(rustc_lint_defs::Level::Allow)
37+
&& tcx.sess.opts.unstable_opts.strict_projection_item_bounds
38+
{
3539
let implied_item_bounds = elaborate_projection_predicates(tcx, result.predicates.to_vec());
3640
result.predicates = tcx
3741
.arena

compiler/rustc_trait_selection/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1212
rustc_errors = { path = "../rustc_errors" }
1313
rustc_hir = { path = "../rustc_hir" }
1414
rustc_infer = { path = "../rustc_infer" }
15+
rustc_lint_defs = { path = "../rustc_lint_defs" }
1516
rustc_macros = { path = "../rustc_macros" }
1617
rustc_middle = { path = "../rustc_middle" }
1718
rustc_next_trait_solver = { path = "../rustc_next_trait_solver" }

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_hir as hir;
99
use rustc_hir::def::DefKind;
1010
use rustc_hir::lang_items::LangItem;
1111
use rustc_infer::traits::{ObligationCauseCode, PredicateObligations};
12+
use rustc_lint_defs;
1213
use rustc_middle::bug;
1314
use rustc_middle::ty::{
1415
self, GenericArgsRef, Term, TermKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable,
@@ -467,7 +468,10 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
467468
_ => false,
468469
}
469470
}
470-
if tcx.sess.opts.unstable_opts.strict_projection_item_bounds {
471+
// Check lint cap level to avoid triggering this flag on deps.
472+
if tcx.sess.opts.lint_cap != Some(rustc_lint_defs::Level::Allow)
473+
&& tcx.sess.opts.unstable_opts.strict_projection_item_bounds
474+
{
471475
// Add item bounds to the predicate term.
472476
// If the term is generic, we can skip these item bounds as they're implied by
473477
// `elaborate_projection_predicates`.

0 commit comments

Comments
 (0)