about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/module.rs
AgeCommit message (Collapse)AuthorLines
2023-12-23Give `DiagnosticBuilder` a default type.Nicholas Nethercote-1/+1
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-02-21Use `ThinVec` in a few more AST types.Nicholas Nethercote-2/+2
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-46/+34
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-08-22Use `AttrVec` in more places.Nicholas Nethercote-4/+4
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-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-3/+2
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-3/+3
2022-03-03Associate multiple with a crate too.Felix S. Klock II-3/+3
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-2/+2
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-3/+3
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-3/+3
2022-02-19Adopt let else in more placesest31-17/+14
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-4/+6
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-09-25Check for macros in built-in attributes that don't support them.Eric Huss-1/+20
2021-08-25Use if-let guards in the codebaseLéo Lanteri Thauvin-6/+5
2021-05-06E0583: Include secondary path in error messageDeadbeef-4/+5
2021-05-03use full path for E0761hi-rustin-7/+5
2021-05-03use double quotes for E0761hi-rustin-1/+1
2021-03-14expand: Resolve and expand inner attributes on out-of-line modulesVadim Petrochenkov-19/+39
2021-03-05expand: Introduce enum for module loading errors and make module loading ↵Vadim Petrochenkov-87/+85
speculative
2021-03-05expand: Share some code between inline and out-of-line module treatmentVadim Petrochenkov-18/+18
2021-03-05expand: Some more consistent naming in module loadingVadim Petrochenkov-43/+43
2021-03-05expand: Less path cloning during module loadingVadim Petrochenkov-23/+29
2021-03-05expand: Determine module directory path directly instead of relying on spanVadim Petrochenkov-8/+3
2021-03-05expand: Move module file path stack from global session to expansion dataVadim Petrochenkov-13/+9
Also don't push the paths on the stack directly in `fn parse_external_mod`, return them instead.
2021-03-05expand: Remove obsolete `DirectoryOwnership::UnownedViaMod`Vadim Petrochenkov-52/+9
This ownership kind is only constructed in the case of path attributes like `#[path = ".."]` without a file name segment, which always represent some kind of directories and will produce and error on attempt to parse them as a module file.
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-13/+10
Also remove `ast::Mod` which is mostly redundant now
2021-02-18ast: Stop using `Mod` in `Crate`Vadim Petrochenkov-3/+2
Crate root is sufficiently different from `mod` items, at least at syntactic level. Also remove customization point for "`mod` item or crate root" from AST visitors.
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-4/+8
2020-09-04rustc_expand: remove pub visibility for rustfmtCaleb Cartwright-2/+1
2020-08-30mv compiler to compiler/mark-0/+312