ast: Compress `AttrId` from `usize` to `u32`
An easy size win for `ast::Attribute` (96 bytes -> 88 bytes).
Also stop encoding/decoding `AttrId` entirely.
For issue 53957: revise unit test to focus on underlying bug of 23076.
Fix#53957 by revising unit test to focus on underlying bug of #23076.
Namely, this version focuses on the end-to-end behavior that the attempt to create the UDP binding will fail, regardless of the semantics of how particular DNS servers handle junk inputs.
(I spent some time trying to create a second more-focused test that would sidestep the DNS resolution, but this is not possible without more invasive changes to the internal infrastructure of `ToSocketAddrs` and what not. It is not worth it.)
symbol_names: treat ReifyShim like VtableShim.
Without this, the `#[track_caller]` tests don't pass with `-Zsymbol-mangling-version=v0`, because there is a symbol name collision between the `ReifyShim` and the original definition.
cc @anp
Rollup of 6 pull requests
Successful merges:
- #69497 (Don't unwind when hitting the macro expansion recursion limit)
- #69901 (add #[rustc_layout(debug)])
- #69910 (Avoid query type in generics)
- #69955 (Fix abort-on-eprintln during process shutdown)
- #70032 (put type params in front of const params in generics_of)
- #70119 (rustc: use LocalDefId instead of DefId in TypeckTables.)
Failed merges:
r? @ghost
rustc: use LocalDefId instead of DefId in TypeckTables.
The logic in `TypeckTables`' implementation of `HashStable`, which created `DefId`s by combining a `CrateNum` from a `DefId` and a `DefIndex` from a `LocalDefId`, bothered me a bit.
I don't know how much this matters, but it works so might as well submit it.
Fix abort-on-eprintln during process shutdown
This commit fixes an issue where if `eprintln!` is used in a TLS
destructor it can accidentally cause the process to abort. TLS
destructors are executed after `main` returns on the main thread, and at
this point we've also deinitialized global `Lazy` values like those
which store the `Stderr` and `Stdout` internals. This means that despite
handling TLS not being accessible in `eprintln!`, we will fail due to
not being able to call `stderr()`. This means that we'll double-panic
quickly because panicking also attempt to write to stderr.
The fix here is to reimplement the global stderr handle to avoid the
need for destruction. This avoids the need for `Lazy` as well as the
hidden panic inside of the `stderr` function.
Overall this should improve the robustness of printing errors and/or
panics in weird situations, since the `stderr` accessor should be
infallible in more situations.
Avoid query type in generics
There are at the moment roughly 170 queries in librustc.
The way ty::query is structured, a lot of code is duplicated for each query.
I suspect this to be responsible for a part of librustc'c compile time.
This PR reduces the amount of code generic on the query,
replacing it by code generic on the key-value types.
This is split out of #69808,
and should not contain the perf regression.
cc #65031
add #[rustc_layout(debug)]
@eddyb recently told me about the `#[rustc_layout]` attribute, and I think it would be very useful if it could be used to print all the layout information Rust has about a type. When working with layouts (e.g. in Miri), it is often not clear how certain surface language features get represented internally. I have some awful hacks locally to be able to dump this debug information; with this attribute I could get it on the playground which is so much better. :)