Skip to content

Commit 6387eda

Browse files
authored
Rollup merge of rust-lang#111027 - clubby789:query-instability-builtin-macros, r=petrochenkov
Remove `allow(rustc::potential_query_instability)` for `builtin_macros` cc rust-lang#84447
2 parents 3ce6dd2 + e3e93f2 commit 6387eda

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -3165,6 +3165,7 @@ dependencies = [
31653165
"rustc_expand",
31663166
"rustc_feature",
31673167
"rustc_fluent_macro",
3168+
"rustc_index",
31683169
"rustc_lexer",
31693170
"rustc_lint_defs",
31703171
"rustc_macros",

compiler/rustc_builtin_macros/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1414
rustc_errors = { path = "../rustc_errors" }
1515
rustc_expand = { path = "../rustc_expand" }
1616
rustc_feature = { path = "../rustc_feature" }
17+
rustc_index = { path = "../rustc_index" }
1718
rustc_lexer = { path = "../rustc_lexer" }
1819
rustc_lint_defs = { path = "../rustc_lint_defs" }
1920
rustc_macros = { path = "../rustc_macros" }

compiler/rustc_builtin_macros/src/asm.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use rustc_ast as ast;
22
use rustc_ast::ptr::P;
33
use rustc_ast::token::{self, Delimiter};
44
use rustc_ast::tokenstream::TokenStream;
5-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
66
use rustc_errors::PResult;
77
use rustc_expand::base::{self, *};
8+
use rustc_index::bit_set::GrowableBitSet;
89
use rustc_parse::parser::Parser;
910
use rustc_parse_format as parse;
1011
use rustc_session::lint;
@@ -20,8 +21,8 @@ use crate::errors;
2021
pub struct AsmArgs {
2122
pub templates: Vec<P<ast::Expr>>,
2223
pub operands: Vec<(ast::InlineAsmOperand, Span)>,
23-
named_args: FxHashMap<Symbol, usize>,
24-
reg_args: FxHashSet<usize>,
24+
named_args: FxIndexMap<Symbol, usize>,
25+
reg_args: GrowableBitSet<usize>,
2526
pub clobber_abis: Vec<(Symbol, Span)>,
2627
options: ast::InlineAsmOptions,
2728
pub options_spans: Vec<Span>,
@@ -56,8 +57,8 @@ pub fn parse_asm_args<'a>(
5657
let mut args = AsmArgs {
5758
templates: vec![first_template],
5859
operands: vec![],
59-
named_args: FxHashMap::default(),
60-
reg_args: FxHashSet::default(),
60+
named_args: Default::default(),
61+
reg_args: Default::default(),
6162
clobber_abis: Vec::new(),
6263
options: ast::InlineAsmOptions::empty(),
6364
options_spans: vec![],
@@ -213,7 +214,7 @@ pub fn parse_asm_args<'a>(
213214
} else {
214215
if !args.named_args.is_empty() || !args.reg_args.is_empty() {
215216
let named = args.named_args.values().map(|p| args.operands[*p].1).collect();
216-
let explicit = args.reg_args.iter().map(|p| args.operands[*p].1).collect();
217+
let explicit = args.reg_args.iter().map(|p| args.operands[p].1).collect();
217218

218219
diag.emit_err(errors::AsmPositionalAfter { span, named, explicit });
219220
}
@@ -446,8 +447,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
446447
// Register operands are implicitly used since they are not allowed to be
447448
// referenced in the template string.
448449
let mut used = vec![false; args.operands.len()];
449-
for pos in &args.reg_args {
450-
used[*pos] = true;
450+
for pos in args.reg_args.iter() {
451+
used[pos] = true;
451452
}
452453
let named_pos: FxHashMap<usize, Symbol> =
453454
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
581582
parse::ArgumentIs(idx) | parse::ArgumentImplicitlyIs(idx) => {
582583
if idx >= args.operands.len()
583584
|| named_pos.contains_key(&idx)
584-
|| args.reg_args.contains(&idx)
585+
|| args.reg_args.contains(idx)
585586
{
586587
let msg = format!("invalid reference to argument at index {}", idx);
587588
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
608609
args.operands[idx].1,
609610
"named arguments cannot be referenced by position",
610611
);
611-
} else if args.reg_args.contains(&idx) {
612+
} else if args.reg_args.contains(idx) {
612613
err.span_label(
613614
args.operands[idx].1,
614615
"explicit register argument",

compiler/rustc_builtin_macros/src/lib.rs

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

0 commit comments

Comments
 (0)