From fc297306ee6ca4cb097ba766bdf0dfc7295d10bf Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 28 May 2022 13:34:54 -0700 Subject: [PATCH 1/3] Use type_is_copy_modulo_regions check in intrisicck --- compiler/rustc_typeck/src/check/intrinsicck.rs | 3 ++- src/test/ui/asm/issue-97490.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/asm/issue-97490.rs diff --git a/compiler/rustc_typeck/src/check/intrinsicck.rs b/compiler/rustc_typeck/src/check/intrinsicck.rs index 027868be8bb0d..05a30d76d4e29 100644 --- a/compiler/rustc_typeck/src/check/intrinsicck.rs +++ b/compiler/rustc_typeck/src/check/intrinsicck.rs @@ -9,6 +9,7 @@ use rustc_session::lint; use rustc_span::{Span, Symbol, DUMMY_SP}; use rustc_target::abi::{Pointer, VariantIdx}; use rustc_target::asm::{InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType}; +use rustc_trait_selection::infer::InferCtxtExt; use super::FnCtxt; @@ -210,7 +211,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Check that the type implements Copy. The only case where this can // possibly fail is for SIMD types which don't #[derive(Copy)]. - if !ty.is_copy_modulo_regions(self.tcx.at(DUMMY_SP), self.param_env) { + if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty, DUMMY_SP) { let msg = "arguments for inline assembly must be copyable"; let mut err = self.tcx.sess.struct_span_err(expr.span, msg); err.note(&format!("`{ty}` does not implement the Copy trait")); diff --git a/src/test/ui/asm/issue-97490.rs b/src/test/ui/asm/issue-97490.rs new file mode 100644 index 0000000000000..4a17b58ed5a2c --- /dev/null +++ b/src/test/ui/asm/issue-97490.rs @@ -0,0 +1,10 @@ +// check-pass + +pub type Yes = extern "sysv64" fn(&'static u8) -> !; + +fn main() { + unsafe { + let yes = &6 as *const _ as *const Yes; + core::arch::asm!("call {}", in(reg) yes, options(noreturn)); + } +} From f344d569b4b7bfea91813ff3e8c1b405c6bf4945 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 29 May 2022 13:14:59 +0400 Subject: [PATCH 2/3] Fix typo (panick -> panic) --- library/std/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/error.rs b/library/std/src/error.rs index c2d30616019c7..87f213b160830 100644 --- a/library/std/src/error.rs +++ b/library/std/src/error.rs @@ -52,7 +52,7 @@ //! to convey your intent and assumptions which makes tracking down the source //! of a panic easier. `unwrap` on the other hand can still be a good fit in //! situations where you can trivially show that a piece of code will never -//! panick, such as `"127.0.0.1".parse::().unwrap()` or early +//! panic, such as `"127.0.0.1".parse::().unwrap()` or early //! prototyping. //! //! # Common Message Styles From 9f68b998db87e030c5a9a96fdb99f3dcd8911932 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Sun, 29 May 2022 15:22:25 +0200 Subject: [PATCH 3/3] Fix order of closing HTML elements in rustdoc output --- src/librustdoc/html/render/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index eefb2c2358fbd..b8d6b340b14dd 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1764,7 +1764,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) { write!(buffer, "
  • Version {}
  • ", Escape(version)); } write!(buffer, "
  • All Items
  • "); - buffer.write_str(""); + buffer.write_str(""); } match *it.kind {