about summary refs log tree commit diff
path: root/tests/ui/impl-trait/precise-capturing
diff options
context:
space:
mode:
authordianne <diannes.gm@gmail.com>2024-12-04 03:19:03 -0800
committerdianne <diannes.gm@gmail.com>2025-01-06 16:08:29 -0800
commitac922245f0c86657a56d3ca5eff4a1d1b1fcb0a1 (patch)
treeb5ce8e5455bb583c9a63d40311f29061229638db /tests/ui/impl-trait/precise-capturing
parent2249232ad8886089221fbd68016dbee0ee2484bc (diff)
downloadrust-ac922245f0c86657a56d3ca5eff4a1d1b1fcb0a1.tar.gz
rust-ac922245f0c86657a56d3ca5eff4a1d1b1fcb0a1.zip
`best_blame_constraint`: don't filter constraints by sup SCC
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.
Diffstat (limited to 'tests/ui/impl-trait/precise-capturing')
-rw-r--r--tests/ui/impl-trait/precise-capturing/migration-note.rs4
-rw-r--r--tests/ui/impl-trait/precise-capturing/migration-note.stderr16
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.rs b/tests/ui/impl-trait/precise-capturing/migration-note.rs
index 36db07e5764..7587e89409a 100644
--- a/tests/ui/impl-trait/precise-capturing/migration-note.rs
+++ b/tests/ui/impl-trait/precise-capturing/migration-note.rs
@@ -29,11 +29,11 @@ fn needs_static() {
     let a = display_len(&x);
     //~^ ERROR `x` does not live long enough
     //~| NOTE this call may capture more lifetimes than intended
-    //~| NOTE argument requires that `x` is borrowed for `'static`
     //~| NOTE borrowed value does not live long enoug
 
     fn needs_static(_: impl Sized + 'static) {}
     needs_static(a);
+    //~^ NOTE argument requires that `x` is borrowed for `'static`
 }
 //~^ NOTE `x` dropped here while still borrowed
 
@@ -76,11 +76,11 @@ fn needs_static_mut() {
     let a = display_len_mut(&mut x);
     //~^ ERROR `x` does not live long enough
     //~| NOTE this call may capture more lifetimes than intended
-    //~| NOTE argument requires that `x` is borrowed for `'static`
     //~| NOTE borrowed value does not live long enough
 
     fn needs_static(_: impl Sized + 'static) {}
     needs_static(a);
+    //~^ NOTE argument requires that `x` is borrowed for `'static`
 }
 //~^ NOTE `x` dropped here while still borrowed
 
diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
index c9403532dfa..9caf7a201ef 100644
--- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr
+++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
@@ -42,11 +42,11 @@ LL |     let x = vec![1];
    |         - binding `x` declared here
 LL |
 LL |     let a = display_len(&x);
-   |             ------------^^-
-   |             |           |
-   |             |           borrowed value does not live long enough
-   |             argument requires that `x` is borrowed for `'static`
+   |                         ^^ borrowed value does not live long enough
 ...
+LL |     needs_static(a);
+   |     --------------- argument requires that `x` is borrowed for `'static`
+LL |
 LL | }
    | - `x` dropped here while still borrowed
    |
@@ -118,11 +118,11 @@ LL |     let mut x = vec![1];
    |         ----- binding `x` declared here
 LL |
 LL |     let a = display_len_mut(&mut x);
-   |             ----------------^^^^^^-
-   |             |               |
-   |             |               borrowed value does not live long enough
-   |             argument requires that `x` is borrowed for `'static`
+   |                             ^^^^^^ borrowed value does not live long enough
 ...
+LL |     needs_static(a);
+   |     --------------- argument requires that `x` is borrowed for `'static`
+LL |
 LL | }
    | - `x` dropped here while still borrowed
    |