about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2022-09-29Remove from compiler/ cratesreez12g-1/+0
2022-09-28Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwcobors-0/+22
Migrate more of rustc_parse to SessionDiagnostic Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-28Auto merge of #102302 - nnethercote:more-lexer-improvements, r=matkladbors-1/+2
More lexer improvements A follow-up to #99884. r? `@matklad`
2022-09-27Flush delayed bugs before codegenNilstrieb-0/+6
Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem.
2022-09-27Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)Xiretza-0/+12
2022-09-27Implement IntoDiagnosticArg for rustc_ast::PathXiretza-0/+10
2022-09-26remove cfg(bootstrap)Pietro Albini-2/+1
2022-09-26Rearrange `TokenTreesReader::parse_token_tree`.Nicholas Nethercote-1/+2
`parse_token_tree` is basically a match with four arms: `Eof`, `OpenDelim`, `CloseDelim`, and "other". It has two call sites, and at each call site one of the arms is unreachable. It's also not inlined. This commit removes `parse_token_tree` by splitting it into four functions and inlining them. This avoids some repeated conditional tests and also some non-inlined function calls on the hot path.
2022-09-24rebase and update trait namesEllis Hoag-0/+13
2022-09-24remove IntoDiagnosticArg impl for OptionEllis Hoag-9/+0
2022-09-24Add RanlibFailureEllis Hoag-0/+9
2022-09-22Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"Camille GILLOT-4/+3
This reverts commit 2cb9a65684dba47c52de8fa938febf97a73e70a9, reversing changes made to 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-44/+4
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-4/+5
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-2/+2
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