about summary refs log tree commit diff
path: root/tests/ui/error-codes
AgeCommit message (Collapse)AuthorLines
2023-12-15Collect lang items from ASTMichael Goulet-2/+2
2023-12-14update use of feature flagslcnr-1/+1
2023-12-10Remove edition umbrella features.Eric Huss-19/+0
2023-12-07Resolve assoc item bindings by namespaceLeón Orell Valerian Liehr-1/+1
If a const is expected, resolve a const. If a type is expected, resolve a type. Don't try to resolve a type first falling back to consts.
2023-12-05Add print_trait_sugaredMichael Goulet-1/+1
2023-11-30Enable link-arg link kind inside of #[link] attributezetanumbers-1/+1
- Implement link-arg as an attribute - Apply suggestions from review - Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> - Add unstable book entry
2023-11-24Auto merge of #118138 - Nilstrieb:one-previous-error, r=WaffleLapkinbors-194/+194
Fixes error count display is different when there's only one error left Supersedes #114759 ### What did I do? I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace. All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759. ### how to review this nightmare ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly. Thank you `@adrianEffe` for bringing this up and your initial implementation. cc `@flip1995,` you said you want to do a subtree sync asap cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri r? `@WaffleLapkin`
2023-11-24Show number in error message even for one errorNilstrieb-194/+194
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-23fix intercrate ambiguity causeslcnr-4/+37
2023-11-16recover primary span labelEsteban Küber-4/+4
2023-11-16Suggest `unwrap()` on field not found for `Result`/`Option`Esteban Küber-1/+6
When encountering a `Result<T, _>` or `Option<T>` where `T` has a field that's being accessed, suggest calling `.unwrap()` to get to the field.
2023-11-16Suggest field typo through derefsEsteban Küber-4/+4
Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-04Rollup merge of #117343 - Nadrieril:cleanup_check_match, r=davidtwcoTakayuki Maeda-3/+3
Cleanup `rustc_mir_build/../check_match.rs` The file had become pretty unwieldy, with a fair amount of duplication. As a bonus, I discovered that we weren't running some pattern checks in if-let chains. I recommend looking commit-by-commit. The last commit is a whim, I think it makes more sense that way but I don't hold this opinion strongly.
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-16/+0
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-11-03Tweak spans for "adt defined here" noteNadrieril-3/+3
2023-10-30Detect object safety errors when assoc type is missingEsteban Küber-5/+5
When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
2023-10-24Use `PlaceMention` for match scrutinees.Camille GILLOT-2/+24
2023-10-21Rollup merge of #116992 - estebank:issue-69492, r=oli-obkMatthias Krüger-0/+1
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-21Mention the syntax for `use` on `mod foo;` if `foo` doesn't existEsteban Küber-0/+1
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-10-20s/Generator/Coroutine/Oli Scherer-7/+7
2023-10-17Unify suggestion wordingEsteban Küber-7/+5
2023-10-15don't UB on dangling ptr deref, instead check inbounds on projectionsRalf Jung-1/+1
2023-10-11Auto merge of #116623 - Nadrieril:validate-range-endpoints, r=oli-obkbors-2/+2
Fix overflow checking in range patterns When a range pattern contains an overflowing literal, if we're not careful we might not notice the overflow and use the wrapped value. This makes for confusing error messages because linting against overflowing literals is only done in a later pass. So when a range is invalid we check for overflows to provide a better error. This check didn't use to handle negative types; this PR fixes that. First commit adds tests, second cleans up without changing behavior, third does the fix. EDIT: while I was at it, I fixed a small annoyance about the span of the overflow lint on negated literals. Fixes https://github.com/rust-lang/rust/issues/94239
2023-10-11Fix range overflow checkingNadrieril-2/+2
2023-10-09Auto merge of #116497 - compiler-errors:impl-span, r=cjgillotbors-5/+6
Extend `impl`'s `def_span` to include its where clauses Typically, we highlight the def-span of an impl in a diagnostic due to either: 1. coherence error 2. trait evaluation cycle 3. invalid implementation of built-in trait I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses. r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
2023-10-09Extend impl's def_span to include where clausesMichael Goulet-5/+6
2023-10-08remove trailing dotsAli MJ Al-Nasrawy-1/+1
2023-10-08always show and explain sub regionAli MJ Al-Nasrawy-11/+3
2023-10-08improve the suggestion of generic_bound_failureAli MJ Al-Nasrawy-3/+3
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-8/+14
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+14
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-44/+16
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-10-04Show more information when multiple `impl` applyEsteban Küber-2/+36
2023-09-29Auto merge of #115821 - obeis:hir-analysis-migrate-diagnostics-5, ↵bors-2/+6
r=compiler-errors Migrate `rustc_hir_analysis` to session diagnostic [Part 5] Finishing `coherence/builtin.rs` file
2023-09-26Rollup merge of #116162 - fmease:gate-n-validate-rustc_safe_intrinsic, ↵Matthias Krüger-1/+1
r=Nilstrieb Gate and validate `#[rustc_safe_intrinsic]` Copied over from #116159: > This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature. > > I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable.. r? ``@Nilstrieb``
2023-09-25Gate and validate #[rustc_safe_intrinsic]León Orell Valerian Liehr-1/+1
2023-09-22Rollup merge of #116062 - eduardosm:start-fn-diag, r=WaffleLapkinMatthias Krüger-4/+4
Change `start` to `#[start]` in some diagnosis They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obkbors-1/+1
adjust how closure/generator types are printed I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
2023-09-22Change `start` to `#[start]` in some diagnosisEduardo Sánchez Muñoz-4/+4
They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-1/+1
2023-09-20Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-2/+6
Part 5: Finishing `coherence/builtin.rs` file
2023-09-19rustc_hir_analysis: add a helper to check function the signature mismatchesEduardo Sánchez Muñoz-4/+4
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-18Migrate 'cast to bool' diagnosticclubby789-1/+6
2023-09-15Migrate 'explicit destructor call' diagnosticclubby789-4/+6
2023-09-12Rollup merge of #115765 - asquared31415:cast_diag, r=WaffleLapkinMatthias Krüger-1/+1
Add source type for invalid bool casts Also adds tests for casting various types to `bool` that were otherwise untested. r? `@WaffleLapkin`
2023-09-11add source type for invalid bool castsasquared31415-1/+1
2023-09-11Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errorsMatthias Krüger-11/+11
Improve diagnostic for generic params from outer items (E0401) Generalize the wording of E0401 to talk about *outer items* instead of *outer functions* since the current phrasing is outdated. The outer item can be a function, constant, trait, ADT or impl block (see the new UI test for the more exotic examples). Further, don't suggest introducing generic parameters to constant items unless the feature `generic_const_items` is enabled. Lastly, make E0401 translatable while we're at it. Fixes #115720.
2023-09-11Rollup merge of #115743 - compiler-errors:no-impls, r=davidtwcoMatthias Krüger-0/+5
Point out if a local trait has no implementations Slightly helps with #115741
2023-09-11Auto merge of #115387 - weihanglo:merge-check-and-lint, r=oli-obkbors-3/+10
Make unknown/renamed/removed lints passed via command line respect lint levels
2023-09-10Point out if a local trait has no implementationsMichael Goulet-0/+5