Skip to content

Commit

Permalink
remove suggestion that cannot always be applied
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Sep 5, 2024
1 parent 7a0922c commit 56b14b1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
);
}

let have_labels = if asm_macro.diverges(options) {
let have_labels = if asm_macro.diverges(*options) {
!targets.is_empty()
} else {
targets.len() > 1
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,8 +1191,6 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for NakedFunctionsAsmBlock {
pub(crate) struct NakedFunctionsMustNakedAsm {
#[primary_span]
pub span: Span,
#[suggestion(code = "naked_asm!", applicability = "machine-applicable")]
pub macro_span: Span,
}

#[derive(Diagnostic)]
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_passes/src/naked_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
use rustc_span::symbol::sym;
use rustc_span::{BytePos, Span};
use rustc_span::Span;
use rustc_target::spec::abi::Abi;

use crate::errors::{
Expand Down Expand Up @@ -133,10 +133,7 @@ fn check_asm<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId, body: &'tcx hir::Body<
ItemKind::InlineAsm => {
has_err = true;

// the span that contains the `asm!` call,
// so tooling can replace it with `naked_asm!`
let macro_span = span.with_hi(span.lo() + BytePos("asm!".len() as u32));
tcx.dcx().emit_err(NakedFunctionsMustNakedAsm { span, macro_span });
tcx.dcx().emit_err(NakedFunctionsMustNakedAsm { span });
}
ItemKind::NonAsm => {
must_show_error = true;
Expand Down

0 comments on commit 56b14b1

Please sign in to comment.