about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-27 05:36:08 +0200
committerGitHub <noreply@github.com>2022-03-27 05:36:08 +0200
commitc6bb219fc4e70365273c8f8cb96fdff2e910bd38 (patch)
tree0d7cd4d7c4f8006d2b2cf23b3b46109862c73fb1 /compiler
parent4435bb07043df567c3ecd12ebd20adbd5d9c9b2f (diff)
parent9072c8d274307c08ad0a7afb16681d43181c4033 (diff)
downloadrust-c6bb219fc4e70365273c8f8cb96fdff2e910bd38.tar.gz
rust-c6bb219fc4e70365273c8f8cb96fdff2e910bd38.zip
Rollup merge of #93469 - compiler-errors:issue-93450, r=estebank
Skip pointing out ambiguous impls in alloc/std crates too in inference errors

This generalizes the logic in `annotate_source_of_ambiguity` to skip printing ambiguity errors traits in `alloc` and `std` as well, not just `core`.

While this does spot-fix the issue mentioned below, it would be nicer to generalize this logic, for example to detect when the trait predicate's `self_ty` has any numerical inference variables. Is it worthwhile to scrap this solution for one like that?

Fixes #93450

r? `@estebank`
feel free to reassign
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 1303155ce54..468c7a3c55b 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -1954,7 +1954,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
 
         if self.is_tainted_by_errors()
             && crate_names.len() == 1
-            && crate_names[0] == "`core`"
+            && ["`core`", "`alloc`", "`std`"].contains(&crate_names[0].as_str())
             && spans.len() == 0
         {
             // Avoid complaining about other inference issues for expressions like