about summary refs log tree commit diff
path: root/src/test/ui/error-codes
AgeCommit message (Collapse)AuthorLines
2021-10-09Show detailed expected/found types in error message when trait paths are the ↵rhysd-2/+2
same
2021-10-06Rollup merge of #89528 - FabianWolff:issue-89497, r=jackh726Manish Goregaokar-2/+3
Fix suggestion to borrow when casting from pointer to reference Fixes #89497.
2021-10-04Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebankJubilee-1/+1
Practice diagnostic message convention Detected by #89455. r? ```@estebank```
2021-10-04Fix suggestion to borrow when casting from pointer to referenceFabian Wolff-2/+3
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-1/+1
2021-10-02Consistently use 'supertrait'.Bruce Mitchener-2/+2
A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-09-30Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, ↵Manish Goregaokar-1/+4
r=estebank Suggest similarly named associated items in trait impls Fix #85942 Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-30Auto merge of #89386 - ehuss:rollup-idf4dmj, r=ehussbors-2/+2
Rollup of 13 pull requests Successful merges: - #87428 (Fix union keyword highlighting in rustdoc HTML sources) - #88412 (Remove ignore-tidy-undocumented-unsafe from core::slice::sort) - #89098 (Fix generics where bounds order) - #89232 (Improve help for recursion limit errors) - #89294 (:arrow_up: rust-analyzer) - #89297 (Remove Never variant from clean::Type enum) - #89311 (Add unit assignment to MIR for `asm!()`) - #89313 (PassWrapper: handle function rename from upstream D36850) - #89315 (Clarify that `CString::from_vec_unchecked` appends 0 byte.) - #89335 (Optimize is_sorted for Range and RangeInclusive) - #89366 (rustdoc: Remove lazy_static dependency) - #89377 (Update cargo) - #89378 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-29Rollup merge of #89232 - rossmacarthur:fix-76424, r=wesleywiserEric Huss-2/+2
Improve help for recursion limit errors - Tweak help message and suggested limit (handle `0` case). - Add test for #75602 (it was already fixed, maybe can be resolved too). Fixes #76424
2021-09-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-10/+10
Use larger span for adjustment THIR expressions Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-28Improve help for recursion limit errorsRoss MacArthur-2/+2
2021-09-29Suggest similarly named assoc items in trait implsHirochika Matsumoto-1/+4
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
2021-09-25Fix incorrect disambiguation suggestion for associated itemsFabian Wolff-4/+4
2021-09-25Use larger span for adjustments on method callsAaron Hill-10/+10
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-19Rollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisaYuki Okushi-17/+0
Allow simd_shuffle to accept vectors of any length cc ``@rust-lang/project-portable-simd`` ``@workingjubilee``
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-1/+3
Point at argument instead of call for their obligations When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled. Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`. When giving an error about an obligation introduced by a function call that an argument doesn't fulfill, and that argument is a block, add a span_label pointing at the innermost tail expression. Current output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:31 | 2 | let p = Some(45).and_then({ | ______________________--------_^ | | | | | required by a bound introduced by this call 3 | | |x| println!("doubling {}", x); 4 | | Some(x * 2) | | ----------- 5 | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Previous output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:22 | 2 | let p = Some(45).and_then({ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Partially address #27300. Will require rebasing on top of #88546.
2021-09-16Point at call span that introduced obligation for the argEsteban Kuber-1/+3
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-1/+1
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-6/+7
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-11Allow simd_shuffle to accept vectors of any lengthCaleb Zulawski-17/+0
2021-09-07A bit of cleanup to astconvjackh726-1/+1
2021-08-30`feature(const_param_types)` -> `feature(adt_const_params)`lcnr-5/+5
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-19/+7
2021-08-26Rollup merge of #88123 - camelid:tup-pat-precise-spans, r=estebankManish Goregaokar-13/+13
Make spans for tuple patterns in E0023 more precise As suggested in #86307. Closes #86307. r? ````@estebank````
2021-08-25Adjust spansNoah Lev-6/+6
* Highlight the whole pattern if it has no fields * Highlight the whole definition if it has no fields * Only highlight the pattern name if the pattern is multi-line * Determine whether a pattern is multi-line based on distance from name to last field, rather than first field
2021-08-23Detect incorrect number of lang item genericsasquared31415-3/+3
2021-08-22Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726Guillaume Gomez-2/+23
Show discriminant before overflow in diagnostic for duplicate values. This PR adds the value before overflow for explicit discriminant values in the error for duplicate discriminant values. I found it rather confusing to see only the overflowed value. It only does this for literals, since overflows in const evaluated arithmetic are already a hard error. This is my first PR to the compiler, so please let me know if the implementation can be improved :) Before: ![image](https://user-images.githubusercontent.com/786213/125850097-bf5fb7e0-d800-4386-a738-c30f41822964.png) After: ![image](https://user-images.githubusercontent.com/786213/125850120-e2bb765d-ad86-4888-a6cb-dec34fba3fea.png)
2021-08-21Make E0023 spans even more preciseNoah Lev-23/+13
2021-08-20Change example and tests for E0161.Anton Golov-56/+26
The code will not emit this warning once box expressions require a sized type (since that error is emitted earlier in the flow).
2021-08-18Use more accurate spans when proposing adding lifetime to itemEsteban Kuber-1/+1
2021-08-17Make spans for tuple patterns in E0023 more preciseNoah Lev-10/+20
As suggested in #86307.
2021-08-16Use note to point at bound introducing requirementEsteban Küber-12/+22
2021-08-15Fix ui tests for llvm_asm! deprecationAmanieu d'Antras-7/+12
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-6/+7
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-11Modify structured suggestion outputEsteban Küber-54/+55
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-09Use smaller spans when suggesting method call disambiguationEsteban Kuber-2/+2
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-3/+3
2021-07-28Show discriminant before overflow in diagnostic.Maarten de Vries-2/+23
2021-07-27Permit deriving default on enums with `#[default]`Jacob Pratt-19/+0
2021-07-20Support HIR wf checking for function signaturesAaron Hill-2/+2
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-5/+10
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-14bless mir-opt, codegen, and remaining ui testsRalf Jung-10/+4
2021-07-02Improve error reporting for modifications behind `&` referencesFabian Wolff-2/+2
2021-06-22Updated tests to reflect specified types in E0121Deadbeef-2/+2
2021-06-21Rollup merge of #83739 - JohnTitor:issue-75889, r=estebankYuki Okushi-2/+1
Account for bad placeholder errors on consts/statics with trait objects Fixes #75889 r? ``@estebank``
2021-06-10Auto merge of #82639 - jyn514:stable-options, r=Mark-Simulacrumbors-31/+3
Don't pass -Z unstable-options by default for UI tests Unconditionally passing -Z unstable-options makes it impossible to test whether an option requires unstable-options or not. This uncovered quite a lot of bugs, I'll open issues for each. These don't strictly need to be fixed before this is merged, it just makes the diff much larger because of the changes to diagnostics. - https://github.com/rust-lang/rust/issues/82636 - https://github.com/rust-lang/rust/issues/82637 - https://github.com/rust-lang/rust/issues/82638
2021-06-10Account for bad placeholder errors on consts/statics with trait objectsYuki Okushi-2/+1
2021-06-06Don't pass -Z unstable-options by default for UI testsJoshua Nelson-31/+3
- Pass it explicitly where appropriate - Update stderr files and warnings; it turns that unstable-options has far-reaching effects on diagnostics.
2021-06-05Remove `_` from E0121 diagnostic suggestionsDeadbeef-1/+1
2021-05-31Auto merge of #85597 - 0yoyoyo:fix-issue-71563-remove-redundant-args, ↵bors-5/+115
r=petrochenkov Fix span of redundant generic arguments Fixes #71563 Above issue is about lifetime arguments, but generic arguments also have same problem. This PR fixes both help messages.