about summary refs log tree commit diff
path: root/src/test/ui/rfc-2005-default-binding-mode
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-302/+0
2022-12-13Suggest `ref` for some patterns as a fallbackEsteban Küber-0/+5
2022-07-01Shorten def_span for more items.Camille GILLOT-1/+1
2022-05-06Resolve vars in note_type_errJack Huey-4/+4
2022-03-08Change wording of suggestion to add missing `match` armEsteban Kuber-1/+1
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-1/+1
Given ```rust match Some(42) {} ``` suggest ```rust match Some(42) { None | Some(_) => todo!(), } ```
2021-09-25Use larger span for adjustments on method callsAaron Hill-15/+1
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-07-02Improve error reporting for modifications behind `&` referencesFabian Wolff-12/+12
2020-09-15Stabilize move_ref_patternAmjad Alsharafi-3/+1
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+1
2020-03-07Rollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebankMazdak Farrokhzad-2/+2
resolve, inconsistent binding mode: tweak wording Now that we can have e.g. `let Ok(x) | Err(x) = res;`, it's no longer appropriate to refer to "the same *match arm*", so let's tweak the wording. r? @estebank
2020-03-06When encountering an Item in a pat context, point at the item defEsteban Küber-1/+8
2020-03-04resolve, inconsistent binding mode: tweak wording.Mazdak Farrokhzad-2/+2
2020-02-25check_pat_path: use pattern_causeMazdak Farrokhzad-0/+2
2020-02-25enhance check_pat_lit with TopInfoMazdak Farrokhzad-0/+4
2020-02-02move_ref_patterns: introduce testsMazdak Farrokhzad-15/+7
bindings_after_at: harden tests
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-3/+1
2019-12-23check_legality_of_move_bindings: generalize diagnostics & add commentsMazdak Farrokhzad-1/+1
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-10/+7
Specific labels when referring to "expected" and "found" types
2019-11-18Surround types with backticks in type errorsEsteban Küber-3/+3
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-4/+1
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-5/+5
2019-11-18Update ui testsGuillaume Gomez-0/+2
2019-07-28Use new 'p @ ..' syntax in tests.Mazdak Farrokhzad-1/+1
2019-06-03Update tests for changes to cannot move errorsMatthew Jasper-9/+4
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+14
2019-04-22Never stop due to errors before borrow checkingEsteban Küber-2/+18
2019-04-22update tests for migrate mode by defaultMatthew Jasper-76/+23
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-4/+0
2019-03-23Tweak spans for E0599Esteban Küber-3/+1
2019-03-11Update NLL testsVadim Petrochenkov-7/+7
2019-03-11Update testsVadim Petrochenkov-11/+11
2019-03-02Point at enum definition when match patterns are not exhaustiveEsteban Küber-0/+2
``` error[E0004]: non-exhaustive patterns: type `X` is non-empty --> file.rs:9:11 | 1 | / enum X { 2 | | A, | | - variant not covered 3 | | B, | | - variant not covered 4 | | C, | | - variant not covered 5 | | } | |_- `X` defined here ... 9 | match x { | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` and `C` not covered --> file.rs:11:11 | 1 | / enum X { 2 | | A, 3 | | B, 4 | | C, | | - not covered 5 | | } | |_- `X` defined here ... 11 | match x { | ^ patterns `C` not covered ``` When a match expression doesn't have patterns covering every variant, point at the enum's definition span. On a best effort basis, point at the variant(s) that are missing. This does not handle the case when the missing pattern is due to a field's enum variants: ``` enum E1 { A, B, C, } enum E2 { A(E1), B, } fn foo() { match E2::A(E1::A) { E2::A(E1::B) => {} E2::B => {} } //~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled } ``` Unify look between match with no arms and match with some missing patterns. Fix #37518.
2019-02-20Fix erroneous loop diagnostic in nllSantiago Pastorino-1/+1
This commit fixes the logic of detecting when a use happen in a later iteration of where a borrow was defined Fixes #53773
2018-12-26Fixed more tests.Alexander Regueiro-2/+4
2018-12-25Remove licensesMark Rousskov-111/+21
2018-10-03Clearer later use messages for callsMatthew Jasper-1/+1
Give a special message when the later use is from a call. Use the span of the callee instead of the whole expression. For conflicting borrow messages say that the later use is of the first borrow.
2018-09-28Test fixes for the change of error message for issue #54015Rusty Blitzerr-1/+1
2018-08-01Errors are more specific in cases where borrows are used in future ↵David Wood-1/+1
iterations of loops.
2018-07-12Factor out suggest_ref_mut; use it in rustc_borrowckashtneoi-12/+0
Also teach rustc_borrowck not to show useless help messages like "use a mutable reference instead: `x`".
2018-07-12span_suggestioncsmoe-6/+6
2018-07-12Don't try to suggest `ref mut` for implicit `ref`ashtneoi-6/+6
2018-06-19NLL: Updates to diagnostic output in `test/ui`.Felix S. Klock II-24/+12
2018-04-18Update the previously checkpointed (but unused by bors) tests to reflect ↵Felix S. Klock II-12/+24
current reality.
2018-04-11Checkpoint the current status of NLL on `ui` tests via compare-mode=nll.Felix S. Klock II-0/+56
2018-04-05make mem-categorization use adjusted type for patternsNiko Matsakis-0/+47
Fixes #49631
2018-03-28Stabilize match_default_bindingsTaylor Cramer-51/+12
This includes a submodule update to rustfmt in order to allow a stable feature declaration.
2018-03-20Stabilize slice patterns without `..`Vadim Petrochenkov-1/+1
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-14update testsGuillaume Gomez-9/+9