summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src
AgeCommit message (Collapse)AuthorLines
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-5/+3
`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-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-2/+3
2024-12-10Implement projection and shim for AFIDTMichael Goulet-1/+4
2024-12-06Remove polymorphizationBen Kimock-378/+10
2024-11-28Share inline(never) generics across cratesMark Rousskov-8/+24
This reduces code sizes and better respects programmer intent when marking inline(never). Previously such a marking was essentially ignored for generic functions, as we'd still inline them in remote crates.
2024-11-23remove remaining references to `Reveal`lcnr-1/+1
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-1/+1
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-34/+54
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-17Rollup merge of #133029 - veluca93:abi-checks-tier3, r=workingjubilee许杰友 Jieyou Xu (Joe)-3/+1
ABI checks: add support for some tier3 arches, warn on others. Followup to - https://github.com/rust-lang/rust/pull/132842 - https://github.com/rust-lang/rust/pull/132173 - https://github.com/rust-lang/rust/issues/131800 r? ``@workingjubilee``
2024-11-17Auto merge of #132566 - saethlin:querify-mir-collection, r=cjgillotbors-50/+100
Querify MonoItem collection Factored out of https://github.com/rust-lang/rust/pull/131650. These changes are required for post-mono MIR opts, because the previous implementation would load the MIR for every Instance that we traverse (as well as invoke queries on it). The cost of that would grow massively with post-mono MIR opts because we'll need to load new MIR for every Instance, instead of re-using the `optimized_mir` for every Instance with the same DefId. So the approach here is to add two new queries, `items_of_instance` and `size_estimate`, which contain the specific information about an Instance's MIR that MirUsedCollector and CGU partitioning need, respectively. Caching these significantly increases the size of the query cache, but that's justified by our improved incrementality (I'm sure walking all the MIR for a huge crate scales quite poorly). This also changes `MonoItems` into a type that will retain the traversal order (otherwise we perturb a bunch of diagnostics), and will also eliminate duplicate findings. Eliminating duplicates removes about a quarter of the query cache size growth. The perf improvements in this PR are inflated because rustc-perf uses `-Zincremental-verify-ich`, which makes loading MIR a lot slower because MIR contains a lot of Spans and computing the stable hash of a Span is slow. And the primary goal of this PR is to load less MIR. Some squinting at `collector profile_local perf-record +stage1` runs suggests the magnitude of the improvements in this PR would be decreased by between a third and a half if that flag weren't being used. Though this effect may apply to the regressions too since most are incr-full and this change also causes such builds to encode more Spans.
2024-11-14ABI checks: add support for some tier3 arches, warn on others.Luca Versari-3/+1
2024-11-12ABI checks: add support for tier2 archesLuca Versari-16/+55
See #131800 for the data collection behind this change. Also adds a test that exercise the "empty list of features" path.
2024-11-12Querify MonoItem collectionBen Kimock-50/+100
2024-11-10move all mono-time checks into their own folder, and their own queryRalf Jung-101/+124
2024-11-10Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errorsbors-0/+184
Emit warning when calling/declaring functions with unavailable vectors. On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558 r? RalfJung
2024-11-02compiler: Add rustc_abi to _monomorphizeJubilee Young-1/+1
2024-11-01Emit warning when calling/declaring functions with unavailable vectors.Luca Versari-0/+184
On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558
2024-10-26Auto merge of #132171 - matthiaskrgr:rollup-tp75ge7, r=matthiaskrgrbors-3/+3
Rollup of 3 pull requests Successful merges: - #132114 (Use `Enabled{Lang,Lib}Feature` instead of n-tuples) - #132163 (Update Fuchsia CI script for package serving) - #132168 (Effects cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-26Effects cleanupDeadbeef-3/+3
- 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-25Revert "Emit error when calling/declaring functions with unavailable vectors."Rémy Rakic-134/+0
This reverts commit 5af56cac38fa48e4228e5e123d060e85eb1acbf7.
2024-10-25Auto merge of #127731 - veluca93:abi_checks, r=RalfJungbors-0/+134
Emit future-incompatibility lint when calling/declaring functions with vectors that require missing target feature On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization error to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. r? RalfJung Part of https://github.com/rust-lang/rust/issues/116558
2024-10-25Emit error when calling/declaring functions with unavailable vectors.Luca Versari-0/+134
On some architectures, vector types may have a different ABI when relevant target features are enabled. As discussed in https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code. This commit makes it an error to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant.
2024-10-24Remove associated type based effects logicMichael Goulet-1/+0
2024-10-14Add fast-path when computing the default visibilityUrgau-0/+7
2024-10-04Use wide pointers consistenly across the compilerUrgau-4/+4
2024-10-01Replace -Z default-hidden-visibility with -Z default-visibilityDavid Lattimore-19/+15
MCP: https://github.com/rust-lang/compiler-team/issues/782 Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-1/+1
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-25Auto merge of #130803 - cuviper:file-buffered, r=joshtriplettbors-3/+3
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804
2024-09-24Rollup merge of #130764 - compiler-errors:inherent, r=estebankTrevor Gross-1/+1
Separate collection of crate-local inherent impls from error tracking #119895 changed the return type of the `crate_inherent_impls` query from `CrateInherentImpls` to `Result<CrateInherentImpls, ErrorGuaranteed>` to avoid needing to use the non-parallel-friendly `track_errors()` to track if an error was reporting from within the query... This was mostly fine until #121113, which stopped halting compilation when we hit an `Err(ErrorGuaranteed)` in the `crate_inherent_impls` query. Thus we proceed onwards to typeck, and since a return type of `Result<CrateInherentImpls, ErrorGuaranteed>` means that the query can *either* return one of "the list inherent impls" or "error has been reported", later on when we want to assemble method or associated item candidates for inherent impls, we were just treating any `Err(ErrorGuaranteed)` return value as if Rust had no inherent impls defined anywhere at all! This leads to basically every inherent method call failing with an error, lol, which was reported in #127798. This PR changes the `crate_inherent_impls` query to return `(CrateInherentImpls, Result<(), ErrorGuaranteed>)`, i.e. returning the inherent impls collected *and* whether an error was reported in the query itself. It firewalls the latter part of that query into a new `crate_inherent_impls_validity_check` just for the `ensure()` call. This fixes #127798.
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-3/+3
2024-09-24be even more precise about "cast" vs "coercion"Lukas Markeffsky-4/+4
2024-09-24unify dyn* coercions with other pointer coercionsLukas Markeffsky-3/+3
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-1/+1
2024-09-23Check vtable projections for validity in miriMichael Goulet-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-16/+19
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-4/+2
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-11Simplify some nested if statementsMichael Goulet-4/+2
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-1/+1
2024-09-06Make `Ty::boxed_ty` return an `Option`Pavel Grigorenko-2/+7
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-29Add `warn(unreachable_pub)` to `rustc_monomorphize`.Nicholas Nethercote-17/+22
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-4/+1
closures
2024-08-25Avoid taking reference of &TyKindMichael Goulet-2/+2
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-3/+3
2024-08-19Don't generate functions with the `rustc_intrinsic_must_be_overridden` attributeDianQK-1/+3
2024-08-15Rollup merge of #129067 - cuviper:append, r=wesleywiserMatthias Krüger-2/+2
Use `append` instead of `extend(drain(..))` The first commit adds `IndexVec::append` that forwards to `Vec::append`, and uses it in a couple places. The second commit updates `indexmap` for its new `IndexMap::append`, and also uses that in a couple places. These changes are similar to what [`clippy::extend_with_drain`](https://rust-lang.github.io/rust-clippy/master/index.html#/extend_with_drain) would suggest, just for other collection types.
2024-08-13Update `indexmap` and use `IndexMap::append`Josh Stone-2/+2
2024-08-13Use is_lang_item moreMichael Goulet-1/+3
2024-08-08Rename struct_tail_erasing_lifetimes to struct_tail_for_codegenMichael Goulet-2/+2