Rollup merge of #111027 - clubby789:query-instability-builtin-macros, r=petrochenkov

Remove `allow(rustc::potential_query_instability)` for `builtin_macros`

cc #84447
This commit is contained in:
Matthias Krüger 2023-05-04 08:09:05 +02:00 committed by GitHub
commit 6387eda3ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View File

@ -3165,6 +3165,7 @@ dependencies = [
"rustc_expand", "rustc_expand",
"rustc_feature", "rustc_feature",
"rustc_fluent_macro", "rustc_fluent_macro",
"rustc_index",
"rustc_lexer", "rustc_lexer",
"rustc_lint_defs", "rustc_lint_defs",
"rustc_macros", "rustc_macros",

View File

@ -14,6 +14,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" } rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" } rustc_expand = { path = "../rustc_expand" }
rustc_feature = { path = "../rustc_feature" } rustc_feature = { path = "../rustc_feature" }
rustc_index = { path = "../rustc_index" }
rustc_lexer = { path = "../rustc_lexer" } rustc_lexer = { path = "../rustc_lexer" }
rustc_lint_defs = { path = "../rustc_lint_defs" } rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" } rustc_macros = { path = "../rustc_macros" }

View File

@ -2,9 +2,10 @@ use rustc_ast as ast;
use rustc_ast::ptr::P; use rustc_ast::ptr::P;
use rustc_ast::token::{self, Delimiter}; use rustc_ast::token::{self, Delimiter};
use rustc_ast::tokenstream::TokenStream; use rustc_ast::tokenstream::TokenStream;
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_errors::PResult; use rustc_errors::PResult;
use rustc_expand::base::{self, *}; use rustc_expand::base::{self, *};
use rustc_index::bit_set::GrowableBitSet;
use rustc_parse::parser::Parser; use rustc_parse::parser::Parser;
use rustc_parse_format as parse; use rustc_parse_format as parse;
use rustc_session::lint; use rustc_session::lint;
@ -20,8 +21,8 @@ use crate::errors;
pub struct AsmArgs { pub struct AsmArgs {
pub templates: Vec<P<ast::Expr>>, pub templates: Vec<P<ast::Expr>>,
pub operands: Vec<(ast::InlineAsmOperand, Span)>, pub operands: Vec<(ast::InlineAsmOperand, Span)>,
named_args: FxHashMap<Symbol, usize>, named_args: FxIndexMap<Symbol, usize>,
reg_args: FxHashSet<usize>, reg_args: GrowableBitSet<usize>,
pub clobber_abis: Vec<(Symbol, Span)>, pub clobber_abis: Vec<(Symbol, Span)>,
options: ast::InlineAsmOptions, options: ast::InlineAsmOptions,
pub options_spans: Vec<Span>, pub options_spans: Vec<Span>,
@ -56,8 +57,8 @@ pub fn parse_asm_args<'a>(
let mut args = AsmArgs { let mut args = AsmArgs {
templates: vec![first_template], templates: vec![first_template],
operands: vec![], operands: vec![],
named_args: FxHashMap::default(), named_args: Default::default(),
reg_args: FxHashSet::default(), reg_args: Default::default(),
clobber_abis: Vec::new(), clobber_abis: Vec::new(),
options: ast::InlineAsmOptions::empty(), options: ast::InlineAsmOptions::empty(),
options_spans: vec![], options_spans: vec![],
@ -213,7 +214,7 @@ pub fn parse_asm_args<'a>(
} else { } else {
if !args.named_args.is_empty() || !args.reg_args.is_empty() { if !args.named_args.is_empty() || !args.reg_args.is_empty() {
let named = args.named_args.values().map(|p| args.operands[*p].1).collect(); let named = args.named_args.values().map(|p| args.operands[*p].1).collect();
let explicit = args.reg_args.iter().map(|p| args.operands[*p].1).collect(); let explicit = args.reg_args.iter().map(|p| args.operands[p].1).collect();
diag.emit_err(errors::AsmPositionalAfter { span, named, explicit }); diag.emit_err(errors::AsmPositionalAfter { span, named, explicit });
} }
@ -446,8 +447,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
// Register operands are implicitly used since they are not allowed to be // Register operands are implicitly used since they are not allowed to be
// referenced in the template string. // referenced in the template string.
let mut used = vec![false; args.operands.len()]; let mut used = vec![false; args.operands.len()];
for pos in &args.reg_args { for pos in args.reg_args.iter() {
used[*pos] = true; used[pos] = true;
} }
let named_pos: FxHashMap<usize, Symbol> = let named_pos: FxHashMap<usize, Symbol> =
args.named_args.iter().map(|(&sym, &idx)| (idx, sym)).collect(); args.named_args.iter().map(|(&sym, &idx)| (idx, sym)).collect();
@ -581,7 +582,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
parse::ArgumentIs(idx) | parse::ArgumentImplicitlyIs(idx) => { parse::ArgumentIs(idx) | parse::ArgumentImplicitlyIs(idx) => {
if idx >= args.operands.len() if idx >= args.operands.len()
|| named_pos.contains_key(&idx) || named_pos.contains_key(&idx)
|| args.reg_args.contains(&idx) || args.reg_args.contains(idx)
{ {
let msg = format!("invalid reference to argument at index {}", idx); let msg = format!("invalid reference to argument at index {}", idx);
let mut err = ecx.struct_span_err(span, &msg); let mut err = ecx.struct_span_err(span, &msg);
@ -608,7 +609,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
args.operands[idx].1, args.operands[idx].1,
"named arguments cannot be referenced by position", "named arguments cannot be referenced by position",
); );
} else if args.reg_args.contains(&idx) { } else if args.reg_args.contains(idx) {
err.span_label( err.span_label(
args.operands[idx].1, args.operands[idx].1,
"explicit register argument", "explicit register argument",

View File

@ -1,7 +1,6 @@
//! This crate contains implementations of built-in macros and other code generating facilities //! This crate contains implementations of built-in macros and other code generating facilities
//! injecting code into the crate before it is lowered to HIR. //! injecting code into the crate before it is lowered to HIR.
#![allow(rustc::potential_query_instability)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_windows)] #![feature(array_windows)]
#![feature(box_patterns)] #![feature(box_patterns)]