]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/op.rs
Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-dead
[rust.git] / compiler / rustc_hir_typeck / src / op.rs
index 38b3dd218a9719b4b28fcc41ff354c66bb50c42b..adc7a21f265a82be3cec68264b95a88ee6c42ef2 100644 (file)
@@ -556,9 +556,9 @@ fn check_str_addition(
         let rm_borrow_msg = "remove the borrow to obtain an owned `String`";
         let to_owned_msg = "create an owned `String` from a string reference";
 
+        let string_type = self.tcx.lang_items().string();
         let is_std_string = |ty: Ty<'tcx>| {
-            ty.ty_adt_def()
-                .map_or(false, |ty_def| self.tcx.is_diagnostic_item(sym::String, ty_def.did()))
+            ty.ty_adt_def().map_or(false, |ty_def| Some(ty_def.did()) == string_type)
         };
 
         match (lhs_ty.kind(), rhs_ty.kind()) {