about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/borrow_check/diagnostics
AgeCommit message (Collapse)AuthorLines
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-8201/+0
2021-08-29Provide structured suggestion for removal of `&mut`Esteban Kuber-2/+20
2021-08-29Suggestion for call on immutable binding of mutable typeEsteban Küber-7/+53
When calling a method requiring a mutable self borrow on an inmutable to a mutable borrow of the type, suggest making the binding mutable. Fix #83241.
2021-08-26Rollup merge of #88270 - lqd:hrtb-type-ascription, r=nikomatsakisManish Goregaokar-5/+37
Handle type ascription type ops in NLL HRTB diagnostics Currently, there are still a few cases of the "higher-ranked subtype error" of yore, 4 of which are related to type ascription. This PR is a follow-up to #86700, adding support for type ascription type ops, and makes 3 of these tests output the same diagnostics in NLL mode as the migrate mode (and 1 is now much closer, especially if you ignore that it already outputs an additional error in NLL mode -- which could be a duplicate caused by a lack of normalization like [these comments point out](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/compiler/rustc_traits/src/type_op.rs#L122-L157), or an imprecision in some parts of normalization as [described here](https://github.com/rust-lang/rust/pull/86700#discussion_r689086688)). Since we discussed these recently: - [here](https://github.com/rust-lang/rust/pull/86700#discussion_r689158868), cc ````@matthewjasper,```` - and [here](https://github.com/rust-lang/rust/issues/57374#issuecomment-901500856), cc ````@Aaron1011.```` It should only leave [this TAIT test](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs) as still emitting [the terse error](https://github.com/rust-lang/rust/blob/9583fd1bdd0127328e25e5b8c24dff575ec2c86b/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr). r? ````@estebank```` (so that they shake their fist at NLL's general direction less often) or ````@nikomatsakis```` or matthew or aaron, the more the merrier.
2021-08-23handle ascription type op in NLL HRTB diagnosticsRémy Rakic-5/+37
Refactors the `type_op_ascribe_user_type` query into a version which accepts a span, and uses it in the nicer NLL HRTB bound region errors.
2021-08-22Fix more “a”/“an” typosFrank Steffahn-2/+2
2021-08-22Fix typos “a”→“an”Frank Steffahn-6/+6
2021-08-18add fixme about the `type_op_normalize` query in NLL HRTB diagnosticsRémy Rakic-1/+7
2021-08-16fix typo in bound_region_errors.rsRémy Rakic-1/+1
Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
2021-08-15De-dupe NLL HRTB diagnostics' use of `type_op_prove_predicate`Rémy Rakic-12/+3
2021-08-15don't derive `Copy` for `RegionElement`Rémy Rakic-1/+1
2021-08-15Slight cleanupRémy Rakic-4/+1
2021-08-15Fix dyn trait warningRémy Rakic-2/+2
2021-08-15Report nicer errors for HRTB NLL errors from queriesMatthew Jasper-18/+234
2021-08-15Report mismatched type errors for bound region errors in NLLMatthew Jasper-10/+29
2021-08-15Track causes for universes created during borrowckMatthew Jasper-0/+112
2021-08-15Simplify BoundUniversalRegionErrorMatthew Jasper-6/+6
2021-08-12Avoid ICE caused by suggestionEsteban Küber-7/+12
When suggesting dereferencing something that can be iterable in a `for` loop, erase lifetimes and use a fresh `ty::ParamEnv` to avoid 'region constraints already solved' panic. Fix #87657.
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-2/+2
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-30Auto merge of #86754 - estebank:use-multispans-more, r=varkorbors-11/+12
Use `multipart_suggestions` more Built on top of #86532
2021-07-31Rollup merge of #87559 - estebank:consider-borrowing, r=oli-obkYuki Okushi-30/+39
Tweak borrowing suggestion in `for` loop
2021-07-30Use multispan suggestions more oftenEsteban Küber-11/+12
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2021-07-30Tweak borrowing suggestion in `for` loopEsteban Küber-30/+39
2021-07-28Rollup merge of #87453 - ibraheemdev:i-68697, r=wesleywiserYuki Okushi-2/+12
Suggest removing unnecessary &mut as help message Closes #68697
2021-07-25fmtibraheemdev-3/+3
2021-07-25fix help message for modification to &T created by &{t}ibraheemdev-9/+7
2021-07-25suggest removing unnecessary \&mut as help messageibraheemdev-2/+12
2021-07-25clippy::useless_formatMatthias Krüger-2/+2
2021-07-20Get back the more precise suggestion spans of old regionckOli Scherer-4/+6
2021-07-18Auto merge of #85686 - ptrojahn:loop_reinitialize, r=estebankbors-18/+74
Add help on reinitialization between move and access Fixes #83760
2021-07-12Auto merge of #86815 - FabianWolff:issue-84210, r=varkorbors-4/+20
Improve error reporting for modifications behind `&` references I had a look at #84210 and noticed that #85823 has effectively already fixed #84210. However, the string matching in #85823 is _very_ crude and already breaks down when a variable name starts with `mut`. I have made this a bit more robust; further improvements could definitely be made but are complicated by the lack of information provided by an earlier pass: https://github.com/rust-lang/rust/blob/ce331ee6ee010438d1a58c7da8ced4f26d69a20e/compiler/rustc_mir_build/src/build/matches/mod.rs#L2103-L2107 I have also fixed a missing comma in the error message.
2021-07-07Add help on reinitialization between move and accessPaul Trojahn-18/+74
Fixes #83760
2021-07-06Make type_implements_trait not a queryAman Arora-2/+4
2021-07-04remove some ad-hoc has_infer_types checks that aren't needed anymoreNiko Matsakis-15/+13
2021-07-04allow inference vars in type_implements_traitNiko Matsakis-1/+3
2021-07-02Improve error reporting for modifications behind `&` referencesFabian Wolff-4/+20
2021-06-16Do not emit invalid suggestions on multiple mutable borrow errorsYuki Okushi-8/+26
2021-06-12Rollup merge of #85823 - fee1-dead:borrowck-0, r=jackh726Yuki Okushi-2/+6
Do not suggest ampmut if rhs is already mutable Removes invalid suggestion in #85765, although it should highlight the user type instead of the local variable. Looking at the comments of this line: https://github.com/rust-lang/rust/blob/84b1005bfd22e2cb2a4c13b0b81958fe72628354/compiler/rustc_mir_build/src/build/matches/mod.rs#L2107 It was intentionally set to `None`, causing it to highlight the local variable instead. I am not sure if I will be able to fix it. Fixes #85765
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-9/+25
2021-05-30Do not suggest ampmut if rhs is already mutableDeadbeef-2/+6
2021-05-23Replace Local::new(1) with CAPTURE_STRUCT_LOCALPaul Trojahn-11/+11
2021-05-11Fix CI problemshamidreza kalbasi-41/+37
2021-05-10remove big matchhamidreza kalbasi-63/+48
2021-05-10move logic to a functionhamidreza kalbasi-81/+79
2021-05-09Try to fix issue 68049hamidreza kalbasi-10/+103
2021-05-01add docstrings and add issue to FIXMEsChris Pardy-1/+3
2021-05-01Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rsChrisPardy-1/+1
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rsChrisPardy-1/+1
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rsChrisPardy-2/+2
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01Closure capture borrow diagnostics for disjoint capturesChris Pardy-74/+173