]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/method/prelude2021.rs
Rollup merge of #86783 - mark-i-m:mutex-drop-unsized, r=Xanewok
[rust.git] / compiler / rustc_typeck / src / check / method / prelude2021.rs
index 4c925a6f2370775a7c31ae85c0b3617c9f46cba7..e8748dd062f5334beda61776ecccc603e3e628cb 100644 (file)
@@ -57,6 +57,13 @@ pub(super) fn lint_dot_call_from_2018(
             {
                 return;
             }
+
+            // if it's an inherent `self` method (not `&self` or `&mut self`), it will take
+            // precedence over the `TryInto` impl, and thus won't break in 2021 edition
+            if pick.autoderefs == 0 && pick.autoref_or_ptr_adjustment.is_none() {
+                return;
+            }
+
             // Inherent impls only require not relying on autoref and autoderef in order to
             // ensure that the trait implementation won't be used
             self.tcx.struct_span_lint_hir(