summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/creader.rs
AgeCommit message (Collapse)AuthorLines
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
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-2/+1
by module
2022-08-31respond to review feedback: mainly eliminate as many conversions as possible...Nathan Stocks-11/+8
- ... when creating diagnostics in rustc_metadata - use the error_code! macro - pass macro output to diag.code() - use fluent from within manual implementation of SessionDiagnostic - emit the untested errors in case they occur in the wild - stop panicking in the probably-not-dead code, add fixme to write test
2022-08-31port creader.rs to SessionDiagnosticsNathan Stocks-34/+22
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-5/+5
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-02Auto merge of #97235 - nbdd0121:unwind, r=Amanieubors-1/+1
Fix FFI-unwind unsoundness with mixed panic mode UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926). To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy. For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted. In summary: ```rust #![warn(ffi_unwind_calls)] mod foo { #[no_mangle] pub extern "C-unwind" fn foo() {} } extern "C-unwind" { fn foo(); } fn main() { // Call to Rust function is fine regardless ABI. foo::foo(); // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. unsafe { foo(); } //~^ WARNING call to foreign function with FFI-unwind ABI let ptr: extern "C-unwind" fn() = foo::foo; // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. ptr(); //~^ WARNING call to function pointer with FFI-unwind ABI } ``` Fix #96926 `@rustbot` label: T-compiler F-c_unwind
2022-06-20Fix panic by checking if `CStore` has the crate data we want before actually ↵Guillaume Gomez-0/+4
querying it
2022-06-08Rename `panic_strategy` query to `required_panic_strategy`Gary Guo-1/+1
2022-06-08Fix FFI-unwind unsoundness with mixed panic modeGary Guo-1/+1
2022-05-24Make Lazy not care about lifetimes until decodeMichael Goulet-3/+3
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-8/+8
2022-04-27Add --json unused-externs-silent with original behaviourJeremy Fitzhardinge-3/+9
Since Cargo wants to do its own fatal error handling for unused dependencies, add the option `--json unused-externs-silent` which has the original behaviour of not indicating non-zero exit status for `deny`/`forbid`-level unused dependencies.
2022-04-27Plumb through rustc_lint_defs::Level as enum rather than string.Jeremy Fitzhardinge-4/+1
2022-04-23Add support for `nounused` --extern flagJeremy Fitzhardinge-0/+4
This adds `nounused` to the set of extern flags: `--extern nounused:core=/path/to/core/libcore.rlib`. The effect of this flag is to suppress `unused-crate-dependencies` warnings relating to the crate.
2022-04-19Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwcoDylan DPC-18/+2
Remove `--extern-location` and all associated code `--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-15Remove `--extern-location` and all associated codeJeremy Fitzhardinge-18/+2
`--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-14library: Move `CStr` to libcore, and `CString` to liballocVadim Petrochenkov-0/+1
2022-03-16rustc_error: make ErrorReported impossible to constructmark-3/+5
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-1/+1
2022-02-19Adopt let else in more placesest31-6/+4
2021-12-21rustc_metadata: Switch crate data iteration from a callback to iteratorVadim Petrochenkov-94/+67
The iteration looks more conventional this way, and some allocations are avoided.
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-3/+3
2021-12-06replace dynamic library module with libloadingAndy Russell-14/+7
2021-12-01Improve suggestion for extern crate self error messageMichael-20/+10
2021-12-01Stop treating extern crate loading failures as fatal errorsMichael-12/+26
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-0/+1
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-2/+2
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-2/+2
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-1/+1
2021-09-14Store DefPathHash->DefIndex map in on-disk-hash-table format in crate metadata.Michael Woerister-1/+1
This encoding allows for random access without an expensive upfront decoding state which in turn allows simplifying the DefPathIndex lookup logic without regressing performance.
2021-09-02Remove unused argument from resolve_cratebjorn3-9/+6
2021-09-02Remove root field from CrateLocatorbjorn3-2/+1
2021-09-02Remove host_hash from CrateLocatorbjorn3-3/+3
2021-09-02Refactor CrateLocator.is_proc_macrobjorn3-4/+3
This also fixes a (theoretical) bug where a proc-macro may be loaded as plugin if it exports a symbol with the right name.
2021-08-04Add back -Zno-profiler-runtimeAmanieu d'Antras-6/+4
This was removed by #85284 in favor of -Zprofiler-runtime=<name>. However the suggested -Zprofiler-runtime=None doesn't work because "None" is treated as a crate name.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+4
2021-07-15Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkovbors-1/+5
Reuse CrateNum for proc-macro crates even when cross-compiling Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here. Fixes https://github.com/rust-lang/rust/issues/56935. r? `@petrochenkov` cc `@alexcrichton`
2021-07-14Reuse CrateNum for proc-macro crates even when cross-compilingJoshua Nelson-1/+5
Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here.
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-1/+1
2021-07-06Make resolutions a query.Camille GILLOT-0/+6
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-12/+7
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.