Represent TraitBoundModifiers as distinct parts in HIR
This commit is contained in:
parent
86d69c705a
commit
febb3f7c88
18 changed files with 116 additions and 117 deletions
|
@ -114,10 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
|
|||
let hir::TyKind::TraitObject(bounds, _lifetime, _syntax) = &ty.kind else { return };
|
||||
for bound in &bounds[..] {
|
||||
let def_id = bound.trait_ref.trait_def_id();
|
||||
if def_id.is_some_and(|def_id| cx.tcx.is_lang_item(def_id, LangItem::Drop))
|
||||
// FIXME: ?Drop is not a thing.
|
||||
&& bound.modifiers != hir::TraitBoundModifier::Maybe
|
||||
{
|
||||
if def_id.is_some_and(|def_id| cx.tcx.is_lang_item(def_id, LangItem::Drop)) {
|
||||
let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return };
|
||||
cx.emit_span_lint(DYN_DROP, bound.span, DropGlue { tcx: cx.tcx, def_id });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue