summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/creader.rs
AgeCommit message (Collapse)AuthorLines
2024-01-04cstore: Remove unnecessary locking from `CrateMetadata`Vadim Petrochenkov-20/+21
2023-12-24Remove more `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-15/+18
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-1/+1
2023-12-02Use `Session::diagnostic` in more places.Nicholas Nethercote-1/+1
2023-11-30Move `MetadataLoader{,Dyn}` to `rustc_metadata`.Nicholas Nethercote-5/+15
They're not used in `rustc_session`, and `rustc_metadata` is a more obvious location. `MetadataLoader` was originally put into `rustc_session` in #41565 to avoid a dependency on LLVM, but things have changed a lot since then and that's no longer relevant, e.g. `rustc_codegen_llvm` depends on `rustc_metadata`.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-3/+3
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-06rustc_metadata: use try_canonicalizeTamir Duberstein-2/+3
This is simpler and avoids unnecessary calls to `env::current_dir`. rustc_plugin is left unchanged to avoid conflicts with #116412. Updates #116426.
2023-09-09Use `FreezeLock` for `CStore`John Kåre Alsaker-5/+5
2023-08-13Remove metadata_loader querybjorn3-5/+11
It is only used by CrateLoader. We can store the metadata loader in CStore instead which CrateLoader has access to.
2023-08-09rustc: Move `crate_types` from `Session` to `GlobalCtxt`Vadim Petrochenkov-3/+3
Removes a piece of mutable state. Follow up to #114578.
2023-08-07rustc_interface: Dismantle `register_plugins` queryVadim Petrochenkov-3/+5
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-2/+6
2023-05-31Auto merge of #111076 - ↵bors-5/+15
notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot diagnostics: exclude indirect private deps from trait impl suggest Fixes #88696
2023-05-25Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelixbors-3/+3
Support #[global_allocator] without the allocator shim This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim. Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist. To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors. (Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
2023-05-25rustc_metadata: specialize private_dep flag with `fetch_and`Michael Howell-1/+1
2023-05-25rustc_metadata: fix private_dep logic in `register_crate`Michael Howell-6/+13
2023-05-25Update compiler/rustc_metadata/src/creader.rsMichael Howell-1/+1
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2023-05-25rustc_metadata: inherit dependency privacy flagMichael Howell-3/+6
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-23Fix symbol conflict diagnostic mistakenly being shown instead of missing ↵Oli Scherer-3/+7
crate diagnostic
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-1/+1
Error message all end up passing into a function as an `impl Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as `&format("...")` that means we allocate a string (in the `format!` call), then take a reference, and then clone (allocating again) the reference to produce the `{D,Subd}iagnosticMessage`, which is silly. This commit removes the leading `&` from a lot of these cases. This means the original `String` is moved into the `{D,Subd}iagnosticMessage`, avoiding the double allocations. This requires changing some function argument types from `&str` to `String` (when all arguments are `String`) or `impl Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and some are `&str`).
2023-05-11Split AllocatorKind::fn_name in global_fn_name and default_fn_namebjorn3-3/+3
2023-05-05add "force" option to --externMatt Hammerly-1/+13
2023-04-28include source error for LoadLibraryExWSameer Puri-1/+9
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-0/+68
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-68/+0
2023-04-04Another AppendOnlyVecOli Scherer-2/+2
2023-03-22Rollup merge of #109358 - petrochenkov:nosess, r=cjgillotMatthias Krüger-20/+17
rustc: Remove unused `Session` argument from some attribute functions (One auxiliary test file containing one of these functions was unused, so I removed it instead of updating.)
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-20/+17
2023-03-21Eagerly intern and check CrateNum/StableCrateId collisionsOli Scherer-54/+21
2023-03-13metadata/resolve: Minor refactoring to "tcx -> cstore" conversionsVadim Petrochenkov-6/+9
2023-02-20Stop passing in values that one can also get from the tcx lazilyOli Scherer-12/+17
2023-02-20Remove definitions field that is only needed for one methodOli Scherer-12/+4
2023-02-20Make untracked.cstore lockable so that resolution can still write to it when ↵Oli Scherer-6/+5
using TyCtxt
2023-02-13rustc_resolve: Remove `Resolver::clone_output`Vadim Petrochenkov-6/+5
And remove `Clone` impls and `Lrc`s that are no longer necessary
2023-02-06Add extended error message for E0523Matthew Kelly-1/+6
Adds the extended error documentation for E0523 to indicate that the error is no longer produced by the compiler. Update the E0464 documentation to include example code that produces the error. Remove the error message E0523 from the compiler and replace it with an internal compiler error.
2023-02-05rustc_metadata: remove huge error importsest31-15/+13
2023-02-02Retry opening proc-macro DLLs a few times on Windows.Michael Woerister-2/+40
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-2/+2
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-16Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obkbors-8/+3
Stabilize default_alloc_error_handler Tracking issue: #66741 This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided. The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked. Closes #66741
2022-12-09Fold `Definitions` into the untracked dataOli Scherer-3/+3
2022-12-09Generate crate loaders on the flyOli Scherer-29/+31
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-3/+3
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-1/+1
2022-11-03Stabilize default_alloc_error_handlerAmanieu d'Antras-8/+3
Closes #66741
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-12/+85
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-09-03Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwcoDylan DPC-34/+19
Migrate rustc_metadata to SessionDiagnostics Migrate rustc_metadata to SessionDiagnostics. Part of https://github.com/rust-lang/rust/issues/100717