about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/creader.rs
AgeCommit message (Collapse)AuthorLines
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
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.