about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2022-12-06Simplify some nested conditionsOli Scherer-10/+3
2022-12-04Rollup merge of #101975 - chenyukang:fix-101749, r=compiler-errorsMatthias Krüger-0/+1
Suggest to use . instead of :: when accessing a method of an object Fixes #101749 Fixes #101542
2022-12-03fix #101749, use . instead of :: when accessing a method of an objectyukang-0/+1
2022-12-01Remove useless borrows and derefsMaybe Waffle-22/+22
2022-11-28Tweak outputEsteban Küber-1/+1
2022-11-28Change multiline span ASCII art visual orderEsteban Küber-1/+7
2022-11-24Rollup merge of #104780 - BoxyUwU:error_reported_not_be_bad, r=oli-obkMatthias Krüger-3/+18
make `error_reported` check for delayed bugs Fixes #104768 `error_reported()` was only checking if there were errors emitted, not for `delay_bug`s which can also be a source of `ErrorGuaranteed`. I assume the same is true of `lint_err_count` but i dont know
2022-11-24make `error_reported` check for delayed bugsBoxy-3/+18
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-1/+1
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
2022-11-20Rollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebankMatthias Krüger-0/+3
Add a detailed note for missing comma typo w/ FRU syntax Thanks to `@pierwill` for working on this with me! Fixes #104373, perhaps `@alice-i-cecile` can comment on the new error for the example provided on that issue -- feedback is welcome. ``` error[E0063]: missing field `defaulted` in initializer of `Outer` --> $DIR/multi-line-fru-suggestion.rs:14:5 | LL | Outer { | ^^^^^ missing `defaulted` | note: this expression may have been misinterpreted as a `..` range expression --> $DIR/multi-line-fru-suggestion.rs:16:16 | LL | inner: Inner { | ________________^ LL | | a: 1, LL | | b: 2, LL | | } | |_________^ this expression does not end in a comma... LL | ..Default::default() | ^^^^^^^^^^^^^^^^^^^^ ... so this is interpreted as a `..` range expression, instead of functional record update syntax help: to set the remaining fields from `Default::default()`, separate the last named field with a comma | LL | }, | + error: aborting due to previous error For more information about this error, try `rustc --explain E0063`. ```
2022-11-19Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholkMatthias Krüger-4/+4
Use `IsTerminal` in place of `atty` In any crate that can use nightly features, use `IsTerminal` rather than `atty`: - Use `IsTerminal` in `rustc_errors` - Use `IsTerminal` in `rustc_driver` - Use `IsTerminal` in `rustc_log` - Use `IsTerminal` in `librustdoc`
2022-11-18Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearthbors-20/+15
Rollup of 8 pull requests Successful merges: - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`) - #103378 (Fix mod_inv termination for the last iteration) - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS) - #103701 (Simplify some pointer method implementations) - #104047 (Diagnostics `icu4x` based list formatting.) - #104338 (Enforce that `dyn*` coercions are actually pointer-sized) - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`) - #104556 (rustdoc: use `code-header` class to format enum variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Rollup merge of #104498 - pierwill:stash-diag-docs, r=compiler-errorsManish Goregaokar-2/+3
Edit docs for `rustc_errors::Handler::stash_diagnostic` Clarify that the diagnostic can be retrieved with `steal_diagnostic`. r? ```@compiler-errors```
2022-11-18Fix compilation issue after rebaseCharles Lew-0/+3
2022-11-18Enable icu sync feature for parallel compilerCharles Lew-0/+3
2022-11-18Migrate diagnostics list output to use icu list formatter.Charles Lew-18/+6
2022-11-18Add a detailed note for missing comma in FRU syntax typoMichael Goulet-0/+3
2022-11-18Rollup merge of #101162 - rajputrajat:master, r=davidtwcoMatthias Krüger-0/+6
Migrate rustc_resolve to use SessionDiagnostic, part # 1 crate a somewhat on larger size, so plz allow some time to get it finished.
2022-11-17Edit docs for `rustc_errors::Handler::stash_diagnostic`pierwill-2/+3
Clarify that the diagnostic can be retrieved with `steal_diagnostic`.
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-1/+1
2022-11-14Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwcoMatthias Krüger-0/+4
Don't print full paths in overlap errors We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message. r? diagnostics
2022-11-14Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbinibors-4/+2
Bump bootstrap compiler to 1.66 This PR: - Bumps version placeholders to release - Bumps to latest beta - cfg-steps code r? `@pietroalbini`
2022-11-13migrating rustc_resolve to SessionDiagnostic. work in progress. startRajput, Rajat-0/+6
implement binding_shadows migrate till self-in-generic-param-default use braces in fluent message as suggested by @compiler-errors. to fix lock file issue reported by CI migrate 'unreachable label' error run formatter name the variables correctly in fluent file SessionDiagnostic -> Diagnostic test "pattern/pat-tuple-field-count-cross.rs" passed test "resolve/bad-env-capture2.rs" passed test "enum/enum-in-scope.rs" and other depended on "resolve_binding_shadows_something_unacceptable" should be passed now. fix crash errors while running test-suite. there might be more. then_some(..) suits better here. all tests passed convert TraitImpl and InvalidAsm. TraitImpl is buggy yet. will fix after receiving help from Zulip migrate "Ralative-2018" migrate "ancestor only" migrate "expected found" migrate "Indeterminate" migrate "module only" revert to the older implementation for now. since this is failing at the moment. follow the convension for fluent variable order the diag attribute as suggested in review comment fix merge error. migrate trait-impl-duplicate make the changes compatible with "Flatten diagnostic slug modules #103345" fix merge remove commented code merge issues fix review comments fix tests
2022-11-12Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebankDylan DPC-21/+40
Unhide unknown spans r? ```@estebank```
2022-11-11Rollup merge of #104217 - Nilstrieb:funny-dollar-syntax, r=TaKO8KiDylan DPC-9/+29
Display help message when fluent arg was referenced incorrectly The fluent argument syntax is a little special and easy to get wrong, so we emit a small help message when someone gets it wrong. Example: ``` parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}` ``` panics with ``` thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter` help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead attr: `None` args: `FluentArgs([("delimiter", String("}"))])` errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21 ``` fixes #103539
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-12/+35
2022-11-11Remove some redundant argumentsOli Scherer-9/+5
2022-11-09Rollup merge of #102763 - compiler-errors:nits, r=cjgillotMichael Goulet-7/+7
Some diagnostic-related nits 1. Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` 2. Make `diag.span_suggestions` take an `IntoIterator` instead of `Iterator`, just to remove some `.into_iter` calls on the caller. idk if I should add a lint to make sure people use `&mut Diagnostic` instead of `&mut DiagnosticBuilder<'_, T>` in cases where we're just, e.g., adding subdiagnostics to the diagnostic... maybe a followup.
2022-11-10Don't print full paths in overlap errorsMichael Goulet-0/+4
2022-11-09Display help message when fluent arg was referenced incorrectlyNilstrieb-9/+29
The fluent argument syntax is a little special and easy to get wrong, so we emit a small help message when someone gets it wrong. Example: ``` parser_mismatched_closing_delimiter = mismatched closing delimiter: `${delimiter}` ``` panics with ``` thread 'rustc' panicked at 'Encountered errors while formatting message for `parser_mismatched_closing_delimiter` help: Argument `delimiter` exists but was not referenced correctly. Try using `{$delimiter}` instead attr: `None` args: `FluentArgs([("delimiter", String("}"))])` errors: `[ResolverError(Reference(Message { id: "delimiter", attribute: None }))]`', compiler/rustc_errors/src/translation.rs:123:21 ```
2022-11-09rebase conflictMichael Goulet-2/+2
2022-11-09Make span_suggestions take IntoIteratorMichael Goulet-5/+5
2022-11-09Add missing `emitted_at` to the `Diagnostic`SLASHLogin-0/+1
2022-11-09Add constructor for `Diagnostic` that takes `Vec<(DiagnosticMessage, Style)>`SLASHLogin-0/+15
2022-11-09FormattingSLASHLogin-1/+4
2022-11-09Add `replace_args` method for `rustc_errors::diagnostic::Diagnostic`SLASHLogin-0/+4
2022-11-09Delay diagnostic translation in `rustc_codegen_ssa`SLASHLogin-0/+9
2022-11-09Port `DlltoolFailImportLibrary` and implement `IntoDiagnosticArg` for ↵SLASHLogin-0/+6
`Cow<'a, str>`
2022-11-08add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'yukang-2/+2
2022-11-06cfg-step codeMark Rousskov-4/+2
2022-11-04Rollup merge of #103792 - ↵Matthias Krüger-1/+4
JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt2, r=davidtwco Migrate `codegen_ssa` to diagnostics structs - [Part 2] Completes migrating `link.rs` in `codegen_ssa` module. _Part 1 - https://github.com/rust-lang/rust/pull/102612_ r? `@davidtwco`
2022-11-04Rollup merge of #103397 - crlf0710:port_dead_code_lint, r=davidtwcoMatthias Krüger-1/+33
Port `dead_code` lints to be translatable. This adds an additional comma to lists with three or more items, to be consistent with list formatters like `icu4x`. r? `@davidtwco`
2022-11-04UPDATE - accept dyn error and make Box<dyn error> conform to IntoDiagnosticArgJhonny Bill Mena-0/+1
2022-11-04UPDATE - Complete link.rs migration to new diagnostics infraestructureJhonny Bill Mena-1/+3
2022-11-01Auto merge of #103217 - mejrs:track, r=eholkbors-5/+106
Track where diagnostics were created. This implements the `-Ztrack-diagnostics` flag, which uses `#[track_caller]` to track where diagnostics are created. It is meant as a debugging tool much like `-Ztreat-err-as-bug`. For example, the following code... ```rust struct A; struct B; fn main(){ let _: A = B; } ``` ...now emits the following error message: ``` error[E0308]: mismatched types --> src\main.rs:5:16 | 5 | let _: A = B; | - ^ expected struct `A`, found struct `B` | | | expected due to this -Ztrack-diagnostics: created at compiler\rustc_infer\src\infer\error_reporting\mod.rs:2275:31 ```
2022-10-31Add more track_callermejrs-2/+4
2022-10-24Address some commentsmejrs-2/+2
2022-10-24Port `dead_code` lints to be translatable.Charles Lew-1/+33
2022-10-23Allow specifying multiple alternative suggestionsXiretza-3/+23
This allows porting uses of span_suggestions() to diagnostic structs. Doesn't work for multipart_suggestions() because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while multipart_suggestions() creates multiple possible replacements, each with multiple spans.
2022-10-23Auto merge of #103431 - Dylan-DPC:rollup-oozfo89, r=Dylan-DPCbors-0/+3
Rollup of 6 pull requests Successful merges: - #101293 (Recover when unclosed char literal is parsed as a lifetime in some positions) - #101908 (Suggest let for assignment, and some code refactor) - #103192 (rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`) - #103226 (Check `needs_infer` before `needs_drop` during HIR generator analysis) - #103249 (resolve: Revert "Set effective visibilities for imports more precisely") - #103305 (Move some tests to more reasonable places) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup