From 9f68b998db87e030c5a9a96fdb99f3dcd8911932 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Sun, 29 May 2022 15:22:25 +0200 Subject: [PATCH 01/10] 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 eefb2c2358f..b8d6b340b14 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 { From 6b4191f5e03db60f7cae7d892af368ce498412c6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:38:52 +0200 Subject: [PATCH 02/10] Add "no-const-assign" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 997def1657f..651aacec513 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -63,5 +63,6 @@ module.exports = { } ], "eqeqeq": "error", + "no-const-assign": "error", } }; From 4bb728da799f9d2332d14a3790637366bb269d5a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:39:44 +0200 Subject: [PATCH 03/10] Add "no-debugger" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 651aacec513..7d7affded7e 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -64,5 +64,6 @@ module.exports = { ], "eqeqeq": "error", "no-const-assign": "error", + "no-debugger": "error", } }; From 9f79a03ca507e2aa319f3dd9c9dac6faa568bc22 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:40:16 +0200 Subject: [PATCH 04/10] Add "no-dup-args" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 7d7affded7e..b83c1a2459a 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -65,5 +65,6 @@ module.exports = { "eqeqeq": "error", "no-const-assign": "error", "no-debugger": "error", + "no-dupe-args": "error", } }; From 397ad826b07576c5ce928bc63065a5758db12d54 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:41:05 +0200 Subject: [PATCH 05/10] Add "no-dupe-else-if" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index b83c1a2459a..35a1a27db91 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -66,5 +66,6 @@ module.exports = { "no-const-assign": "error", "no-debugger": "error", "no-dupe-args": "error", + "no-dupe-else-if": "error", } }; From 88c3d707a6e7869d2a80dbcdc923a535f095641f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:42:11 +0200 Subject: [PATCH 06/10] Add "no-dupe-keys" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 35a1a27db91..f98a6c01fe9 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -67,5 +67,6 @@ module.exports = { "no-debugger": "error", "no-dupe-args": "error", "no-dupe-else-if": "error", + "no-dupe-keys": "error", } }; From d39703a6c53a78d477360a15ffd36921449fee93 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:43:37 +0200 Subject: [PATCH 07/10] Add "no-duplicate-case" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index f98a6c01fe9..f153c9a714f 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -68,5 +68,6 @@ module.exports = { "no-dupe-args": "error", "no-dupe-else-if": "error", "no-dupe-keys": "error", + "no-duplicate-case": "error", } }; From f1a95b834c2d852428e72bf1a17ff99c2cfe605b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 May 2022 21:44:10 +0200 Subject: [PATCH 08/10] Add "no-ex-assign" eslint rule --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index f153c9a714f..f66ecbf78af 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -69,5 +69,6 @@ module.exports = { "no-dupe-else-if": "error", "no-dupe-keys": "error", "no-duplicate-case": "error", + "no-ex-assign": "error", } }; From 46d34cc9225fd11810d143ba3c78476bfe30e63d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 28 May 2022 13:34:54 -0700 Subject: [PATCH 09/10] Use type_is_copy_modulo_regions check in intrisicck --- compiler/rustc_typeck/src/check/intrinsicck.rs | 3 ++- src/test/ui/asm/issue-97490.rs | 12 ++++++++++++ 2 files changed, 14 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 027868be8bb..05a30d76d4e 100644 --- a/compiler/rustc_typeck/src/check/intrinsicck.rs +++ b/compiler/rustc_typeck/src/check/intrinsicck.rs @@ -9,6 +9,7 @@ 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 @@ fn check_asm_operand_type( // 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 00000000000..37862cf349c --- /dev/null +++ b/src/test/ui/asm/issue-97490.rs @@ -0,0 +1,12 @@ +// check-pass +// only-x86_64 +// needs-asm-support + +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 311aacf0d0bcdbb9874d83e1f8fe0fb76aeecb96 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 29 May 2022 23:30:54 +0200 Subject: [PATCH 10/10] Remove unused lifetimes from expand_macro The function doesn't need the lifetimes of the two arguments be bound together. --- compiler/rustc_expand/src/mbe/macro_rules.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index b16fa7111c5..b86304ba6b1 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -204,7 +204,7 @@ fn trace_macros_note(cx_expansions: &mut FxHashMap>, sp: Span, /// Expands the rules based macro defined by `lhses` and `rhses` for a given /// input `arg`. -fn expand_macro<'cx, 'tt>( +fn expand_macro<'cx>( cx: &'cx mut ExtCtxt<'_>, sp: Span, def_span: Span, @@ -212,8 +212,8 @@ fn expand_macro<'cx, 'tt>( name: Ident, transparency: Transparency, arg: TokenStream, - lhses: &'tt [Vec], - rhses: &'tt [mbe::TokenTree], + lhses: &[Vec], + rhses: &[mbe::TokenTree], ) -> Box { let sess = &cx.sess.parse_sess; // Macros defined in the current crate have a real node id,