about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/builder.rs7
-rw-r--r--src/librustc_mir/interpret/machine.rs8
-rw-r--r--src/librustc_mir/interpret/memory.rs2
-rw-r--r--src/librustc_mir/transform/generator.rs5
-rw-r--r--src/librustc_typeck/check/cast.rs5
-rw-r--r--src/test/ui/issues/issue-54094.rs14
-rw-r--r--src/test/ui/repeat_count_const_in_async_fn.rs10
7 files changed, 49 insertions, 2 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index b14352d7f4b..7fc089d18f1 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1099,6 +1099,13 @@ impl<'a> Builder<'a> {
 
             if self.config.deny_warnings {
                 rustflags.arg("-Dwarnings");
+
+                // FIXME(#58633) hide "unused attribute" errors in incremental
+                // builds of the standard library, as the underlying checks are
+                // not yet properly integrated with incremental recompilation.
+                if mode == Mode::Std && compiler.stage == 0 && self.config.incremental {
+                    rustflags.arg("-Aunused-attributes");
+                }
             }
         }
 
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs
index 23e39f433f5..fd67b088c93 100644
--- a/src/librustc_mir/interpret/machine.rs
+++ b/src/librustc_mir/interpret/machine.rs
@@ -254,6 +254,14 @@ pub trait Machine<'mir, 'tcx>: Sized {
         kind: Option<MemoryKind<Self::MemoryKind>>,
     ) -> (Cow<'b, Allocation<Self::PointerTag, Self::AllocExtra>>, Self::PointerTag);
 
+    /// Called to notify the machine before a deallocation occurs.
+    fn before_deallocation(
+        _memory_extra: &mut Self::MemoryExtra,
+        _id: AllocId,
+    ) -> InterpResult<'tcx> {
+        Ok(())
+    }
+
     /// Return the "base" tag for the given *global* allocation: the one that is used for direct
     /// accesses to this static/const/fn allocation. If `id` is not a global allocation,
     /// this will return an unusable tag (i.e., accesses will be UB)!
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index c16c59715e4..539537e9de8 100644
--- a/src/librustc_mir/interpret/memory.rs
+++ b/src/librustc_mir/interpret/memory.rs
@@ -254,6 +254,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
             );
         }
 
+        M::before_deallocation(&mut self.extra, ptr.alloc_id)?;
+
         let (alloc_kind, mut alloc) = match self.alloc_map.remove(&ptr.alloc_id) {
             Some(alloc) => alloc,
             None => {
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs
index d25fd8ebb0c..033ba17f658 100644
--- a/src/librustc_mir/transform/generator.rs
+++ b/src/librustc_mir/transform/generator.rs
@@ -721,15 +721,18 @@ fn compute_layout<'tcx>(
         _ => bug!(),
     };
 
+    let param_env = tcx.param_env(source.def_id());
+
     for (local, decl) in body.local_decls.iter_enumerated() {
         // Ignore locals which are internal or not live
         if !live_locals.contains(local) || decl.internal {
             continue;
         }
+        let decl_ty = tcx.normalize_erasing_regions(param_env, decl.ty);
 
         // Sanity check that typeck knows about the type of locals which are
         // live across a suspension point
-        if !allowed.contains(&decl.ty) && !allowed_upvars.contains(&decl.ty) {
+        if !allowed.contains(&decl_ty) && !allowed_upvars.contains(&decl_ty) {
             span_bug!(
                 body.span,
                 "Broken MIR: generator contains type {} in MIR, \
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index 5de0184f2bb..38d0c42e158 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -536,7 +536,10 @@ impl<'a, 'tcx> CastCheck<'tcx> {
                 match self.expr_ty.kind {
                     ty::FnDef(..) => {
                         // Attempt a coercion to a fn pointer type.
-                        let f = self.expr_ty.fn_sig(fcx.tcx);
+                        let f = fcx.normalize_associated_types_in(
+                            self.expr.span,
+                            &self.expr_ty.fn_sig(fcx.tcx),
+                        );
                         let res = fcx.try_coerce(
                             self.expr,
                             self.expr_ty,
diff --git a/src/test/ui/issues/issue-54094.rs b/src/test/ui/issues/issue-54094.rs
new file mode 100644
index 00000000000..ec38dc40e61
--- /dev/null
+++ b/src/test/ui/issues/issue-54094.rs
@@ -0,0 +1,14 @@
+// check-pass
+trait Zoo {
+    type X;
+}
+
+impl Zoo for u16 {
+    type X = usize;
+}
+
+fn foo(abc: <u16 as Zoo>::X) {}
+
+fn main() {
+    let x: *const u8 = foo as _;
+}
diff --git a/src/test/ui/repeat_count_const_in_async_fn.rs b/src/test/ui/repeat_count_const_in_async_fn.rs
new file mode 100644
index 00000000000..ebabc3fbf10
--- /dev/null
+++ b/src/test/ui/repeat_count_const_in_async_fn.rs
@@ -0,0 +1,10 @@
+// check-pass
+// edition:2018
+// compile-flags: --crate-type=lib
+
+pub async fn test() {
+    const C: usize = 4;
+    foo(&mut [0u8; C]).await;
+}
+
+async fn foo(_: &mut [u8]) {}