summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling/src
AgeCommit message (Collapse)AuthorLines
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-0/+3
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+2
`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-12-15Rollup merge of #134285 - oli-obk:push-vwrqsqlwnuxo, r=UrgauStuart Cook-1/+1
Add some convenience helper methods on `hir::Safety` Makes a lot of call sites simpler and should make any refactorings needed for https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 simpler, as fewer sites have to be touched in case we end up storing some information in the variants of `hir::Safety`
2024-12-14Add some convenience helper methods on `hir::Safety`Oli Scherer-1/+1
2024-12-14Rollup merge of #134081 - oli-obk:push-prpsqxxynxnq, r=BoxyUwUMatthias Krüger-1/+28
Try to evaluate constants in legacy mangling Best reviewed commit by commit. It seems kind of odd to treat literals differently from unevaluated free constants. So let's evaluate those constants and only fall back to `_` rendering if that fails to result in an integral constant
2024-12-10Remove more traces of anonymous ADTsMichael Goulet-2/+1
2024-12-10Try to evaluate constants in legacy manglingOli Scherer-1/+28
2024-12-06Remove polymorphizationBen Kimock-7/+5
2024-11-19additional `TypingEnv` cleanupslcnr-3/+3
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-4/+5
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-1/+1
2024-11-04Remove the trivial constkind importsMichael Goulet-1/+1
2024-11-03compiler: Replace rustc_target with abi in symbol_manglingJubilee Young-4/+3
2024-10-27compiler: Add rustc_abi dependence to the compilerJubilee Young-1/+1
Depend on rustc_abi in compiler crates that use it indirectly but have not yet taken on that dependency, and are not entangled in my other PRs. This leaves an "excise rustc_target" step after the dust settles.
2024-10-26Effects cleanupDeadbeef-4/+4
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-1/+1
2024-10-19Rename normalize to normalize_internal, remove unnecessary usagesMichael Goulet-1/+0
2024-10-19Get rid of const eval_* and try_eval_* helpersMichael Goulet-1/+3
2024-09-23Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwUMatthias Krüger-32/+27
Handle unsized consts with type `str` in v0 symbol mangling This PR fixes #116303 by handling consts with type `str` in v0 symbol mangling as partial support for unsized consts. This PR is related to `#![feature(adt_const_params)]` (#95174) and `#![feature(unsized_const_params)]` (#128028). r? ``@BoxyUwU``
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-20Rollup merge of #130485 - compiler-errors:impossible-types, r=BoxyUwUMatthias Krüger-16/+30
Do not expect infer/bound/placeholder/error in v0 symbol mangling Infer/bound/placeholder/error are not encounterable during codegen. Let's make sure v0 symbol mangling doesn't "accidentally" handle them. As for aliases (namely: projections and uv consts) these may still be encounterable because of the way that we render the def paths of items. Specifically, when we have something like: ``` struct W<T>(T); impl<T> W<T> { fn x() { fn y() {} } } ``` The path of `y` is rendered like `crate_name::W<T>::x::y`. Specifically, since `y` doesn't inherit the generics of the impl, we use the *identity* substitutions for that impl. If the impl has any aliases, they will remain unnormalized if they're rigid. r? `@BoxyUwU`
2024-09-20handle unsized consts with type `str` in v0 symbol manglingJaic1-32/+27
2024-09-17Do not expect infer/bound/placeholder/error in v0 symbol manglingMichael Goulet-16/+30
2024-09-16Fix a couple more DefKind discrepancies between DefKind::Closure and ↵Michael Goulet-1/+5
DefKind::SyntheticCoroutineBody
2024-09-11clippy::useless_conversionMichael Goulet-1/+1
2024-09-03Auto merge of #129777 - nnethercote:unreachable_pub-4, r=Urgaubors-0/+1
Add `unreachable_pub`, round 4 A follow-up to #129732. r? `@Urgau`
2024-09-03Add `warn(unreachable_pub)` to `rustc_symbol_mangling`.Nicholas Nethercote-0/+1
2024-09-02chore: Fix typos in 'compiler' (batch 3)Alexander Cyon-1/+1
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-4/+0
closures
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-1/+2
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-17/+20
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-29Fix FnMut/Fn shim for coroutine-closures that capture referencesMichael Goulet-5/+16
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-2/+2
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-15/+15
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-05Add `Ty` to `ConstKind::Value`Boxy-49/+35
2024-06-05Basic removal of `Ty` from places (boring)Boxy-11/+16
2024-05-17Rename Unsafe to SafetySantiago Pastorino-1/+1
2024-05-14Add v0 symbol mangling for `f16` and `f128`Trevor Gross-3/+2
As discussed at <https://github.com/rust-lang/rust/pull/122106>, use the crate encoding to represent new primitives.
2024-05-09Make builtin_deref just return a TyMichael Goulet-2/+1
2024-05-03Auto merge of #123441 - saethlin:fixed-len-file-names, r=oli-obkbors-2/+2
Stabilize the size of incr comp object file names The current implementation does not produce stable-length paths, and we create the paths in a way that makes our allocation behavior is nondeterministic. I think `@eddyb` fixed a number of other cases like this in the past, and this PR fixes another one. Whether that actually matters I have no idea, but we still have bimodal behavior in rustc-perf and the non-uniformity in `find` and `ls` was bothering me. I've also removed the truncation of the mangled CGU names. Before this PR incr comp paths look like this: ``` target/debug/incremental/scratch-38izrrq90cex7/s-gux6gz0ow8-1ph76gg-ewe1xj434l26w9up5bedsojpd/261xgo1oqnd90ry5.o ``` And after, they look like this: ``` target/debug/incremental/scratch-035omutqbfkbw/s-gux6borni0-16r3v1j-6n64tmwqzchtgqzwwim5amuga/55v2re42sztc8je9bva6g8ft3.o ``` On the one hand, I'm sure this will break some people's builds because they're on Windows and only a few bytes from the path length limit. But if we're that seriously worried about the length of our file names, I have some other ideas on how to make them smaller. And last time I deleted some hash truncations from the compiler, there was a huge drop in the number if incremental compilation ICEs that were reported: https://github.com/rust-lang/rust/pull/110367https://github.com/rust-lang/rust/pull/110367 --- Upon further reading, this PR actually fixes a bug. This comment says the CGU names are supposed to be a fixed-length hash, and before this PR they aren't: https://github.com/rust-lang/rust/blob/ca7d34efa94afe271accf2bd3d44152a5bd6fff1/compiler/rustc_monomorphize/src/partitioning.rs#L445-L448
2024-04-30Remove `extern crate tracing` from numerous crates.Nicholas Nethercote-4/+2
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-3/+2
2024-04-22Stabilize the size of incr comp object file namesBen Kimock-2/+2
2024-04-16Add simple async drop glue generationzetanumbers-1/+3
Explainer: https://zetanumbers.github.io/book/async-drop-design.html https://github.com/rust-lang/rust/pull/121801
2024-04-14Update v0.rsTobias Decking-1/+1
2024-04-09Rollup merge of #123649 - maurer:kcfi-v0, r=compiler-errorsMatthias Krüger-2/+2
KCFI: Use legal charset in shim encoding To separate `ReifyReason::FnPtr` from `ReifyReason::VTable`, we hyphenated the shims. Hyphens are not actually legal, but underscores are, so use those instead. r? `@compiler-errors`
2024-04-08KCFI: Use legal charset in shim encodingMatthew Maurer-2/+2
To separate `ReifyReason::FnPtr` from `ReifyReason::VTable`, we hyphenated the shims. Hyphens are not actually legal, but underscores are, so use those instead.
2024-04-08sanitizers: Create the rustc_sanitizers crateRamon de C Valle-1348/+0
Create the rustc_sanitizers crate and move the source code for the CFI and KCFI sanitizers to it. Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+30