Skip to content

Commit 5fc0865

Browse files
committed
Auto merge of #3879 - rust-lang:rustup-2024-09-12, r=RalfJung
Automatic Rustup
2 parents 59835ae + 93ef7cd commit 5fc0865

File tree

153 files changed

+1904
-2048
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+1904
-2048
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,11 +2418,22 @@ impl InlineAsmOperand {
24182418
}
24192419
}
24202420

2421+
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic)]
2422+
pub enum AsmMacro {
2423+
/// The `asm!` macro
2424+
Asm,
2425+
/// The `global_asm!` macro
2426+
GlobalAsm,
2427+
/// The `naked_asm!` macro
2428+
NakedAsm,
2429+
}
2430+
24212431
/// Inline assembly.
24222432
///
24232433
/// E.g., `asm!("NOP");`.
24242434
#[derive(Clone, Encodable, Decodable, Debug)]
24252435
pub struct InlineAsm {
2436+
pub asm_macro: AsmMacro,
24262437
pub template: Vec<InlineAsmTemplatePiece>,
24272438
pub template_strs: Box<[(Symbol, Option<Symbol>, Span)]>,
24282439
pub operands: Vec<(InlineAsmOperand, Span)>,

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl HasTokens for StmtKind {
153153
StmtKind::Let(local) => local.tokens.as_ref(),
154154
StmtKind::Item(item) => item.tokens(),
155155
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens(),
156-
StmtKind::Empty => return None,
156+
StmtKind::Empty => None,
157157
StmtKind::MacCall(mac) => mac.tokens.as_ref(),
158158
}
159159
}
@@ -162,7 +162,7 @@ impl HasTokens for StmtKind {
162162
StmtKind::Let(local) => Some(&mut local.tokens),
163163
StmtKind::Item(item) => item.tokens_mut(),
164164
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens_mut(),
165-
StmtKind::Empty => return None,
165+
StmtKind::Empty => None,
166166
StmtKind::MacCall(mac) => Some(&mut mac.tokens),
167167
}
168168
}

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,7 @@ fn walk_anon_const<T: MutVisitor>(vis: &mut T, AnonConst { id, value }: &mut Ano
13881388
fn walk_inline_asm<T: MutVisitor>(vis: &mut T, asm: &mut InlineAsm) {
13891389
// FIXME: Visit spans inside all this currently ignored stuff.
13901390
let InlineAsm {
1391+
asm_macro: _,
13911392
template: _,
13921393
template_strs: _,
13931394
operands,

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ pub fn walk_anon_const<'a, V: Visitor<'a>>(visitor: &mut V, constant: &'a AnonCo
976976

977977
pub fn walk_inline_asm<'a, V: Visitor<'a>>(visitor: &mut V, asm: &'a InlineAsm) -> V::Result {
978978
let InlineAsm {
979+
asm_macro: _,
979980
template: _,
980981
template_strs: _,
981982
operands,

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
474474
);
475475
let line_spans =
476476
self.arena.alloc_from_iter(asm.line_spans.iter().map(|span| self.lower_span(*span)));
477-
let hir_asm =
478-
hir::InlineAsm { template, template_strs, operands, options: asm.options, line_spans };
477+
let hir_asm = hir::InlineAsm {
478+
asm_macro: asm.asm_macro,
479+
template,
480+
template_strs,
481+
operands,
482+
options: asm.options,
483+
line_spans,
484+
};
479485
self.arena.alloc(hir_asm)
480486
}
481487
}

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18371837
Safety::Default,
18381838
sym::allow,
18391839
sym::unreachable_code,
1840-
self.lower_span(span),
1840+
try_span,
18411841
);
18421842
let attrs: AttrVec = thin_vec![attr];
18431843

compiler/rustc_attr/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,5 +1240,5 @@ pub fn parse_confusables(attr: &Attribute) -> Option<Vec<Symbol>> {
12401240
candidates.push(meta_lit.symbol);
12411241
}
12421242

1243-
return Some(candidates);
1243+
Some(candidates)
12441244
}

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3669,7 +3669,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
36693669
reinits.push(location);
36703670
return true;
36713671
}
3672-
return false;
3672+
false
36733673
};
36743674

36753675
while let Some(location) = stack.pop() {

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
214214
let delegate = FnMutDelegate {
215215
regions: &mut |br: ty::BoundRegion| {
216216
if let Some(ex_reg_var) = reg_map.get(&br) {
217-
return *ex_reg_var;
217+
*ex_reg_var
218218
} else {
219219
let ex_reg_var = self.next_existential_region_var(true, br.kind.get_name());
220220
debug!(?ex_reg_var);

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use lint::BuiltinLintDiag;
33
use rustc_ast::ptr::P;
44
use rustc_ast::token::{self, Delimiter};
55
use rustc_ast::tokenstream::TokenStream;
6+
use rustc_ast::AsmMacro;
67
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
78
use rustc_errors::PResult;
89
use rustc_expand::base::*;
@@ -484,6 +485,7 @@ fn parse_reg<'a>(
484485

485486
fn expand_preparsed_asm(
486487
ecx: &mut ExtCtxt<'_>,
488+
asm_macro: ast::AsmMacro,
487489
args: AsmArgs,
488490
) -> ExpandResult<Result<ast::InlineAsm, ErrorGuaranteed>, ()> {
489491
let mut template = vec![];
@@ -774,6 +776,7 @@ fn expand_preparsed_asm(
774776
}
775777

776778
ExpandResult::Ready(Ok(ast::InlineAsm {
779+
asm_macro,
777780
template,
778781
template_strs: template_strs.into_boxed_slice(),
779782
operands: args.operands,
@@ -790,7 +793,7 @@ pub(super) fn expand_asm<'cx>(
790793
) -> MacroExpanderResult<'cx> {
791794
ExpandResult::Ready(match parse_args(ecx, sp, tts, false) {
792795
Ok(args) => {
793-
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, args) else {
796+
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, AsmMacro::Asm, args) else {
794797
return ExpandResult::Retry(());
795798
};
796799
let expr = match mac {
@@ -819,7 +822,8 @@ pub(super) fn expand_naked_asm<'cx>(
819822
) -> MacroExpanderResult<'cx> {
820823
ExpandResult::Ready(match parse_args(ecx, sp, tts, false) {
821824
Ok(args) => {
822-
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, args) else {
825+
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, AsmMacro::NakedAsm, args)
826+
else {
823827
return ExpandResult::Retry(());
824828
};
825829
let expr = match mac {
@@ -857,7 +861,8 @@ pub(super) fn expand_global_asm<'cx>(
857861
) -> MacroExpanderResult<'cx> {
858862
ExpandResult::Ready(match parse_args(ecx, sp, tts, true) {
859863
Ok(args) => {
860-
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, args) else {
864+
let ExpandResult::Ready(mac) = expand_preparsed_asm(ecx, AsmMacro::GlobalAsm, args)
865+
else {
861866
return ExpandResult::Retry(());
862867
};
863868
match mac {

0 commit comments

Comments
 (0)