about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2022-09-21UPDATE - rename AddSubdiagnostic trait to AddToDiagnosticJhonny Bill Mena-4/+4
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-5/+79
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-0/+10
2022-09-17Rollup merge of #101790 - ↵Dylan DPC-0/+4
TaKO8Ki:do-not-suggest-placeholder-to-const-and-static-without-type, r=compiler-errors Do not suggest a placeholder to const and static without a type Fixes #101755
2022-09-16do not suggest a placeholder to const and static without a typeTakayuki Maeda-0/+4
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Compute `lint_levels` by definitionDeadbeef-3/+4
2022-09-13Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, ↵Matthias Krüger-1/+1
r=davidtwco translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final # Description This is the final part of the rustc_session https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883. Please only review this [commit](https://github.com/rust-lang/rust/pull/101266/commits/a54534703774bfb9fc344f61d511760a7c43fe94). The other ones are from the PR https://github.com/rust-lang/rust/pull/101041# that is not yet merged. In this PR, we migrate the file `output.rs`
2022-09-13Don't render inline suggestions of only spacesMichael Goulet-4/+1
2022-09-12Don't trim substitution if it's only whitespaceMichael Goulet-9/+19
2022-09-12A SubstitutionPart is not a deletion if it replaces nothing with nothingMichael Goulet-11/+10
2022-09-10rustc_error, rustc_private, rustc_ast: Switch to stable hash containersNiklas Jonsson-5/+4
2022-09-10translations(rustc_session): migrate output.rsLuis Cardoso-1/+1
2022-09-08Rollup merge of #101545 - TaKO8Ki:remove-unnecessary-partialord-ord, r=oli-obkDylan DPC-1/+1
Remove unnecessary `PartialOrd` and `Ord`
2022-09-08translations(rustc_session): migrates two diagnostics in session.rsLuis Cardoso-1/+4
2022-09-08translations(rustc_session): migrate TargetDataLayout::parseLuis Cardoso-0/+2
2022-09-08remove unnecessary `PartialOrd` and `Ord`Takayuki Maeda-1/+1
2022-09-07Use niche-filling optimization even when multiple variants have data.Michael Benfield-2/+2
Fixes #46213
2022-09-06Report number of delayed bugs properly with -Ztreat-err-as-bugMichael Goulet-17/+22
2022-09-03Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwcoDylan DPC-2/+10
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/+0
by module
2022-08-31Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillotMatthias Krüger-3/+3
Use more `into_iter` rather than `drain(..)` Clearer semantic.
2022-08-31respond to review feedback: mainly eliminate as many conversions as possible...Nathan Stocks-2/+10
- ... 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-31Rollup merge of #101100 - compiler-errors:generalize-call-suggestions, ↵Matthias Krüger-4/+15
r=petrochenkov Make call suggestions more general and more accurate Cleans up some suggestions that have to do with adding `()` to make typeck happy. 1. Drive-by rename of `expr_t` to `base_ty` since it's the type of the `base_expr` 1. Autoderef until we get to a callable type in `suggest_fn_call`. 1. Don't erroneously suggest calling constructor when a method/field does not exist on it. 1. Suggest calling a method receiver if its function output has a method (e.g. `fn.method()` => `fn().method()`) 1. Extend call suggestions to type parameters, fn pointers, trait objects where possible 1. Suggest calling in operators too (fixes #101054) 1. Use `/* {ty} */` as argument placeholder instead of just `_`, which is confusing and makes suggestions look less like `if let` syntax.
2022-08-31Rollup merge of #100970 - Xiretza:derive-multipart-suggestion, r=davidtwcoMatthias Krüger-12/+5
Allow deriving multipart suggestions This turned into a bit more of a rewrite than I was initially hoping for... Still, I think the `SessionSubdiagnostic` derive is a little cleaner overall now, and closer to the `SessionDiagnostic` derive to make future code sharing easier. r? ``@davidtwco``
2022-08-30Code deduplication in tool_only_multipart_suggestionXiretza-12/+5
2022-08-30Use more `into_iter` rather than `drain(..)`Donough Liu-3/+3
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-28Suggest calling when operator types mismatchMichael Goulet-4/+15
2022-08-24errors: `IntoDiagnosticArg` for `io::Error`/pathsDavid Wood-0/+14
Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-21Add Handler::struct_diagnostic()Xiretza-0/+39
This unifies the struct_{warn,error,fatal}() methods in one generic method.
2022-08-20Rollup merge of #99935 - CAD97:unstable-syntax-lints, r=petrochenkovMatthias Krüger-12/+63
Reenable disabled early syntax gates as future-incompatibility lints - MCP: https://github.com/rust-lang/compiler-team/issues/535 The approach taken by this PR is - Introduce a new lint, `unstable_syntax_pre_expansion`, and reenable the early syntax gates to emit it - Use the diagnostic stashing mechanism to stash warnings the early warnings - When the hard error occurs post expansion, steal and cancel the early warning - Don't display any stashed warnings if errors are present to avoid the same noise problem that hiding type ascription errors is avoiding Commits are working commits, but in a coherent steps-to-implement manner. Can be squashed if desired. The preexisting `soft_unstable` lint seems like it would've been a good fit, but it is deny-by-default (appropriate for `#[bench]`) and these gates should be introduced as warn-by-default. It may be desirable to change the stash mechanism's behavior to not flush lint errors in the presence of other errors either (like is done for warnings here), but upgrading a stash-using lint from warn to error perhaps is enough of a request to see the lint that they shouldn't be hidden; additionally, fixing the last error to get new errors thrown at you always feels bad, so if we know the lint errors are present, we should show them. Using a new flag/mechanism for a "weak diagnostic" which is suppressed by other errors may also be desirable over assuming any stashed warnings are "weak," but this is the first user of stashing warnings and seems an appropriate use of stashing (it follows the "know more later to refine the diagnostic" pattern; here we learn that it's in a compiled position) so we get to define what it means to stash a non-hard-error diagnostic. cc `````@petrochenkov````` (seconded MCP)
2022-08-19Rollup merge of #100081 - RalfJung:unused-unsafe-in-unsafe-fn, r=jackh726Dylan DPC-1/+1
never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn) Judging from https://github.com/rust-lang/rust/issues/71668#issuecomment-1200317370 the consensus nowadays seems to be that we should never consider an unsafe block unused if it was required with `deny(unsafe_op_in_unsafe_fn)`, no matter whether that lint is actually enabled or not. So let's adjust rustc accordingly. The first commit does the change, the 2nd does some cleanup.
2022-08-18Rollup merge of #100651 - nidnogg:diagnostics_migration_expand_transcribe, ↵Matthias Krüger-1/+2
r=davidtwco Migrations for rustc_expand transcribe.rs This PR includes some migrations to the new diagnostics API for the `rustc_expand` module. r? ```@davidtwco```
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-1/+2
slug name
2022-08-17Reenable early feature-gates as future-compat warningsChristopher Durham-0/+1
2022-08-17Don't treat stashed warnings as errorsChristopher Durham-12/+62
2022-08-17Rollup merge of #100379 - davidtwco:triagebot-diag, r=Mark-SimulacrumMatthias Krüger-126/+144
triagebot: add translation-related mention groups - Move some code around so that triagebot can ping relevant parties when translation logic is modified. - Add mention groups to triagebot for translation-related files/folders. - Auto-label pull requests with changes to translation-related files/folders with `A-translation`. r? `@Mark-Simulacrum`
2022-08-16Rollup merge of #100590 - TaKO8Ki:suggest-adding-array-length, r=compiler-errorsMatthias Krüger-0/+1
Suggest adding an array length if possible fixes #100448
2022-08-16suggest adding an array length if possibleTakayuki Maeda-0/+1
2022-08-15errors: move translation logic into moduleDavid Wood-126/+144
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-08-10errors: don't fail on broken primary translationsDavid Wood-32/+51
If a primary bundle doesn't contain a message then the fallback bundle is used. However, if the primary bundle's message is broken (e.g. it refers to a interpolated variable that the compiler isn't providing) then this would just result in a compiler panic. While there aren't any primary bundles right now, this is the type of issue that could come up once translation is further along. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-10Rollup merge of #99573 - tbodt:stabilize-backtrace, r=yaahcMatthias Krüger-1/+0
Stabilize backtrace This PR stabilizes the std::backtrace module. As of #99431, the std::Error::backtrace item has been removed, and so the rest of the backtrace feature is set to be stabilized. Previous discussion can be found in #72981, #3156. Stabilized API summary: ```rust pub mod std { pub mod backtrace { pub struct Backtrace { } pub enum BacktraceStatus { Unsupported, Disabled, Captured, } impl fmt::Debug for Backtrace {} impl Backtrace { pub fn capture() -> Backtrace; pub fn force_capture() -> Backtrace; pub const fn disabled() -> Backtrace; pub fn status(&self) -> BacktraceStatus; } impl fmt::Display for Backtrace {} } } ``` `@yaahc`
2022-08-07Rollup merge of #100071 - klensy:annotate-snippets-bump, r=Mark-SimulacrumMatthias Krüger-2/+6
deps: dedupe `annotate-snippets` crate versions Dedupes `annotate-snippets` crate versions (https://github.com/rust-lang/annotate-snippets-rs/blob/0.9.1/CHANGELOG.md). Should work, but there is not a lot of tests. Looks like switching to that crate a bit stalled.
2022-08-05move DiagnosticArgFromDisplay into rustc_errorsMichael Goulet-2/+22
2022-08-02Stabilize backtraceTheodore Dubois-1/+0
2022-08-02never consider unsafe blocks unused if they would be required with ↵Ralf Jung-1/+1
unsafe_op_in_unsafe_fn
2022-08-02dedupe 'annotate-snippets' crate versionsklensy-2/+6
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-1/+1
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.