move Constness into TraitPredicate
This commit is contained in:
parent
456e48f39e
commit
80bff87c6f
@ -93,7 +93,7 @@ fn check_fn(
|
|||||||
cx.tcx.infer_ctxt().enter(|infcx| {
|
cx.tcx.infer_ctxt().enter(|infcx| {
|
||||||
for FulfillmentError { obligation, .. } in send_errors {
|
for FulfillmentError { obligation, .. } in send_errors {
|
||||||
infcx.maybe_note_obligation_cause_for_async_await(db, &obligation);
|
infcx.maybe_note_obligation_cause_for_async_await(db, &obligation);
|
||||||
if let Trait(trait_pred, _) = obligation.predicate.kind().skip_binder() {
|
if let Trait(trait_pred) = obligation.predicate.kind().skip_binder() {
|
||||||
db.note(&format!(
|
db.note(&format!(
|
||||||
"`{}` doesn't implement `{}`",
|
"`{}` doesn't implement `{}`",
|
||||||
trait_pred.self_ty(),
|
trait_pred.self_ty(),
|
||||||
|
@ -121,7 +121,7 @@ fn check_fn(
|
|||||||
.filter_map(|obligation| {
|
.filter_map(|obligation| {
|
||||||
// Note that we do not want to deal with qualified predicates here.
|
// Note that we do not want to deal with qualified predicates here.
|
||||||
match obligation.predicate.kind().no_bound_vars() {
|
match obligation.predicate.kind().no_bound_vars() {
|
||||||
Some(ty::PredicateKind::Trait(pred, _)) if pred.def_id() != sized_trait => Some(pred),
|
Some(ty::PredicateKind::Trait(pred)) if pred.def_id() != sized_trait => Some(pred),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -45,7 +45,7 @@ fn get_trait_predicates_for_trait_id<'tcx>(
|
|||||||
let mut preds = Vec::new();
|
let mut preds = Vec::new();
|
||||||
for (pred, _) in generics.predicates {
|
for (pred, _) in generics.predicates {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let PredicateKind::Trait(poly_trait_pred, _) = pred.kind().skip_binder();
|
if let PredicateKind::Trait(poly_trait_pred) = pred.kind().skip_binder();
|
||||||
let trait_pred = cx.tcx.erase_late_bound_regions(pred.kind().rebind(poly_trait_pred));
|
let trait_pred = cx.tcx.erase_late_bound_regions(pred.kind().rebind(poly_trait_pred));
|
||||||
if let Some(trait_def_id) = trait_id;
|
if let Some(trait_def_id) = trait_id;
|
||||||
if trait_def_id == trait_pred.trait_ref.def_id;
|
if trait_def_id == trait_pred.trait_ref.def_id;
|
||||||
|
@ -36,7 +36,7 @@ pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, msrv: Option<&Ru
|
|||||||
ty::PredicateKind::ObjectSafe(_) => panic!("object safe predicate on function: {:#?}", predicate),
|
ty::PredicateKind::ObjectSafe(_) => panic!("object safe predicate on function: {:#?}", predicate),
|
||||||
ty::PredicateKind::ClosureKind(..) => panic!("closure kind predicate on function: {:#?}", predicate),
|
ty::PredicateKind::ClosureKind(..) => panic!("closure kind predicate on function: {:#?}", predicate),
|
||||||
ty::PredicateKind::Subtype(_) => panic!("subtype predicate on function: {:#?}", predicate),
|
ty::PredicateKind::Subtype(_) => panic!("subtype predicate on function: {:#?}", predicate),
|
||||||
ty::PredicateKind::Trait(pred, _) => {
|
ty::PredicateKind::Trait(pred) => {
|
||||||
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
|
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
|
|||||||
ty::Tuple(substs) => substs.types().any(|ty| is_must_use_ty(cx, ty)),
|
ty::Tuple(substs) => substs.types().any(|ty| is_must_use_ty(cx, ty)),
|
||||||
ty::Opaque(ref def_id, _) => {
|
ty::Opaque(ref def_id, _) => {
|
||||||
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
|
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
|
||||||
if let ty::PredicateKind::Trait(trait_predicate, _) = predicate.kind().skip_binder() {
|
if let ty::PredicateKind::Trait(trait_predicate) = predicate.kind().skip_binder() {
|
||||||
if must_use_attr(cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() {
|
if must_use_attr(cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user