about summary refs log tree commit diff
path: root/tests/ui/nll/polonius
AgeCommit message (Collapse)AuthorLines
2025-09-28reword noteEsteban Küber-2/+2
2025-09-28Point at lifetime requirement origin in more casesEsteban Küber-10/+10
2025-09-28Point at fn bound that introduced lifetime obligationEsteban Küber-0/+10
``` error[E0597]: `c` does not live long enough --> $DIR/without-precise-captures-we-are-powerless.rs:19:20 | LL | fn simple<'a>(x: &'a i32) { | -- lifetime `'a` defined here ... LL | let c = async move || { println!("{}", *x); }; | - binding `c` declared here LL | outlives::<'a>(c()); | ---------------^--- | | | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed | note: requirement that `c` is borrowed for `'a` introduced here --> $DIR/without-precise-captures-we-are-powerless.rs:7:33 | LL | fn outlives<'a>(_: impl Sized + 'a) {} | ^^ ``` When encountering a `ConstraintCategory::Predicate` in a funtion call, point at the `Span` for that `Predicate` to explain where the lifetime obligation originates from.
2025-08-14it's not a borrow checker limitation :<lcnr-2/+2
2025-08-13rework `add_placeholder_from_predicate_note`lcnr-4/+4
2025-08-08mark polonius=next's NLL imprecisions as known-bugsRémy Rakic-13/+68
- linked-list cursor-like patterns - issue-46589 These are known-bugs for the polonius alpha, where they show the same imprecision as NLLs, but are supported by the old datalog implementation.
2025-08-08add cursor-like example that worksRémy Rakic-0/+102
This is an example similar to the linked-list cursor examples where the alpha shows the same imprecision as NLLs, but that can work due to the loans not being live after the loop, or the constraint graph being simple enough that the cfg/subset relationships are the same for reachability and liveness.
2025-08-08add NLL-like imprecision exampleRémy Rakic-0/+106
This test showcases the same imprecision as NLLs, unlike the datalog implementation, when using reachability as a liveness approximation.
2025-08-08add some test cases for overlapping yielded itemsRémy Rakic-0/+153
These are just some sanity checks to ensure NLLs, the polonius alpha analysis, and the datalog implementation behave the same on these common examples.
2025-08-08new impl fixes crash testRémy Rakic-0/+12
2025-08-07add multiple known-bugs for the linked-list cursor-like pattern of 46859/48001Rémy Rakic-0/+186
these are fixed by polonius=legacy, are currently accepted by polonius=next but won't be by the alpha analysis
2025-08-07add filtering lending iterator known-bugRémy Rakic-0/+70
2025-08-07add multiple known-bugs for NLL problem case 3Rémy Rakic-0/+778
these are fixed by polonius=next and polonius=legacy
2025-01-31add explicit revisions to polonius testsRémy Rakic-14/+148
The blessed expectations were recently removed because they were only checked via the compare-mode. This switches to explicit revisions to ensure it doesn't happen again. - `assignment-to-differing-field` - `polonius-smoke-test` - `subset-relations`
2025-01-31add explicit revisions to check-pass testsRémy Rakic-5/+16
2025-01-31merge duplicate issue-46589 testsRémy Rakic-31/+0
also add explicit revisions for -Zpolonius=next
2025-01-06`best_blame_constraint`: prioritize blaming interesting-seeming constraintsdianne-34/+40
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-48/+42
The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
2024-08-17Bless test falloutMichael Goulet-6/+6
2024-07-26Peel off explicit (or implicit) deref before suggesting clone on move error ↵Michael Goulet-0/+12
in borrowck
2024-04-24Modify `find_expr` from `Span` to better account for closuresEsteban Küber-0/+4
Start pointing to where bindings were declared when they are captured in closures: ``` error[E0597]: `x` does not live long enough --> $DIR/suggest-return-closure.rs:23:9 | LL | let x = String::new(); | - binding `x` declared here ... LL | |c| { | --- value captured here LL | x.push(c); | ^ borrowed value does not live long enough ... LL | } | -- borrow later used here | | | `x` dropped here while still borrowed ``` Suggest cloning in more cases involving closures: ``` error[E0507]: cannot move out of `foo` in pattern guard --> $DIR/issue-27282-move-ref-mut-into-guard.rs:11:19 | LL | if { (|| { let mut bar = foo; bar.take() })(); false } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard help: consider cloning the value if the performance cost is acceptable | LL | if { (|| { let mut bar = foo.clone(); bar.take() })(); false } => {}, | ++++++++ ```
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-18/+18
2023-12-01add tests from crater for liveness causing scope differencesRémy Rakic-0/+46
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-04add test for issue 117146Rémy Rakic-0/+100
2023-10-19add non-regression test for issue 116657Rémy Rakic-0/+105
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-2/+2
2023-01-17Account for `*` when looking for inner-most path in expressionEsteban Küber-1/+5
2023-01-15Tweak E0597Esteban Küber-1/+1
CC #99430
2023-01-11Move /src/test to /testsAlbert Larsan-0/+401