about summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-21856/+0
2023-01-08Rollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwcoMichael Goulet-4/+4
Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible Fixes #80929 Fixes #67296
2023-01-08Rollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, ↵Yuki Okushi-0/+27
r=compiler-errors Suggest `mut self: &mut Self` for `?Sized` impls Closes #106325 Closes #93078 The suggestion is _probably_ not what the user wants (hence `MaybeIncorrect`) but at least makes the problem in the above issues clearer. It might be better to add a note explaining why this is the case, but I'm not sure how best to word that so this is a start. ``@rustbot`` label +A-diagnostics
2023-01-08Mention signature rather than fn pointers when comparing impl/trait methodsMichael Goulet-4/+4
2023-01-05Explain error with `&mut self` for unsized trait implsclubby789-0/+27
2023-01-03Rollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, ↵Matthias Krüger-11/+90
r=Nilstrieb Test the borrowck behavior of if-let guards Add some tests to make sure that if-let guards behave the same as if guards with respect to borrow-checking. Most of them are a naive adaptation, replacing an `if` guard with `if let Some(())`. This includes regression tests for notable issues that arose for if guards (#24535, #27282, #29723, #31287) as suggested in https://github.com/rust-lang/rust/issues/51114#issuecomment-900470419. cc `@pnkfelix` are there any other tests that you would want to see? cc tracking issue #51114
2023-01-01Verbose suggestionsEsteban Küber-76/+148
2023-01-01Merge multiple mutable borrows of immutable binding errorsEsteban Küber-38/+77
Fix #53466.
2022-12-28Use verbose suggestions for mutability errorsEsteban Küber-52/+100
2022-12-27Auto merge of #106095 - estebank:pin-mut-reborrow, r=compiler-errorsbors-1/+25
Suggest `Pin::as_mut` when encountering borrow error Fix #65409 for `Pin<&mut T>`.
2022-12-25Create new inference contextEsteban Küber-1/+25
2022-12-21Test the borrowck behavior of if-let guardsLéo Lanteri Thauvin-11/+90
2022-12-18Rollup merge of #105447 - TaKO8Ki:add-test-for-103095, r=petrochenkovMatthias Krüger-0/+30
Add a test for #103095 closes #103095
2022-12-15Auto merge of #104765 - chenyukang:yukang-fix-104639-lifetime-check, r=oli-obkbors-0/+10
Find the right lower bound region in the scenario of partial order relations Fixes #104639
2022-12-13Rollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebankMatthias Krüger-24/+6
Make some diagnostics not depend on the source of what they reference being available r? `@estebank` follow up to https://github.com/rust-lang/rust/pull/104449
2022-12-13Account for dereference expressionsEsteban Küber-32/+55
2022-12-13Fix span for `&mut ` removal suggestionEsteban Küber-3/+3
2022-12-13Suggest `ref` for some patterns as a fallbackEsteban Küber-10/+181
2022-12-13Change pattern borrowing suggestions to be verboseEsteban Küber-112/+190
Synthesize a more accurate span and use verbose suggestion output to make the message clearer.
2022-12-13Clarify what "this" meansOli Scherer-6/+6
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-18/+0
available
2022-12-11Move testsCaio-0/+68
2022-12-08add a test for #103095Takayuki Maeda-0/+30
2022-12-06Change CTFE backtraces to use `note` instead of `label` to preserve their orderOli Scherer-18/+30
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06Remove now-redundant file/line info from const backtracesOli Scherer-6/+6
2022-11-23review comments: inline bindings and fix typoEsteban Küber-3/+3
2022-11-23Tweak output to account for alternative bindings in the same patternEsteban Küber-8/+2
2022-11-23Fix wordingEsteban Küber-3/+3
2022-11-23Remove logic duplicationEsteban Küber-3/+3
2022-11-23Do not suggest `ref` multiple times for the same bindingEsteban Küber-8/+0
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-6/+381
2022-11-23Fix #104639, find the right lower bound region in the scenario of partial ↵yukang-0/+10
order relations
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-13/+16
2022-11-13Rollup merge of #104181 - jackh726:known-bug-tests, r=Mark-SimulacrumManish Goregaokar-0/+62
Add a few known-bug tests The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged. cc: #101518 #99492 #90950 #89196 #104034 #101350 #103705 #103899 I couldn't reproduce the failures in #101962 and #100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now. #102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.
2022-11-13Add a few known-bug testsJack Huey-0/+62
2022-11-12Auto merge of #103530 - cjgillot:hir-lifetimes-direct, r=estebankbors-15/+4
Resolve lifetimes independently for each item-like. Now that the heavy-lifting is done on the AST and during lowering, we do not need to perform HIR lifetime resolution on a full item at once. Instead, we can treat each item-like independently, and look at `generics_of` the parent exceptionally for associated items.
2022-11-11Visit opaque types during type collection too.Camille GILLOT-15/+4
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-7/+7
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-05Adjust diagnostics, bless testsMichael Goulet-18/+18
2022-10-27Erase regions from CallArgument, add test + blessMichael Goulet-0/+66
2022-10-25Rollup merge of #103382 - compiler-errors:anon-apit-lt-region-ice, r=cjgillotYuki Okushi-0/+28
Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait` The issue here is that when we have: ``` trait Trait<'a> { .. } fn foo(arg: impl Trait) { .. } ``` The anonymous lifetime `'_` that we generate for `arg: impl Trait` doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty. Fixes #101660 r? ``@cjgillot``
2022-10-23Rollup merge of #103305 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-0/+30
Move some tests to more reasonable places r? `@petrochenkov`
2022-10-22Don't ICE on regions from anonymous_lifetime_in_impl_traitMichael Goulet-0/+28
2022-10-20Update tests to match error message changesb4den-7/+7
2022-10-20Move some tests for more reasonable placesCaio-0/+30
2022-10-19Erase regions before checking for default in uninitialized binding errorMichael Goulet-0/+54
2022-10-16Auto merge of #102080 - yanchen4791:issue-99824-fix, r=cjgillotbors-2/+8
Fix missing explanation of where the borrowed reference is used when the same borrow occurs multiple times due to loop iterations Fix #99824. Problem of the issue: If a borrow occurs in a loop, the borrowed reference could be invalidated at the same place at next iteration of the loop. When this happens, the point where the borrow occurs is the same as the intervening point that might invalidate the reference in the loop. This causes a problem for the current code finding the point where the resulting reference is used, so that the explanation of the cause will be missing. As the second point of "explain all errors in terms of three points" (see [leveraging intuition framing errors in terms of points"](https://rust-lang.github.io/rfcs/2094-nll.html#leveraging-intuition-framing-errors-in-terms-of-points), this explanation is very helpful for user to understand the error. In the current implementation, the searching region for finding the location where the borrowed reference is used is limited to between the place where the borrow occurs and the place where the reference is invalidated. If those two places happen to be the same, which indicates that the borrow and invalidation occur at the same place in a loop, the search will fail. One solution to the problem is when these two places are the same, find the terminator of the loop, and then use the location of the loop terminator instead of the location of the borrow for the region to find the place where the borrowed reference is used.
2022-10-13Move some tests to more reasonable directoriesCaio-0/+19
2022-10-07make const_err a hard errorRalf Jung-63/+15
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-6/+6
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢