Rollup merge of #83437 - Amanieu:asm_syntax, r=petrochenkov

Refactor #82270 as lint instead of an error

This PR fixes several issues with #82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly:
- It is now a warn-by-default lint instead of an error.
- The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86.
- The lint no longer provides machine-applicable suggestions for two reasons:
	- These changes should not be made automatically since changes to assembly code can be very subtle.
	- The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc.

cc ``@asquared31415``
This commit is contained in:
Dylan DPC 2021-03-26 02:34:39 +01:00 committed by GitHub
commit 02b27cd79e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 179 additions and 118 deletions

View file

@ -793,13 +793,6 @@ impl Session {
}
}
pub fn inline_asm_dialect(&self) -> rustc_ast::LlvmAsmDialect {
match self.asm_arch {
Some(InlineAsmArch::X86 | InlineAsmArch::X86_64) => rustc_ast::LlvmAsmDialect::Intel,
_ => rustc_ast::LlvmAsmDialect::Att,
}
}
pub fn relocation_model(&self) -> RelocModel {
self.opts.cg.relocation_model.unwrap_or(self.target.relocation_model)
}