Repository navigation
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[PERF] `rustc_builtin_macros` cleanup, part 8
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0bcf40d): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.7%, secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 491.711s -> 491.207s (-0.10%) |
This comment has been minimized.
This comment has been minimized.
These are especially useful for constructing types and paths referring to primitives.
It is only used in one place and it's easier to do the check directly in `debug.rs`.
Several small changes to remove some unhelpful helpers.
As I understand it, this would only be needed if the crate defining the derive macros (which is `core`) was using edition 2015. Since `core` uses edition 2024, there is in this case no difference between global and local and we can skip the leading `::`.
Previously, `std_path` converted the given `&[Symbol]` to a `Vec<Ident>` by prepending a `$crate::` and mapping each `Symbol` to an `Ident`. This commit changes the functions that previously took `Vec<Ident>` to directly take `Path` instead, and updates `std_path` to also directly return a `Path`. This allows directly prepending the `$crate::` to the resulting `segments`. It also allows constructing a `Path` from `&[Ident]` instead of `Vec<Ident>`.
`new_path` is just a obsolete trivial wrapper around `cx.std_path_all` now.
TODO: is this actually worth it? maybe we should remove the macros entirely instead?
Passing around `type_ident` everywhere is what the old code did as well, but it's actually only needed in two places.
This reverts commit c28f2fece8497fb2119e17a47188c6ab1dc5da7b. (This revert only exists to make the diff for the next commit clearer and will be removed before merging.)
This leads to `CombineSubstructureFunc` becoming a `fn`, allows some cleanups and requires restructuring `From` a bit. It also means that it is no longer easily possible to generate the dummy method body after encountering an error, so the code just skips generating anything.
7eace55 to
c96f45e
Compare
rustc_builtin_macros cleanup, part 8rustc_builtin_macros cleanup, part 8
|
Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 |
| use crate::{deriving, diagnostics}; | ||
|
|
||
| pub(crate) struct TraitDef<'a> { | ||
| pub(crate) struct TraitDef<> { |
There was a problem hiding this comment.
oh, it looks like rustfmt skips formatting a struct with a default field entirely
This PR is roughly split into four parts:
ExtCtxtto both construct some common AST elements in an easier way. They also change someIdentarguments toSymbolto avoid the annoying call-site pattern of repeating the span (cx.some_method(span, Ident::new(name, span), ...)).Pathconstruction faster and remove thenew_pathremnant of the old local path version.path_std!andpathvec!entirely or utilize them in the whole crate. Both solutions seem better than the current mixed situation.Substructureback in use the type name instead ofSelfin constructor paths again #163863 to fix the regression without thinking much about whether it is actually needed. We can either remove it again or use it to also store the&Itemwhich the derive is applied to, which allows removingcombine_substructure, but reduces the flexibility a bit.Previous PR: #163389
r? @nnethercote