Skip to content

Commit b07de24

Browse files
committed
Remove constness from TraitPredicate
1 parent b0e64a9 commit b07de24

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

clippy_lints/src/derive.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_lint::{LateContext, LateLintPass};
1515
use rustc_middle::hir::nested_filter;
1616
use rustc_middle::traits::Reveal;
1717
use rustc_middle::ty::{
18-
self, BoundConstness, ClauseKind, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv,
18+
self, ClauseKind, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv,
1919
ToPredicate, TraitPredicate, Ty, TyCtxt,
2020
};
2121
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -523,7 +523,6 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
523523
if let ClauseKind::Trait(p) = p.kind().skip_binder()
524524
&& p.trait_ref.def_id == eq_trait_id
525525
&& let ty::Param(self_ty) = p.trait_ref.self_ty().kind()
526-
&& p.constness == BoundConstness::NotConst
527526
{
528527
// Flag types which already have an `Eq` bound.
529528
params[self_ty.index as usize].1 = false;
@@ -535,7 +534,6 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
535534
params.iter().filter(|&&(_, needs_eq)| needs_eq).map(|&(param, _)| {
536535
ClauseKind::Trait(TraitPredicate {
537536
trait_ref: ty::TraitRef::new(tcx, eq_trait_id, [tcx.mk_param_from_def(param)]),
538-
constness: BoundConstness::NotConst,
539537
polarity: ImplPolarity::Positive,
540538
})
541539
.to_predicate(tcx)

clippy_lints/src/eta_reduction.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir::{BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPat
1010
use rustc_infer::infer::TyCtxtInferExt;
1111
use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::ty::{
13-
self, Binder, BoundConstness, ClosureArgs, ClosureKind, EarlyBinder, FnSig, GenericArg, GenericArgKind,
13+
self, Binder, ClosureArgs, ClosureKind, EarlyBinder, FnSig, GenericArg, GenericArgKind,
1414
GenericArgsRef, ImplPolarity, List, Region, RegionKind, Ty, TypeVisitableExt, TypeckResults,
1515
};
1616
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -171,7 +171,6 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
171171
= cx.tcx.infer_ctxt().build().type_implements_fn_trait(
172172
cx.param_env,
173173
Binder::bind_with_vars(callee_ty_adjusted, List::empty()),
174-
BoundConstness::NotConst,
175174
ImplPolarity::Positive,
176175
) && path_to_local(callee)
177176
.map_or(

clippy_utils/src/qualify_min_const_fn.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_middle::mir::{
1616
};
1717
use rustc_middle::traits::{ImplSource, ObligationCause, BuiltinImplSource};
1818
use rustc_middle::ty::adjustment::PointerCoercion;
19-
use rustc_middle::ty::{self, BoundConstness, GenericArgKind, TraitRef, Ty, TyCtxt};
19+
use rustc_middle::ty::{self, GenericArgKind, TraitRef, Ty, TyCtxt};
2020
use rustc_semver::RustcVersion;
2121
use rustc_span::symbol::sym;
2222
use rustc_span::Span;
@@ -399,11 +399,12 @@ fn is_ty_const_destruct<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, body: &Body<'tcx>
399399
return true;
400400
}
401401

402+
// FIXME(effects) constness
402403
let obligation = Obligation::new(
403404
tcx,
404405
ObligationCause::dummy_with_span(body.span),
405406
ConstCx::new(tcx, body).param_env,
406-
TraitRef::from_lang_item(tcx, LangItem::Destruct, body.span, [ty]).with_constness(BoundConstness::ConstIfConst),
407+
TraitRef::from_lang_item(tcx, LangItem::Destruct, body.span, [ty]),
407408
);
408409

409410
let infcx = tcx.infer_ctxt().build();

clippy_utils/src/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
267267
cause: ObligationCause::dummy(),
268268
param_env,
269269
recursion_depth: 0,
270-
predicate: ty::Binder::dummy(trait_ref).without_const().to_predicate(tcx),
270+
predicate: ty::Binder::dummy(trait_ref).to_predicate(tcx),
271271
};
272272
infcx
273273
.evaluate_obligation(&obligation)

0 commit comments

Comments
 (0)