summary refs log tree commit diff
path: root/src/test/ui/mut
AgeCommit message (Collapse)AuthorLines
2021-12-14Make TyS::is_suggestable more structualMichael Goulet-6/+0
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-2/+4
Fixes #90101
2021-09-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-3/+3
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-26Remove box syntax from most places in src/test outside of the issues direst31-3/+3
2021-09-25Use larger span for adjustments on method callsAaron Hill-3/+3
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-08-16Use note to point at bound introducing requirementEsteban Küber-3/+5
2021-07-02Improve error reporting for modifications behind `&` referencesFabian Wolff-1/+1
2021-04-12Compiler error messages: reduce assertiveness of message E0384James Addison-1/+1
This message is emitted as guidance by the compiler when a developer attempts to reassign a value to an immutable variable. Following the message will always currently work, but it may not always be the best course of action; following the 'consider ...' messaging pattern provides a hint to the developer that it could be wise to explore other alternatives.
2021-04-06Point at `impl` and type defs introducing requirements on E0277Esteban Küber-1/+5
2020-09-02pretty: trim paths of unique symbolsDan Aloni-3/+3
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-04-08Small tweaks to required bound spanEsteban Küber-1/+1
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-1/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-02-25check_pat_ref: use pattern_causeMazdak Farrokhzad-0/+6
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-11/+11
Specific labels when referring to "expected" and "found" types
2019-11-18Surround types with backticks in type errorsEsteban Küber-1/+1
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-10/+10
2019-11-18Update ui testsGuillaume Gomez-0/+2
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-1/+1
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-5/+3
2019-04-22update tests for migrate mode by defaultMatthew Jasper-144/+21
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-8/+3
2019-03-17Updated UI test output to remove test annotations for revisionsMathias Blikstad-11/+11
2019-03-11Update NLL testsVadim Petrochenkov-2/+2
2019-03-11Update testsVadim Petrochenkov-6/+6
2019-01-06tests: Do not use `-Z parse-only`, continue compilation to test recoveryVadim Petrochenkov-3/+1
2018-12-25Remove licensesMark Rousskov-113/+23
2018-12-24make non_camel_case_types an early lintAndy Russell-12/+12
2018-10-05Rollup merge of #54787 - varkor:unused-mut-in-desugaring, r=nikomatsakisPietro Albini-0/+8
Only warn about unused `mut` in user-written code Fixes https://github.com/rust-lang/rust/issues/54586. r? @pnkfelix cc @blitzerr
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-10-03Only warn about unused `mut` in user-written codevarkor-0/+8
2018-09-12use structured suggestion for "missing mut" labelAndy Russell-15/+17
Fixes #54133.
2018-08-19move tests to borrowck directory, remove feature(nll)Niko Matsakis-14/+8
now compare-mode can show us the differences
2018-08-15Updated the most glaring instances of weak tests w.r.t. NLL that came from ↵Felix S. Klock II-2/+20
#53196. See also the bulletpoint list on #53351.
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+489