about summary refs log tree commit diff
path: root/tests/ui/nll/closure-requirements
AgeCommit message (Collapse)AuthorLines
2025-09-28reword noteEsteban Küber-2/+2
2025-09-28Point at lifetime requirement origin in more casesEsteban Küber-2/+2
2025-09-28Point at fn bound that introduced lifetime obligationEsteban Küber-0/+12
``` 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-07-30Make sure to account for the right item universal regions in borrowckMichael Goulet-0/+43
2025-01-14mir borrowck: cleanup late-bound region handlinglcnr-6/+6
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-58/+72
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-12-12Tweak multispan renderingEsteban Küber-8/+2
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-03closure-requirements: add regression testslcnr-0/+61
2024-04-24Modify `find_expr` from `Span` to better account for closuresEsteban Küber-0/+7
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-03-21Stop `ConstraintCategory` `Ord` impl from relying on `Ty`'s `Ord` impl.Oli Scherer-10/+9
2024-03-18update region debug formattingBoxy-13/+13
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-26/+26
2023-12-19rename to verbose-internalsjyn-19/+19
2023-11-24Show number in error message even for one errorNilstrieb-17/+17
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-13rename `ReLateBound` to `ReBound`lcnr-13/+13
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-10-08remove trailing dotsAli MJ Al-Nasrawy-1/+1
2023-10-08always show and explain sub regionAli MJ Al-Nasrawy-0/+3
2023-09-24Remove span from BrAnon.Camille GILLOT-13/+13
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-17/+17
2023-04-25vars are ?Michael Goulet-50/+50
2023-04-06Remove index from BrAnonJack Huey-13/+13
2023-03-03ignore bivariant regions in opaque typesAli MJ Al-Nasrawy-20/+2
2023-03-03smarter algorithm for finding an equal regionAli MJ Al-Nasrawy-14/+2
Smarter and simpler!
2023-03-03promote subject even if it has unnamed regionsAli MJ Al-Nasrawy-33/+4
Don't require a region to have an `external_name` in order to be promoted.
2023-03-03add known-bug testsAli MJ Al-Nasrawy-0/+137
2023-01-15Tweak E0597Esteban Küber-0/+5
CC #99430
2023-01-11Move /src/test to /testsAlbert Larsan-0/+1387