summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src
AgeCommit message (Collapse)AuthorLines
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-1/+1
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-11-10Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-SimulacrumJonas Schievink-1/+1
rustc_target: Further cleanup use of target options Follow up to https://github.com/rust-lang/rust/pull/77729. Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243. The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-1/+1
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-1/+1
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-12/+0
2020-10-21Unconditionally capture tokens for attributes.Aaron Hill-1/+1
This allows us to avoid synthesizing tokens in `prepend_attr`, since we have the original tokens available. We still need to synthesize tokens when expanding `cfg_attr`, but this is an unavoidable consequence of the syntax of `cfg_attr` - the user does not supply the `#` and `[]` tokens that a `cfg_attr` expands to.
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-1/+1
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-13Rollup merge of #77831 - LingMan:use_std, r=jonas-schievinkYuki Okushi-23/+10
Use std methods on char instead of open coding them
2020-10-11Simplify using is_ascii_alphabetic and is_ascii_alphanumericLingMan-8/+2
2020-10-11Don't duplicate char::is_ascii_digitLingMan-15/+8
2020-10-11Remove unnecessary unsafe block around calls to discriminant_valueTomasz Miąsko-15/+16
Since 63793 the discriminant_value intrinsic is safe to call. Remove unnecessary unsafe block around calls to this intrinsic in built-in derive macros.
2020-10-07Auto merge of #77595 - petrochenkov:asmident, r=oli-obkbors-19/+19
builtin_macros: Fix use of interpolated identifiers in `asm!` Fixes https://github.com/rust-lang/rust/issues/77584
2020-10-06rustc_parse: Make `Parser::unexpected` public and use it in built-in macrosVadim Petrochenkov-4/+3
2020-10-06builtin_macros: Fix use of interpolated identifiers in `asm!`Vadim Petrochenkov-16/+17
2020-10-04Remove extra indirection in LitKind::ByteStrRobin Schoonover-3/+1
2020-09-28expand: Stop un-interpolating `NtIdent`s before passing them to built-in macrosVadim Petrochenkov-8/+8
This was a big hack, and built-in macros should be able to deal with `NtIdents` in the input by themselves like any other parser code.
2020-09-26Auto merge of #76485 - estebank:format_arg_capture_spans, r=davidtwcobors-3/+6
Point at named argument not found when using `format_args_capture` instead of whole format string
2020-09-25Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514Jonas Schievink-1/+1
Updated html_root_url for compiler crates Closes #77103 r? @jyn514
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-23Merge two almost identical match armsLingMan-2/+1
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-1/+1
2020-09-10Attach tokens to `ast::Stmt`Aaron Hill-1/+1
We currently only attach tokens when parsing a `:stmt` matcher for a `macro_rules!` macro. Proc-macro attributes on statements are still unstable, and need additional work.
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-14/+26
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach tokens to `NtMeta` (`ast::AttrItem`)Aaron Hill-1/+1
An `AttrItem` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Ty`Aaron Hill-0/+1
A `Ty` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Block`Aaron Hill-0/+1
A `Block` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10use push(char) instead of push_str(&str) to add single chars to stringsMatthias Krüger-6/+6
clippy::single-char-push-str
2020-09-08Point at named argument not found when using `format_args_capture` instead ↵Esteban Küber-3/+6
of whole format string
2020-09-02Improve recovery on malformed format callSasha-8/+20
If a comma in a format call is replaced with a similar token, then we emit an error and continue parsing, instead of stopping at this point.
2020-08-30Use string literal directly when available in formatSasha-1/+20
Previous implementation used the `Parser::parse_expr` function in order to extract the format expression. If the first comma following the format expression was mistakenly replaced with a dot, then the next format expression was eaten by the function, because it looked as a syntactically valid expression, which resulted in incorrectly spanned error messages. The way the format expression is exctracted is changed: we first look at the first available token in the first argument supplied to the `format!` macro call. If it is a string literal, then it is promoted as a format expression immediatly, otherwise we fall back to the original `parse_expr`-related method. This allows us to ensure that the parser won't consume too much tokens when a typo is made. A test has been created so that it is ensured that the issue is properly fixed.
2020-08-30mv compiler to compiler/mark-0/+9614