about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src/env.rs
AgeCommit message (Collapse)AuthorLines
2025-05-10Remove `AstDeref`.Nicholas Nethercote-3/+3
It's a "utility trait to reduce boilerplate" implemented for `P` and `AstNodeWrapper`, but removing it gives a net reduction of twenty lines of code. It's also simpler to just implement `HasNodeId`/`HasAttrs`/`HasTokens` directly on types instead of via `AstDeref`. (I decided to make this change when doing some related refactoring and the error messages involving `AstDeref` and `HasAttrs` were hard to understand; removing it helped a lot.)
2025-02-08Rustfmtbjorn3-5/+5
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-10-13Fix bug where `option_env!` would return `None` when env var is present but ↵beetrees-7/+27
not valid Unicode
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-6/+6
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-04-26Adjust some `pub`s.Nicholas Nethercote-2/+2
2024-04-26Move some functions from `rustc_expand` to `rustc_builtin_macros`.Nicholas Nethercote-3/+2
These functions are only used in `rustc_builtin_macros`, so it makes sense for them to live there. This allows them to be changed from `pub` to `pub(crate)`.
2024-04-01Fix error message for `env!` when env var is not valid Unicodebeetrees-21/+30
2024-03-13delay expand macro bang when there has indeterminate pathbohan-20/+34
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-2/+2
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-02-25Remove `ast::` & `base::` prefixes from some builtin macrosLieselotte-9/+11
2024-02-25Add `ErrorGuaranteed` to `ast::ExprKind::Err`Lieselotte-17/+19
2024-01-12Rename `--env` option flag to `--env-set`Guillaume Gomez-1/+1
2023-12-24Remove `ExtCtxt` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-4/+4
2023-12-10Implement `--env` compiler flagGuillaume Gomez-2/+12
2023-11-04Use the correct span when emitting the `env!` resultThom Chiovoloni-1/+1
2023-07-25builtin_macros: raw str in diagnostic outputDavid Wood-18/+23
If a raw string was used in the `env!` invocation, then it should also be shown in the diagnostic messages as a raw string. Signed-off-by: David Wood <david@davidtw.co>
2023-07-24builtin_macros: expect raw strings tooDavid Wood-1/+1
`expr_to_string` allows raw strings through so this code should be expected to handle those. Signed-off-by: David Wood <david@davidtw.co>
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-1/+6
2023-05-11Better diagnostics for `env!` where variable contains escapeclubby789-3/+9
2023-04-10Migrate most of `rustc_builtin_macros` to diagnostic implsclubby789-18/+12
Co-authored-by: Joe ST <joe@fbstj.net> Co-authored-by: Michael Goulet <michael@errs.io>
2023-02-28Explain compile-time vs run-time difference in env!() error messageKornel-10/+30
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-2/+2
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-1/+1
This migrates everything but the `mbe` and `proc_macro` modules. It also contains a few cleanups and drive-by/accidental diagnostic improvements which can be seen in the diff for the UI tests.
2022-12-06`rustc_builtin_macros`: remove `ref` patternsMaybe Waffle-1/+1
... and other pattern matching improvements
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-2/+2
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-02-19Adopt let else in more placesest31-6/+4
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2020-08-30mv compiler to compiler/mark-0/+93