X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fop.rs;h=adc7a21f265a82be3cec68264b95a88ee6c42ef2;hb=a673364c543986789cfbb844c925063519fb872a;hp=38b3dd218a9719b4b28fcc41ff354c66bb50c42b;hpb=8f2c1f846945c24aeaf773c9b3c76ddae98db36c;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index 38b3dd218a9..adc7a21f265 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -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()) {