about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/move_errors.rs9
-rw-r--r--compiler/rustc_hir_analysis/src/check_unused.rs2
-rw-r--r--compiler/rustc_middle/src/query/mod.rs3
-rw-r--r--compiler/rustc_middle/src/ty/context.rs2
-rw-r--r--compiler/rustc_target/src/spec/base/avr.rs67
5 files changed, 73 insertions, 10 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
index 92ca868eb99..447bf7d091a 100644
--- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
@@ -303,10 +303,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
     }
 
     fn has_ambiguous_copy(&mut self, ty: Ty<'tcx>) -> bool {
-        let Some(copy_trait_def) = self.infcx.tcx.lang_items().copy_trait() else { return false };
-        // This is only going to be ambiguous if there are incoherent impls, because otherwise
-        // ambiguity should never happen in MIR.
-        self.infcx.type_implements_trait(copy_trait_def, [ty], self.infcx.param_env).may_apply()
+        let Some(copy_def_id) = self.infcx.tcx.lang_items().copy_trait() else { return false };
+
+        // Avoid bogus move errors because of an incoherent `Copy` impl.
+        self.infcx.type_implements_trait(copy_def_id, [ty], self.infcx.param_env).may_apply()
+            && self.infcx.tcx.coherent_trait(copy_def_id).is_err()
     }
 
     fn report_cannot_move_from_static(&mut self, place: Place<'tcx>, span: Span) -> Diag<'infcx> {
diff --git a/compiler/rustc_hir_analysis/src/check_unused.rs b/compiler/rustc_hir_analysis/src/check_unused.rs
index 0133b1e8fcd..3fb33c741c9 100644
--- a/compiler/rustc_hir_analysis/src/check_unused.rs
+++ b/compiler/rustc_hir_analysis/src/check_unused.rs
@@ -18,7 +18,7 @@ pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
         used_trait_imports.extend_unord(imports.items().copied());
     }
 
-    for &id in tcx.maybe_unused_trait_imports(()) {
+    for &id in tcx.resolutions(()).maybe_unused_trait_imports.iter() {
         debug_assert_eq!(tcx.def_kind(id), DefKind::Use);
         if tcx.visibility(id).is_public() {
             continue;
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index ae8c8259be4..ad7f4973e23 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -2285,9 +2285,6 @@ rustc_queries! {
     query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>> {
         desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) }
     }
-    query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet<LocalDefId> {
-        desc { "fetching potentially unused trait imports" }
-    }
 
     /// All available crates in the graph, including those that should not be user-facing
     /// (such as private crates).
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 7e6bcfee025..51db92ecd78 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -3428,8 +3428,6 @@ pub struct DeducedParamAttrs {
 }
 
 pub fn provide(providers: &mut Providers) {
-    providers.maybe_unused_trait_imports =
-        |tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports;
     providers.extern_mod_stmt_cnum =
         |tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
     providers.is_panic_runtime =
diff --git a/compiler/rustc_target/src/spec/base/avr.rs b/compiler/rustc_target/src/spec/base/avr.rs
index 85b73e61e52..fb3ebb509ad 100644
--- a/compiler/rustc_target/src/spec/base/avr.rs
+++ b/compiler/rustc_target/src/spec/base/avr.rs
@@ -322,6 +322,9 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 {
         "attiny1624" => elf::EF_AVR_ARCH_XMEGA3,
         "attiny1626" => elf::EF_AVR_ARCH_XMEGA3,
         "attiny1627" => elf::EF_AVR_ARCH_XMEGA3,
+        "attiny3224" => elf::EF_AVR_ARCH_XMEGA3,
+        "attiny3226" => elf::EF_AVR_ARCH_XMEGA3,
+        "attiny3227" => elf::EF_AVR_ARCH_XMEGA3,
         "atmega808" => elf::EF_AVR_ARCH_XMEGA3,
         "atmega809" => elf::EF_AVR_ARCH_XMEGA3,
         "atmega1608" => elf::EF_AVR_ARCH_XMEGA3,
@@ -331,6 +334,70 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 {
         "atmega4808" => elf::EF_AVR_ARCH_XMEGA3,
         "atmega4809" => elf::EF_AVR_ARCH_XMEGA3,
 
+        "avr64da28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64da32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64da48" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64da64" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64db28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64db32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64db48" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64db64" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64dd14" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64dd20" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64dd28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64dd32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64du28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64du32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64ea28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64ea32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64ea48" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64sd28" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64sd32" => elf::EF_AVR_ARCH_XMEGA2,
+        "avr64sd48" => elf::EF_AVR_ARCH_XMEGA2,
+
+        "avr16dd20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16dd28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16dd32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16du14" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16du20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16du28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16du32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32da28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32da32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32da48" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32db28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32db32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32db48" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32dd14" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32dd20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32dd28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32dd32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32du14" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32du20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32du28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32du32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16eb14" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16eb20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16eb28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16eb32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16ea28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16ea32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr16ea48" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32ea28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32ea32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32ea48" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32sd20" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32sd28" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr32sd32" => elf::EF_AVR_ARCH_XMEGA3,
+        "avr128da28" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128da32" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128da48" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128da64" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128db28" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128db32" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128db48" => elf::EF_AVR_ARCH_XMEGA4,
+        "avr128db64" => elf::EF_AVR_ARCH_XMEGA4,
+
         // Unknown target CPU => Unspecified/generic code
         _ => 0,
     }