summary refs log tree commit diff
path: root/src/test/ui/error-codes
AgeCommit message (Collapse)AuthorLines
2022-06-07Remove arg_matrix.rs, bless testsMichael Goulet-37/+15
2022-05-06Resolve vars in note_type_errJack Huey-13/+0
2022-05-06Point at closure args tooJack Huey-0/+10
2022-05-06Auto merge of #96268 - ↵bors-2/+2
jackh726:remove-mutable_borrow_reservation_conflict-lint, r=nikomatsakis Remove mutable_borrow_reservation_conflict lint and allow the code pattern This was the only breaking issue with the NLL stabilization PR. Lang team decided to go ahead and allow this. r? `@nikomatsakis` Closes #59159 Closes #56254
2022-04-30Auto merge of #96347 - estebank:issue-96292, r=compiler-errorsbors-1/+4
Erase type params when suggesting fully qualified path When suggesting the use of a fully qualified path for a method call that is ambiguous because it has multiple candidates, erase type params in the resulting code, as they would result in an error when applied. We replace them with `_` in the output to rely on inference. There might be cases where this still produces slighlty incomplete suggestions, but it otherwise produces many more errors in relatively common cases. Fix #96292
2022-04-29Bless tests.Camille GILLOT-8/+8
2022-04-26Revert "add `DefId` to unsafety violations and display function path in E0133"Oli Scherer-1/+1
This reverts commit 8b8f6653cfd54525714f02efe7af0a0f830e185c.
2022-04-24only show a simple description in E0133 span labelEmil Gardström-2/+2
2022-04-24add `DefId` to unsafety violations and display function path in E0133Emil Gardström-4/+4
this enables consumers to access the function definition that was reported to be unsafe
2022-04-23Use more targetted suggestion span for fully qualified pathEsteban Küber-1/+4
2022-04-21make `E0117` error clearTakayuki Maeda-1/+1
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-2/+2
2022-04-17show suggestion to replace generic bounds with associated types in more casesRobin Appelman-1/+27
2022-04-16Implementation for 65853Jack Huey-19/+28
This attempts to bring better error messages to invalid method calls, by applying some heuristics to identify common mistakes. The algorithm is inspired by Levenshtein distance and longest common sub-sequence. In essence, we treat the types of the function, and the types of the arguments you provided as two "words" and compute the edits to get from one to the other. We then modify that algorithm to detect 4 cases: - A function input is missing - An extra argument was provided - The type of an argument is straight up invalid - Two arguments have been swapped - A subset of the arguments have been shuffled (We detect the last two as separate cases so that we can detect two swaps, instead of 4 parameters permuted.) It helps to understand this argument by paying special attention to terminology: "inputs" refers to the inputs being *expected* by the function, and "arguments" refers to what has been provided at the call site. The basic sketch of the algorithm is as follows: - Construct a boolean grid, with a row for each argument, and a column for each input. The cell [i, j] is true if the i'th argument could satisfy the j'th input. - If we find an argument that could satisfy no inputs, provided for an input that can't be satisfied by any other argument, we consider this an "invalid type". - Extra arguments are those that can't satisfy any input, provided for an input that *could* be satisfied by another argument. - Missing inputs are inputs that can't be satisfied by any argument, where the provided argument could satisfy another input - Swapped / Permuted arguments are identified with a cycle detection algorithm. As each issue is found, we remove the relevant inputs / arguments and check for more issues. If we find no issues, we match up any "valid" arguments, and start again. Note that there's a lot of extra complexity: - We try to stay efficient on the happy path, only computing the diagonal until we find a problem, and then filling in the rest of the matrix. - Closure arguments are wrapped in a tuple and need to be unwrapped - We need to resolve closure types after the rest, to allow the most specific type constraints - We need to handle imported C functions that might be variadic in their inputs. I tried to document a lot of this in comments in the code and keep the naming clear.
2022-04-10--bless testsMaybe Waffle-0/+5
2022-04-05Rollup merge of #95525 - ohno418:suggest-derivable-trait-E0277, ↵Dylan DPC-0/+30
r=compiler-errors Suggest derivable trait on E0277 error Closes https://github.com/rust-lang/rust/issues/95099 .
2022-04-05macros: support translatable labelsDavid Wood-1/+1
Extends support for generating `DiagnosticMessage::FluentIdentifier` messages from `SessionDiagnostic` derive to `#[label]`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05Suggest derivable trait on E0277ohno418-0/+30
2022-03-30rework error messages for incorrect inherent implslcnr-4/+20
2022-03-30fix behavior for empty implslcnr-1/+1
2022-03-30update ui testslcnr-43/+4
2022-03-22interpret/memory: simplify check_and_deref_ptrRalf Jung-1/+1
2022-03-21move `adt_const_params` to its own tracking issuelcnr-1/+1
2022-03-09Rollup merge of #94739 - estebank:suggest-let-else, r=oli-obkMatthias Krüger-2/+6
Suggest `if let`/`let_else` for refutable pat in `let` r? `````@oli-obk`````
2022-03-09Auto merge of #94515 - estebank:tweak-move-error, r=davidtwcobors-1/+10
Tweak move error Point at method definition that causes type to be consumed. Fix #94056.
2022-03-08Suggest `if let`/`let_else` for refutable pat in `let`Esteban Kuber-2/+6
2022-03-08Change wording of suggestion to add missing `match` armEsteban Kuber-2/+2
2022-03-08Point at uncovered variants in enum definition in `note` instead of a ↵Esteban Kuber-25/+47
`span_label` This makes the order of the output always consistent: 1. Place of the `match` missing arms 2. The `enum` definition span 3. The structured suggestion to add a fallthrough arm
2022-03-08When finding a match expr with a single arm that requires more, suggest itEsteban Kuber-1/+5
Given ```rust match Some(42) { Some(0) => {} } ``` suggest ```rust match Some(42) { Some(0) => {} None | Some(_) => todo!(), } ```
2022-03-08When encountering a match expr with no arms, suggest itEsteban Kuber-2/+7
Given ```rust match Some(42) {} ``` suggest ```rust match Some(42) { None | Some(_) => todo!(), } ```
2022-03-03Tweak move errorEsteban Kuber-1/+10
Point at method definition that causes type to be consumed. Fix #94056.
2022-02-24Remove in-band lifetimesMichael Goulet-4/+0
2022-02-06Rollup merge of #91939 - GKFX:feature-91866, r=cjgillotMatthias Krüger-0/+6
Clarify error on casting larger integers to char Closes #91836 with changes to E0604.md and a `span_help`.
2022-01-25#91939: integer to char cast error, make more targetedGeorge Bateman-0/+6
2022-01-18generic_arg_infer: placeholder in signature errlcnr-2/+2
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-112/+0
2021-12-28docs(error-codes): Add long error explanation for E0227TmLev-0/+21
2021-12-11Tweak assoc type obligation spansEsteban Kuber-1/+6
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-11-30Remove all migrate.nll.stderr filesLucas Kent-6/+9
2021-11-25On type mismatch caused by assignment, point at assigneeEsteban Küber-10/+2
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-10/+0
2021-11-20Point at bounds when comparing impl items to traitEsteban Kuber-2/+2
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-5/+5
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-20Rollup merge of #90628 - ↵Matthias Krüger-3/+3
ken-matsui:clarify-error-messages-caused-by-reexporting-pub-crate-visibility-to-outside, r=oli-obk Clarify error messages caused by re-exporting `pub(crate)` visibility to outside This PR clarifies error messages and suggestions caused by re-exporting pub(crate) visibility outside the crate. Here is a small example ([Rust Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e2cd0bd4422d4f20e6522dcbad167d3b)): ```rust mod m { pub(crate) enum E {} } pub use m::E; fn main() {} ``` This code is compiled to: ``` error[E0365]: `E` is private, and cannot be re-exported --> prog.rs:4:9 | 4 | pub use m::E; | ^^^^ re-export of private `E` | = note: consider declaring type or module `E` with `pub` error: aborting due to previous error For more information about this error, try `rustc --explain E0365`. ``` However, enum `E` is actually public to the crate, not private totally—nevertheless, rustc treats `pub(crate)` and private visibility as the same on the error messages. They are not clear and should be segmented distinctly. By applying changes in this PR, the error message below will be the following message that would be clearer: ``` error[E0365]: `E` is only public to inside of the crate, and cannot be re-exported outside --> prog.rs:4:9 | 4 | pub use m::E; | ^^^^ re-export of crate public `E` | = note: consider declaring type or module `E` with `pub` error: aborting due to previous error For more information about this error, try `rustc --explain E0365`. ```
2021-11-20Clarify error messages caused by re-exporting `pub(crate)` visibility to outsideKen Matsui-3/+3
2021-11-19Rollup merge of #90961 - estebank:suggest-removal-of-call, r=nagisaYuki Okushi-2/+3
Suggest removal of arguments for unit variant, not replacement
2021-11-16Suggest removal of arguments for unit variant, not replacementEsteban Kuber-2/+3
2021-11-13Auto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obkbors-21/+19
Stabilize `const_raw_ptr_deref` for `*const T` This stabilizes dereferencing immutable raw pointers in const contexts. It does not stabilize `*mut T` dereferencing. This is behind the same feature gate as mutable references. closes https://github.com/rust-lang/rust/issues/51911
2021-11-10no overlap errors after failing the orphan checklcnr-34/+10
2021-11-08impl Copy/Clone for arrays in std, not in compilerbstrie-27/+3