Rollup merge of #93358 - compiler-errors:is-not-const, r=fee1-dead
Add note suggesting that predicate may be satisfied, but is not `const` Not sure if we should be printing this in addition to, or perhaps _instead_ of the help message: ``` help: the trait `~const Add` is not implemented for `NonConstAdd` ``` Also added `ParamEnv::is_const` and `PolyTraitPredicate::is_const_if_const` and, in a separate commit, used those in other places instead of `== hir::Constness::Const`, etc. r? ````@fee1-dead````
This commit is contained in:
@@ -86,7 +86,6 @@ declare_lint_pass!(
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
|
||||
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::PredicateKind::*;
|
||||
|
||||
let predicates = cx.tcx.explicit_predicates_of(item.def_id);
|
||||
@@ -94,7 +93,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
|
||||
let Trait(trait_predicate) = predicate.kind().skip_binder() else {
|
||||
continue
|
||||
};
|
||||
if trait_predicate.constness == ty::BoundConstness::ConstIfConst {
|
||||
if trait_predicate.is_const_if_const() {
|
||||
// `~const Drop` definitely have meanings so avoid linting here.
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user