about summary refs log tree commit diff
path: root/src/test/ui/span/borrowck-object-mutability.stderr
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-25/+0
2023-01-01Verbose suggestionsEsteban Küber-3/+5
2022-12-28Use verbose suggestions for mutability errorsEsteban Küber-3/+5
2021-09-25Use larger span for adjustments on method callsAaron Hill-2/+2
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.
2019-05-29Update ui test suite to use dynmemoryruins-3/+3
2019-04-22update tests for migrate mode by defaultMatthew Jasper-5/+5
2019-03-11Update testsVadim Petrochenkov-2/+2
2018-12-25Remove licensesMark Rousskov-2/+2
2018-09-12use structured suggestion for "missing mut" labelAndy Russell-1/+1
Fixes #54133.
2018-03-14update testsGuillaume Gomez-1/+1
2018-02-26Update UI testsVadim Petrochenkov-2/+2
2018-02-26Update UI testsVadim Petrochenkov-4/+4
2018-02-25Update ui testsGuillaume Gomez-0/+1
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-1/+1
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-05-27Add new error codes and update testsGuillaume Gomez-2/+2
2017-05-24Change error count messagesMichael Kohl-1/+1
See #33525 for details.
2017-03-27borrowck: consolidate `mut` suggestionsAriel Ben-Yehuda-0/+3
This converts all of borrowck's `mut` suggestions to a new `mc::ImmutabilityBlame` API instead of the current mix of various hacks. Fixes #35937. Fixes #40823.
2017-01-26Point to immutable arg/fields when trying to use as &mutEsteban Küber-2/+2
Point to immutable borrow arguments and fields when trying to use them as mutable borrows. Add label to primary span on "cannot borrow as mutable" errors. Present the following output when trying to access an immutable borrow's field as mutable: ``` error[E0389]: cannot borrow data mutably in a `&` reference --> $DIR/issue-38147-1.rs:27:9 | 26 | fn f(&self) { | ----- use `&mut self` here to make mutable 27 | f.s.push('x'); | ^^^ assignment into an immutable reference ``` And the following when trying to access an immutable struct field as mutable: ``` error: cannot borrow immutable borrowed content `*self.s` as mutable --> $DIR/issue-38147-3.rs:17:9 | 12 | s: &'a String | ------------- use `&'a mut String` here to make mutable ...| 16 | fn f(&self) { | ----- use `&mut self` here to make mutable 17 | self.s.push('x'); | ^^^^^^ cannot borrow as mutable ```
2016-11-29add hint to fix error for immutable ref in argMikhail Modin-0/+17