summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2024-11-21Auto merge of #132362 - mustartt:aix-dylib-detection, r=jieyouxubors-3/+53
[AIX] change system dynamic library format Historically on AIX, almost all dynamic libraries are distributed in `.a` Big Archive Format which can consists of both static and shared objects in the same archive (e.g. `libc++abi.a(libc++abi.so.1)`). During the initial porting process, the dynamic libraries are kept as `.a` to simplify the migration, but semantically having an XCOFF object under the archive extension is wrong. For crate type `cdylib` we want to be able to distribute the libraries as archives as well. We are migrating to archives with the following format: ``` $ ar -t lib<name>.a lib<name>.so ``` where each archive contains a single member that is a shared XCOFF object that can be loaded.
2024-11-21aix: fix archive formatHenry Jiang-3/+53
fmt fix cfg for windows remove unused imports address comments update libc to 0.2.164 fmt remove unused imports
2024-11-19Implement ~const opaquesMichael Goulet-0/+4
2024-11-19Rename implied_const_bounds to explicit_implied_const_boundsMichael Goulet-6/+6
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-2/+2
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-15rustc_metadata: Preprocess search paths for better performancePiotr Osiewicz-43/+48
Over in Zed we've noticed that loading crates for a large-ish workspace can take almost 200ms. We've pinned it down to how rustc searches for paths, as it performs a linear search over the list of candidate paths. In our case the candidate list had about 20k entries which we had to iterate over for each dependency being loaded. This commit introduces a simple FilesIndex that's just a sorted Vec under the hood. Since crates are looked up by both prefix and suffix, we perform a range search on said Vec (which constraints the search space based on prefix) and follow up with a linear scan of entries with matching suffixes. FilesIndex is also pre-filtered before any queries are performed using available target information; query prefixes/sufixes are based on the target we are compiling for, so we can remove entries that can never match up front. Overall, this commit brings down build time for us in dev scenarios by about 6%. 100ms might not seem like much, but this is a constant cost that each of our workspace crates has to pay, even when said crate is miniscule.
2024-11-07Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errorsJubilee-0/+1
[StableMIR] API to retrieve definitions from crates Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, we're still missing items from trait implementation and primitives. r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07[StableMIR] API to retrieve definitions from cratesCelina G. Val-0/+1
Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, add a query to retrieve the number of defs in a foreign crate.
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-7/+7
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-11/+15
Stop reexporting ReprOptions from middle::ty
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-17/+17
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-11-02Rollup merge of #131829 - Zalathar:goodbye-zprofile, r=chenyukangGuillaume Gomez-3/+1
Remove support for `-Zprofile` (gcov-style coverage instrumentation) Tracking issue: #42524 MCP: https://github.com/rust-lang/compiler-team/issues/798 --- This PR removes the unstable `-Zprofile` flag, which enables ”gcov-style” coverage instrumentation, along with its associated `-Zprofile-emit` configuration flag. (The profile flag predates and is almost entirely separate from the stable `-Cinstrument-coverage` flag.) Notably, the `-Zprofile` flag: - Is largely untested in-tree, having only one run-make test that does not check whether its output is correct or useful. - Has no known maintainer. - Has seen no push towards stabilization. - Has at least one severe regression reported in 2022 that apparently remains unaddressed. - #100125 - Is confusingly named, since it appears to be more about coverage than performance profiling, and has nothing to do with PGO. - Is fundamentally limited by relying on counters auto-inserted by LLVM, with no knowledge of Rust beyond debuginfo.
2024-10-31Remove support for decompressing dylib metadatabjorn3-25/+4
We haven't been compressing dylib metadata for a while now. Removing decompression support will regress error messages about an incompatible rustc version being used, but dylibs are pretty rare anyway.
2024-10-31Auto merge of #131186 - compiler-errors:precise-capturing-borrowck, r=estebankbors-9/+4
Try to point out when edition 2024 lifetime capture rules cause borrowck issues Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes. This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to `.span_warn` just so it would show up in a different color. Thoughts? Fixes #130545 Opening as a draft first since it's stacked on #131183. r? `@ghost`
2024-10-31Encode cross-crate opaque type originMichael Goulet-9/+4
2024-10-30Remove dead code stemming from the old effects desugaringLeón Orell Valerian Liehr-8/+1
2024-10-31Remove support for `-Zprofile` (gcov-style coverage instrumentation)Zalathar-3/+1
2024-10-29Rollup merge of #131375 - klensy:clone_on_ref_ptr, r=cjgillotJubilee-2/+2
compiler: apply clippy::clone_on_ref_ptr for CI Apply lint https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_ref_ptr for compiler, also see https://github.com/rust-lang/rust/pull/131225#discussion_r1790109443. Some Arc's can be misplaced with Lrc's, sorry. https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/enable.20more.20clippy.20lints.20for.20compiler.20.28and.5Cor.20std.29
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-2/+2
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-26expand: Stop using artificial `ast::Item` for macros loaded from metadataVadim Petrochenkov-22/+10
2024-10-25tcx.is_const_fn doesn't work the way it is described, remove itRalf Jung-1/+1
Then we can rename the _raw functions to drop their suffix, and instead explicitly use is_stable_const_fn for the few cases where that is really what you want.
2024-10-24Be better at enforcing that const_conditions is only called on const itemsMichael Goulet-7/+11
2024-10-24Implement const effect predicate in new solverMichael Goulet-1/+11
2024-10-24Remove associated type based effects logicMichael Goulet-5/+0
2024-10-23nightly feature tracking: get rid of the per-feature bool fieldsRalf Jung-7/+7
2024-10-20Remove outdated commentChris Denton-3/+0
#44234 is resolved
2024-10-17rustc_metadata: reduce repetitionTamir Duberstein-15/+29
2024-10-16rustc_metadata: reduce repetitionTamir Duberstein-27/+18
2024-10-15rustc_metadata: replace `?` in expression with mapTamir Duberstein-1/+1
2024-10-15rustc_metadata: move comment closer to codeTamir Duberstein-3/+5
This was added in cc3c8bbfaf5af19caf3deb131a995a65ca4674f9 when it was closer to the `extract_one` call. Move it back near that call.
2024-10-11Auto merge of #131045 - compiler-errors:remove-unnamed_fields, r=wesleywiserbors-3/+0
Retire the `unnamed_fields` feature for now `#![feature(unnamed_fields)]` was implemented in part in #115131 and #115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature. However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly. Fixes #117942 Fixes #121161 Fixes #121263 Fixes #121299 Fixes #121722 Fixes #121799 Fixes #126969 Fixes #131041 Tracking: * https://github.com/rust-lang/rust/issues/49804 [^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields [^2]: https://github.com/rust-lang/rust/issues/49804#issuecomment-1972619108
2024-10-10Add variances to RPITITsMichael Goulet-1/+4
2024-10-04Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnayJubilee-1/+0
Stabilize the `map`/`value` methods on `ControlFlow` And fix the stability attribute on the `pub use` in `core::ops`. libs-api in https://github.com/rust-lang/rust/issues/75744#issuecomment-2231214910 seemed reasonably happy with naming for these, so let's try for an FCP. Summary: ```rust impl<B, C> ControlFlow<B, C> { pub fn break_value(self) -> Option<B>; pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>; pub fn continue_value(self) -> Option<C>; pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>; } ``` Resolves #75744 ``@rustbot`` label +needs-fcp +t-libs-api -t-libs --- Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
2024-10-04Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercoteGuillaume Gomez-2/+7
Implement RFC3695 Allow boolean literals as cfg predicates This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`. r? `@nnethercote` *(or anyone with parser knowledge)* cc `@clubby789`
2024-10-03Auto merge of #131215 - matthiaskrgr:rollup-i021ef7, r=matthiaskrgrbors-3/+3
Rollup of 7 pull requests Successful merges: - #131024 (Don't give method suggestions when method probe fails due to bad implementation of `Deref`) - #131112 (TransmuteFrom: Gracefully handle unnormalized types and normalization errors) - #131176 (.gitignore files for nix) - #131183 (Refactoring to `OpaqueTyOrigin`) - #131187 (Avoid ICE in coverage builds with bad `#[coverage(..)]` attributes) - #131192 (Handle `rustc_query_impl` cases of `rustc::potential_query_instability` lint) - #131197 (Avoid emptiness check in `PeekMut::pop`) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-03Rollup merge of #131183 - compiler-errors:opaque-ty-origin, r=estebankMatthias Krüger-3/+3
Refactoring to `OpaqueTyOrigin` Pulled out of a larger PR that uses these changes to do cross-crate encoding of opaque origin, so we can use them for edition 2024 migrations. These changes should be self-explanatory on their own, tho 😄
2024-10-03Auto merge of #131145 - ↵bors-11/+10
ismailarilik:handle_potential_query_instability_lint_for_rustc_metadata, r=compiler-errors Handle `rustc_metadata` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_metadata/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/lib.rs#L3) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447
2024-10-03Handle `rustc_metadata` cases of `rustc::potential_query_instability` lintismailarilik-11/+10
2024-10-02Move in_trait into OpaqueTyOriginMichael Goulet-2/+2
2024-10-02Use named fields for OpaqueTyOriginMichael Goulet-3/+3
2024-10-01add unstable support for outputting file checksums for use in cargoJacob Kiesel-0/+2
2024-10-01Remove unnamed field featureMichael Goulet-3/+0
2024-10-01Implement boolean lit support in cfg predicatesUrgau-1/+1
2024-10-01Use `ast::NestedMetaItem` when evaluating cfg predicateUrgau-2/+7
2024-09-27Implement RFC3137 trim-paths sysroot changesUrgau-49/+56
2024-09-25Stabilize the `map`/`value` methods on `ControlFlow`Scott McMurray-1/+0
And fix the stability attribute on the `pub use` in `core::ops`.
2024-09-25Auto merge of #130803 - cuviper:file-buffered, r=joshtriplettbors-2/+2
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-24Dogfood `feature(file_buffered)`Josh Stone-2/+2
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-4/+4