about summary refs log tree commit diff
path: root/src/librustc_builtin_macros/asm.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-632/+0
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-1/+1
2020-06-20Run `./x.py fmt`Camelid-4/+1
2020-06-20Fix duplicate options errorCamelid-9/+12
The UI isn't glitching anymore.
2020-06-20Use `p.token` instead of `p.look_ahead()`Camelid-1/+1
2020-06-20Add documentationCamelid-0/+9
2020-06-20Create a separate, tool-only suggestion for the commaCamelid-5/+9
That way the comma isn't highlighted as part of the option in the UI. Weirdly, the comma removal suggestion shows up in the UI.
2020-06-20Make suggestion machine-applicableCamelid-2/+11
2020-06-20Use `span_suggestion` instead of `span_label`Camelid-1/+1
2020-06-20Use bitflags function instead of custom oneCamelid-7/+1
2020-06-20Get option name from symbol instead of snippetCamelid-17/+19
2020-06-20Use `span_label`Camelid-1/+1
2020-06-20Make warning an error; use help instead of suggestion; clean up codeCamelid-46/+21
For some reason, the help message is now in a separate message, which adds a lot of noise. I would like to try to get it back to one message.
2020-06-20Warn on duplicate `asm!` optionsCamelid-7/+58
2020-06-20Clean upCamelid-3/+3
2020-06-20Use `Vec<Span>` instead of `Option<Vec<Span>>`Camelid-13/+9
2020-06-20Allow multiple `asm!` optionsCamelid-16/+13
2020-06-15asm: Allow multiple template strings; interpret them as newline-separatedJosh Triplett-145/+182
Allow the `asm!` macro to accept a series of template arguments, and interpret them as if they were concatenated with a '\n' between them. This allows writing an `asm!` where each line of assembly appears in a separate template string argument. This syntax makes it possible for rustfmt to reliably format and indent each line of assembly, without risking changes to the inside of a template string. It also avoids the complexity of having the user carefully format and indent a multi-line string (including where to put the surrounding quotes), and avoids the extra indentation and lines of a call to `concat!`. For example, rewriting the second example from the [blog post on the new inline assembly syntax](https://blog.rust-lang.org/inside-rust/2020/06/08/new-inline-asm.html) using multiple template strings: ```rust fn main() { let mut bits = [0u8; 64]; for value in 0..=1024u64 { let popcnt; unsafe { asm!( " popcnt {popcnt}, {v}", "2:", " blsi rax, {v}", " jz 1f", " xor {v}, rax", " tzcnt rax, rax", " stosb", " jmp 2b", "1:", v = inout(reg) value => _, popcnt = out(reg) popcnt, out("rax") _, // scratch inout("rdi") bits.as_mut_ptr() => _, ); } println!("bits of {}: {:?}", value, &bits[0..popcnt]); } } ``` Note that all the template strings must appear before all other arguments; you cannot, for instance, provide a series of template strings intermixed with the corresponding operands. In order to get srcloc mappings right for macros that generate multi-line string literals, create one line_span for each line in the string literal, each pointing to the macro. Make `rustc_parse_format::Parser::curarg` `pub`, so that we can propagate it from one template string argument to the next.
2020-06-14asm: Unify pseudo-keyword parsing using `eat`, rather than a final `expect`Josh Triplett-2/+3
Currently, `asm!` parsing uses an `expect` for the last parsed pseudo-keyword (`sym`), which makes it difficult to extend without simultaneously refactoring. Use `eat` for the last pseudo-keyword, and then add an `else` that fails parsing. No change to error output.
2020-06-11Rollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkovDylan DPC-18/+29
Suggest including unused asm arguments in a comment to avoid error We require all arguments to an `asm!` to be used in the template string, just like format strings. However in some cases (e.g. `black_box`) it may be desirable to have `asm!` arguments that are not used in the template string. Currently this is a hard error rather than a lint since `#[allow]` does not work on macros (#63221), so this PR suggests using the unused arguments in an asm comment as a workaround. r? @petrochenkov
2020-06-11Add a suggestion to use unused asm arguments in commentsAmanieu d'Antras-18/+29
2020-06-09Fix more clippy warningsMatthias Krüger-1/+1
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-06-02Rename the crates in source codeVadim Petrochenkov-2/+1
2020-05-31Clarify errors and warnings about the transition to the new asm!Amanieu d'Antras-1/+4
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-2/+8
2020-05-24Collect tokens for `ast::Expr`Aaron Hill-0/+1
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-20/+21
2020-05-18Implement att_syntax optionAmanieu d'Antras-2/+4
2020-05-18Apply review feedbackAmanieu d'Antras-59/+66
2020-05-18Implement asm! in librustc_builtin_macrosAmanieu d'Antras-0/+527
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-300/+0
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-01Rollup merge of #69579 - petrochenkov:noprevspan, r=CentrilYuki Okushi-6/+6
parser: Remove `Parser::prev_span` Follow-up to https://github.com/rust-lang/rust/pull/69384. r? @Centril
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-4/+4
2020-02-29parser: `prev_span` -> `prev_token.span`Vadim Petrochenkov-6/+6
2020-02-27use char instead of &str for single char patternsMatthias Krüger-4/+4
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-2/+0
2020-01-10nix syntax::errors & prefer rustc_errors over errorsMazdak Farrokhzad-1/+1
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-10/+23
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-30Rename `libsyntax_ext` and `libsyntax_expand` in codeVadim Petrochenkov-1/+1
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-0/+289
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`