]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/builtin.rs
Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
[rust.git] / src / librustc_lint / builtin.rs
index e17e8b7b9640e8e8dfd334f088859da67a06d1b3..efe60ce1b8889d83c21d82dd0694281bbca4b9db 100644 (file)
@@ -1102,6 +1102,10 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
             hir::ItemKind::TyAlias(ref ty, ref generics) => (&*ty, generics),
             _ => return,
         };
+        if let hir::TyKind::OpaqueDef(..) = ty.kind {
+            // Bounds are respected for `type X = impl Trait`
+            return;
+        }
         let mut suggested_changing_assoc_types = false;
         // There must not be a where clause
         if !type_alias_generics.where_clause.predicates.is_empty() {
@@ -1899,7 +1903,7 @@ fn is_dangerous_init(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>) -> Option<I
                         }
                     }
                 }
-            } else if let hir::ExprKind::MethodCall(_, _, ref args) = expr.kind {
+            } else if let hir::ExprKind::MethodCall(_, _, ref args, _) = expr.kind {
                 // Find problematic calls to `MaybeUninit::assume_init`.
                 let def_id = cx.tables.type_dependent_def_id(expr.hir_id)?;
                 if cx.tcx.is_diagnostic_item(sym::assume_init, def_id) {