about summary refs log tree commit diff
path: root/compiler/rustc_session/src/session.rs
AgeCommit message (Collapse)AuthorLines
2024-01-05Rollup merge of #119601 - nnethercote:Emitter-cleanups, r=oli-obkMichael Goulet-5/+5
`Emitter` cleanups Some improvements I found while looking at this code. r? `@oli-obk`
2024-01-05Rename `AnnotateSnippetEmitterWriter` as `AnnotateSnippetEmitter`.Nicholas Nethercote-2/+2
For consistency with other `Emitter` impls.
2024-01-05Rename `EmitterWriter` as `HumanEmitter`.Nicholas Nethercote-3/+3
For consistency with other `Emitter` impls, such as `JsonEmitter`, `SilentEmitter`, `SharedEmitter`, etc.
2024-01-03Enable address sanitizer for MSVC targets using INFERASANLIBS linker flagDaniel Paoliello-1/+4
2023-12-26Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebankbors-2/+2
rework `-Zverbose` implements the changes described in https://github.com/rust-lang/compiler-team/issues/706 the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics. possible follow up work: - `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200 - `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`. r? `@compiler-errors` cc `@estebank`
2023-12-24Remove more `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-19/+5
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-293/+31
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-24Remove `ParseSess` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-10/+10
Also add missing `#[track_caller]` attributes to `DiagCtxt` methods as necessary to keep tests working.
2023-12-23Fix weird code setting in `create_feature_err`.Nicholas Nethercote-1/+1
2023-12-23Rename `EarlyDiagCtxt` methods to match `DiagCtxt`.Nicholas Nethercote-4/+4
- `early_error_no_abort` -> `early_err` - `early_error` -> `early_fatal` - `early_struct_error` -> `early_struct_fatal`
2023-12-23Give `DiagnosticBuilder` a default type.Nicholas Nethercote-12/+6
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
2023-12-23Streamline `struct_lint_level`.Nicholas Nethercote-28/+0
We can just get the error level in the `match` and then use `DiagnosticBuilder::new`. This then means a number of `DiagCtxt` functions are no longer needed, because this was the one place that used them. Note: the commit changes the treatment of spans for `Expect`, which was different to all the other cases, but this has no apparent effect.
2023-12-19rename to verbose-internalsjyn-2/+2
2023-12-19Add `EmitResult` associated type to `EmissionGuarantee`.Nicholas Nethercote-12/+15
This lets different error levels share the same return type from `emit_*`. - A lot of inconsistencies in the `DiagCtxt` API are removed. - `Noted` is removed. - `FatalAbort` is introduced for fatal errors (abort via `raise`), replacing the `EmissionGuarantee` impl for `!`. - `Bug` is renamed `BugAbort` (to avoid clashing with `Level::Bug` and to mirror `FatalAbort`), and modified to work in the new way with bug errors (abort via panic). - Various diagnostic creators and emitters updated to the new, better signatures. Note that `DiagCtxt::bug` no longer needs to call `panic_any`, because `emit` handles that. Also shorten the obnoxiously long `diagnostic_builder_emit_producing_guarantee` name.
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-4/+4
2023-12-18Rename many `EarlyDiagCtxt` arguments.Nicholas Nethercote-7/+7
2023-12-18Rename `EarlyDiagCtxt::handler` as `EarlyDiagCtxt::dcx`.Nicholas Nethercote-17/+14
2023-12-18Rename `UnstableOptions::diagnostic_handler_flags` as ↵Nicholas Nethercote-1/+1
`UnstableOptions::dcx_flags`.
2023-12-18Rename `ParseSess::with_span_handler` as `ParseSess::with_dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-42/+42
2023-12-18Rename `ParseSess::span_diagnostic` as `ParseSess::dcx`.Nicholas Nethercote-1/+1
2023-12-18Rename `EarlyErrorHandler` as `EarlyDiagCtxt`.Nicholas Nethercote-3/+3
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-9/+9
2023-12-14Rollup merge of #118933 - nnethercote:cleanup-errors-even-more, ↵Jubilee-1/+1
r=compiler-errors Cleanup errors handlers even more A sequel to #118587. r? `@compiler-errors`
2023-12-15Change `msg: impl Into<String>` for bug diagnostics.Nicholas Nethercote-1/+1
To `msg: impl Into<DiagnosticMessage>`, like all the other diagnostics. For consistency.
2023-12-13Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`.Lukasz Anforowicz-0/+8
The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/656
2023-12-081. fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before useoksbsb-11/+12
2. jobserver::initialize_checked should call before build_session, still should use EarlyErrorHandler, so revert stderr change in #118635
2023-12-07Auto merge of #118635 - nnethercote:fewer-early-errors, r=davidtwcobors-18/+19
Fewer early errors r? `@davidtwco`
2023-12-06Fewer early errors.Nicholas Nethercote-18/+19
`build_session` is passed an `EarlyErrorHandler` and then constructs a `Handler`. But the `EarlyErrorHandler` is still used for some time after that. This commit changes `build_session` so it consumes the passed `EarlyErrorHandler`, and also drops it as soon as the `Handler` is built. As a result, `parse_cfg` and `parse_check_cfg` now take a `Handler` instead of an `EarlyErrorHandler`.
2023-12-05Rollup merge of #118587 - nnethercote:cleanup-error-handlers-2, ↵Michael Goulet-1/+1
r=compiler-errors Cleanup error handlers some more A sequel to #118470. r? ```@compiler-errors```
2023-12-04Give `Handler::fatal` and `Session::fatal` the same return type.Nicholas Nethercote-1/+1
Currently, `Handler::fatal` returns `FatalError`. But `Session::fatal` returns `!`, because it calls `Handler::fatal` and then calls `raise` on the result. This inconsistency is unfortunate. This commit changes `Handler::fatal` to do the `raise` itself, changing its return type to `!`. This is safe because there are only two calls to `Handler::fatal`, one in `rustc_session` and one in `rustc_codegen_cranelift`, and they both call `raise` on the result. `HandlerInner::fatal` still returns `FatalError`, so I renamed it `fatal_no_raise` to emphasise the return type difference.
2023-12-03Auto merge of #113730 - belovdv:jobserver-init-check, r=petrochenkovbors-1/+16
Report errors in jobserver inherited through environment variables This pr attempts to catch situations, when jobserver exists, but is not being inherited. r? `@petrochenkov`
2023-12-02Remove unnecessary qualifiers.Nicholas Nethercote-3/+3
2023-12-02Use `Session::diagnostic` in more places.Nicholas Nethercote-1/+1
2023-12-02Rename `Handler::delay_good_path_bug` as `Handler::good_path_delayed_bug`.Nicholas Nethercote-3/+3
In line with the previous commits.
2023-12-02Rename `HandlerInner::delayed_span_bugs` as `HandlerInner::span_delayed_bugs`.Nicholas Nethercote-2/+2
For reasons similar to the previous commit.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-4/+8
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-12-02Rename `*note_without_error` as `*note`.Nicholas Nethercote-14/+7
Because the variant name in `Level` is `Note`, and the `without_error` suffix is omitted in similar cases like `struct_allow` and `struct_help`.
2023-12-02Return `ErrorGuaranteed` from `span_err_with_code` methods.Nicholas Nethercote-1/+1
`ErrorGuaranteed` should be used for all error methods involving the `Error` level, e.g. as is done for the corresponding `span_err` methods.
2023-12-01Auto merge of #118472 - nnethercote:rustc_session, r=bjorn3bors-14/+9
`rustc_session` cleanups r? `@bjorn3`
2023-12-01Clarify the `lockfile` field in `IncrCompSession`.Nicholas Nethercote-3/+6
2023-12-01Remove unused field from `IncrCompSession`.Nicholas Nethercote-9/+3
2023-12-01Reduce `pub` exposure.Nicholas Nethercote-5/+3
2023-11-30Add `-Zfunction-return={keep,thunk-extern}` optionMiguel Ojeda-1/+23
This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-29jobserver: check file descriptorsbelovdv-1/+16
2023-11-22rustc_session: implement latent TODOTamir Duberstein-4/+3
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`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-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-1/+15
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-13Remove `-Zperf-stats`.Nicholas Nethercote-44/+2
The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable. I think it has been well and truly subsumed by self-profiling, which collects way more data.
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-2/+2
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.