about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/base.rs
AgeCommit message (Collapse)AuthorLines
2023-03-23Separate find_*_stability.Camille GILLOT-1/+3
2023-03-23rustc_interface: Add a new query `pre_configure`Vadim Petrochenkov-0/+2
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-6/+4
2023-03-06Querify registered_tools.Camille GILLOT-4/+4
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-3/+4
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-20create dummy placeholder crate to prevent compilerPatrik Kårlin-0/+5
2023-02-05rustc_expand: remove huge error importsest31-23/+25
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-3/+3
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-17`rustc_expand`: remove `ref` patternsMaybe Waffle-15/+15
2023-01-13Update `rental` hack to work with remapped paths.Tim Neumann-4/+6
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-1/+1
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-11Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-deadMatthias Krüger-1/+0
compiler: remove unnecessary imports and qualified paths Some of these imports were necessary before Edition 2021, others were already in the prelude. I hope it's fine that this PR is so spread-out across files :/
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-51/+39
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-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-1/+1
2022-12-02Add `StrStyle` to `ast::LitKind::ByteStr`.Nicholas Nethercote-1/+1
This is required to distinguish between cooked and raw byte string literals in an `ast::LitKind`, without referring to an adjacent `token::Lit`. It's a prerequisite for the next commit.
2022-12-01Rollup merge of #105078 - TaKO8Ki:fix-105011, r=nnethercoteMatthias Krüger-1/+5
Fix `expr_to_spanned_string` ICE Fixes #105011
2022-11-30report literal errors when `token_lit` has errorsTakayuki Maeda-1/+5
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-11-25Clarify `SyntaxExtensionKind::LegacyDerive`.Nicholas Nethercote-1/+6
2022-11-22Rollup merge of #104416 - clubby789:fix-104414, r=eholkMatthias Krüger-1/+1
Fix using `include_bytes` in pattern position Fix #104414
2022-11-18couple of clippy::perf fixesMatthias Krüger-1/+1
2022-11-16Use `token::Lit` in `ast::ExprKind::Lit`.Nicholas Nethercote-6/+7
Instead of `ast::Lit`. Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing. This commit changes the language very slightly. Some programs that used to not compile now will compile. This is because some invalid literals that are removed by `cfg` or attribute macros will no longer trigger errors. See this comment for more details: https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-14Fix using `include_bytes` in pattern positionclubby789-1/+1
2022-11-12Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obkDylan DPC-1/+3
Add the `#[derive_const]` attribute Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? `````@oli-obk`````
2022-10-21Only apply `ProceduralMasquerade` hack to older versions of `rental`Aaron Hill-11/+35
The latest version of `rental` (v0.5.6) contains a fix that allows it to compile without relying on the pretty-print back-compat hack. Hopefully, there are no longer any crates relying on the affected versions of the (much less popular) `procedural-masquerade` crate. This should allow us to target the pretty-print back-compat hack specifically to older versions of `rental`, and specifically mention upgrading to `rental` v0.5.6 in the lint message.
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-2/+3
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-3/+3
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-2/+4
2022-09-20Add the `#[derive_const]` attributeDeadbeef-1/+3
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-16/+23
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-23Remove the symbol from `ast::LitKind::Err`.Nicholas Nethercote-1/+1
Because it's never used meaningfully.
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-2/+2
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-07-26Implement `#[rustc_default_body_unstable]`Maybe Waffle-1/+12
This attribute allows to mark default body of a trait function as unstable. This means that implementing the trait without implementing the function will require enabling unstable feature. This is useful in conjunction with `#[rustc_must_implement_one_of]`, we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way -- making implementation of only `PartialEq::ne` unstable.
2022-07-16rustc_expand: Switch FxHashMap to FxIndexMap where iteration is usedNiklas Jonsson-3/+3
2022-07-13Emit warning when named arguments are used positionally in formatPreston From-1/+4
Addresses Issue 98466 by emitting a warning if a named argument is used like a position argument (i.e. the name is not used in the string to be formatted). Fixes rust-lang#98466
2022-07-01update cfg(bootstrap)sPietro Albini-3/+3
2022-06-27various: add `rustc_lint_diagnostics` to diag fnsDavid Wood-0/+3
The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this commit adds the attribute to many more functions. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-21Add `create_err` and `emit_err` to `ExtCtxt`beetrees-1/+12
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-05-27Rename `ProcMacro` trait as `BangProcMacro`.Nicholas Nethercote-3/+3
Similar to the existing `AttrProcMacro` trait.
2022-05-22rustc_parse: Move AST -> TokenStream conversion logic to `rustc_ast`Vadim Petrochenkov-10/+8
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-0/+2
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-11ast: Introduce some traits to get AST node properties genericallyVadim Petrochenkov-24/+38
And use them to avoid constructing some artificial `Nonterminal` tokens during expansion
2022-05-05Implement the unused_macro_rules lintest31-0/+2
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-2/+39
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-04-27tut tut tutEllen-3/+1
2022-04-09Auto merge of #95697 - klensy:no-strings, r=petrochenkovbors-2/+2
refactor: simplify few string related interactions Few small optimizations: check_doc_keyword: don't alloc string for emptiness check check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. 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 FxHashSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>