&& !in_external_macro(cx.sess(), expr.span)
&& (expr.span.eq_ctxt(arg.span) || is_vec_expn(cx, arg))
&& seg.ident.name == sym::new
- && path_def_id(cx, ty) == cx.tcx.lang_items().owned_box()
+ && path_def_id(cx, ty).map_or(false, |id| Some(id) == cx.tcx.lang_items().owned_box())
&& is_default_equivalent(cx, arg)
{
let arg_ty = cx.typeck_results().expr_ty(arg);
impl<'tcx> Visitor<'tcx> for InferVisitor {
fn visit_ty(&mut self, t: &rustc_hir::Ty<'_>) {
- self.0 |= matches!(t.kind, TyKind::Infer);
+ self.0 |= matches!(t.kind, TyKind::Infer | TyKind::OpaqueDef(..) | TyKind::TraitObject(..));
if !self.0 {
walk_ty(self, t);
}