summary refs log tree commit diff
path: root/compiler/rustc_error_messages
AgeCommit message (Collapse)AuthorLines
2022-05-12typeck: port "no resolve overridden impl substs"David Wood-0/+2
Port "could not resolve substs on overridden impl" diagnostic to use the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12typeck: port "manual implementations"David Wood-0/+5
Port the "manual implementations of `X` are experimental" diagnostic to use the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12typeck: port "missing type params"David Wood-0/+22
Port the "the type parameter `T` must be explicitly specified" diagnostic to using a diagnostic struct. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12typeck: simplify error type using `()` fieldDavid Wood-3/+1
Using new support for spanless subdiagnostics from `()` fields in the diagnostic derive, simplify the "explicit generic args with impl trait" diagnostic's struct. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-10Auto merge of #96715 - cjgillot:trait-alias-loop, r=compiler-errorsbors-0/+1
Fortify handing of where bounds on trait & trait alias definitions Closes https://github.com/rust-lang/rust/issues/96664 Closes https://github.com/rust-lang/rust/issues/96665 Since https://github.com/rust-lang/rust/pull/93803, when listing all bounds and predicates we now need to account for the possible presence of predicates on any of the generic parameters. Both bugs were hidden by the special handling of bounds at the generic parameter declaration position. Trait alias expansion used to confuse predicates on `Self` and where predicates. Exiting too late when listing all the bounds caused a cycle error.
2022-05-09Point to the empty trait alias.Camille GILLOT-0/+1
2022-05-06typeck: port "explicit generic args w/ impl trait"David Wood-0/+8
Port the "explicit generic arguments with impl trait" diagnostic to using the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-06typeck: port "unconstrained opaque type" diagDavid Wood-0/+3
Port the "unconstrained opaque type" diagnostic to using the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: subdiagnostic deriveDavid Wood-0/+8
Add a new derive, `#[derive(SessionSubdiagnostic)]`, which enables deriving structs for labels, notes, helps and suggestions. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-26separate messages by a newlineChristian Poveda-0/+1
2022-04-25migrate ambiguous plus diagnosticChristian Poveda-0/+3
2022-04-19Rollup merge of #96029 - IsakNyberg:error-messages-fix, r=Dylan-DPCDylan DPC-8/+2
Refactor loop into iterator; simplify negation logic. is_dummy should return when a non-dummy is found, but instead is iterated until completion. With some inspiration from line 323 this was refactored to a single line that returns once a single counterexample is found.
2022-04-16Update compiler/rustc_error_messages/src/lib.rsIsak Nyberg-1/+1
Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2022-04-14Refactor loop into iterator; simplify negation logic.Isak Nyberg-8/+2
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-15/+32
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-12sess: try sysroot candidates for fluent bundleDavid Wood-30/+39
Instead of checking only the user provided sysroot or the default (when no sysroot is provided), search user provided sysroot and then check default sysroots for locale requested by the user. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-07Suggest replacing typeof(...) with an actual typeMaybe Waffle-0/+1
This commit suggests replacing typeof(...) with an actual type of "...", for example in case of `typeof(1)` we suggest replacing it with `i32`. If the expression - Is not const (`{ let a = 1; let _: typeof(a); }`) - Can't be found (`let _: typeof(this_variable_does_not_exist)`) - Or has non-suggestable type (closure, generator, error, etc) we don't suggest anything.
2022-04-05errors: support fluent + parallel compilerDavid Wood-3/+19
Conditional on the parallel compiler being enabled, use a different `IntlLangMemoizer` which supports being sent between threads in `FluentBundle`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: use `impl Into<FluentId>`David Wood-5/+2
`FluentId` is the type alias that is used everywhere else so it should be used here too so that this doesn't need updated if the alias changes. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05session: opt for enabling directionality markersDavid Wood-3/+6
Add an option for enabling and disabling Fluent's directionality isolation markers in output. Disabled by default as these can render in some terminals and applications. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: add links to fluent documentationDavid Wood-1/+5
Add some links to the Fluent documentation to `DiagnosticMessage::FluentIdentifier` which explain what a Fluent message and attribute are. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: don't try load default locale from sysrootDavid Wood-3/+9
If the user requests a diagnostic locale of "en-US" then it doesn't make sense to try and load that from the `$sysroot` because it is just the default built-in locale. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05macros: translatable struct attrs and warningsDavid Wood-1/+86
Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: disable directionality isolation markersDavid Wood-0/+9
Fluent diagnostics can insert directionality isolation markers around interpolated variables indicating that there may be a shift from right-to-left to left-to-right text (or vice-versa). These are disabled because they are sometimes visible in the error output, but may be worth investigating in future (for example: if type names are left-to-right and the surrounding diagnostic messages are right-to-left, then these might be helpful). Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement sysroot/testing bundle loadingDavid Wood-12/+158
Extend loading of Fluent bundles so that bundles can be loaded from the sysroot based on the language requested by the user, or using a nightly flag. Sysroot bundles are loaded from `$sysroot/share/locale/$locale/*.ftl`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05errors: implement fallback diagnostic translationDavid Wood-17/+63
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-04-05span: move `MultiSpan`David Wood-0/+183
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>