]> git.lizzy.rs Git - rust.git/commitdiff
Don't show `for<'lt>` in force trimmed paths
authorEsteban Küber <esteban@kuber.com.ar>
Fri, 6 Jan 2023 01:03:52 +0000 (01:03 +0000)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 30 Jan 2023 20:12:21 +0000 (20:12 +0000)
compiler/rustc_middle/src/ty/print/pretty.rs
tests/ui/function-pointer/unsized-ret.stderr
tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr
tests/ui/higher-rank-trait-bounds/issue-30786.stderr
tests/ui/issues/issue-102964.stderr
tests/ui/issues/issue-24322.stderr
tests/ui/issues/issue-57362-2.stderr
tests/ui/nll/issue-57642-higher-ranked-subtype.stderr
tests/ui/regions/issue-102374.stderr
tests/ui/suggestions/issue-101984.stderr

index f2abec216b7b371d594bd85f5a657fbca09e7f05..d9d6e65a97a66a7f08331b2a1248b7bf8343f320 100644 (file)
@@ -2346,6 +2346,7 @@ fn name_by_region_index(
         } else {
             let tcx = self.tcx;
 
+            let trim_path = FORCE_TRIMMED_PATH.with(|flag| flag.get());
             // Closure used in `RegionFolder` to create names for anonymous late-bound
             // regions. We use two `DebruijnIndex`es (one for the currently folded
             // late-bound region and the other for the binder level) to determine
@@ -2400,8 +2401,10 @@ fn name_by_region_index(
                     }
                 };
 
-                start_or_continue(&mut self, "for<", ", ");
-                do_continue(&mut self, name);
+                if !trim_path {
+                    start_or_continue(&mut self, "for<", ", ");
+                    do_continue(&mut self, name);
+                }
                 tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { var: br.var, kind }))
             };
             let mut folder = RegionFolder {
@@ -2412,7 +2415,9 @@ fn name_by_region_index(
             };
             let new_value = value.clone().skip_binder().fold_with(&mut folder);
             let region_map = folder.region_map;
-            start_or_continue(&mut self, "", "> ");
+            if !trim_path {
+                start_or_continue(&mut self, "", "> ");
+            }
             (new_value, region_map)
         };
 
index 6f430687e6d6efd057001cb8686e328839dca7ba..dd00ff103e7ad61b624fbdaeefb2b8dda370838d 100644 (file)
@@ -23,7 +23,7 @@ LL |     foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&()
    |     required by a bound introduced by this call
    |
    = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`
-   = note: required because it appears within the type `for<'a> fn(&'a ()) -> (dyn Display + 'a)`
+   = note: required because it appears within the type `fn(&'a ()) -> (dyn Display + 'a)`
 note: required by a bound in `foo`
   --> $DIR/unsized-ret.rs:5:11
    |
index 3e388653471eba376db615f86391e51e383bfc73..173bc47b27253b2c290d4559c005c9970204ca72 100644 (file)
@@ -11,9 +11,9 @@ LL | |     ),
 LL | | ) {
    | |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type
 LL |       f
-   |       ^ expected `&dyn for<'a> Fn(&'a ...)`, found `&dyn Fn(u32)`
+   |       ^ expected `&dyn Fn(&'a (dyn Fn(&'a ...) + 'a))`, found `&dyn Fn(u32)`
    |
-   = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a ...) + 'a)) + 'a)) + 'a))`
+   = note: expected reference `&dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(&'a (dyn Fn(...) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))`
            the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt'
               found reference `&dyn Fn(u32)`
 
index 0458d2535f2f56ad83eac2b0d3be6ceaaf28c22b..6710551057373e5a8d474fd819aef6c34eafb793 100644 (file)
@@ -19,7 +19,7 @@ note: the following trait bounds were not satisfied:
 LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
    |         ---------     -                          ^^^^^^ unsatisfied trait bound introduced here
 
-error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied
+error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied
   --> $DIR/issue-30786.rs:130:24
    |
 LL | pub struct Filter<S, F> {
index 4be53fd09e523e0f626882795b431fe84a01b06b..0cec4751fb86a18b5668529fd1bcd637ab3bd086 100644 (file)
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/issue-102964.rs:5:41
    |
 LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
-   |    ------------                         ^^^^^^^^ expected `Rc<&dyn for<'a> Fn(&'a T)>`, found `()`
+   |    ------------                         ^^^^^^^^ expected `Rc<&dyn Fn(&'a T)>`, found `()`
    |    |
    |    implicitly returns `()` as its body has no tail or `return` expression
    |
index 37cc3413f7511ebc5c3fd30ff5f781d5af7343d8..583afaead2d320cc0ce3b07b4f63b3a21d323a0f 100644 (file)
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
   --> $DIR/issue-24322.rs:8:29
    |
 LL |     let x: &fn(&B) -> u32 = &B::func;
-   |            --------------   ^^^^^^^^ expected `&for<'a> fn(&'a B) -> u32`, found `&for<'a> fn(&'a B) -> u32 {B::func}`
+   |            --------------   ^^^^^^^^ expected `&fn(&'a B) -> u32`, found `&fn(&'a B) -> u32 {B::func}`
    |            |
    |            expected due to this
    |
index 7d08c4643ff2f00743a701731fcaeb7a391fb2d3..8dcf7911baf91f55e1495de5372dcdb982d6e4bb 100644 (file)
@@ -1,8 +1,8 @@
-error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied
+error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&'a ())`, but its trait bounds were not satisfied
   --> $DIR/issue-57362-2.rs:22:25
    |
 LL |     let x = <fn (&())>::make_g();
-   |                         ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds
+   |                         ^^^^^^ function or associated item cannot be called on `fn(&'a ())` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `for<'a> fn(&'a ()): X`
index 6e96f40c0e0d86d8a8421a4cb7a3b50eeae31aaf..ceef6e34d024f7c29fdaa629ef91bd8f7a358501 100644 (file)
@@ -1,8 +1,8 @@
-error[E0599]: the function or associated item `make_g` exists for fn pointer `for<'a> fn(&'a ())`, but its trait bounds were not satisfied
+error[E0599]: the function or associated item `make_g` exists for fn pointer `fn(&'a ())`, but its trait bounds were not satisfied
   --> $DIR/issue-57642-higher-ranked-subtype.rs:31:25
    |
 LL |     let x = <fn (&())>::make_g();
-   |                         ^^^^^^ function or associated item cannot be called on `for<'a> fn(&'a ())` due to unsatisfied trait bounds
+   |                         ^^^^^^ function or associated item cannot be called on `fn(&'a ())` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `for<'a> fn(&'a ()): X`
@@ -13,11 +13,11 @@ note: `X` defines an item `make_g`, perhaps you need to implement it
 LL | trait X {
    | ^^^^^^^
 
-error[E0599]: no function or associated item named `make_f` found for fn pointer `for<'a> fn(&'a ())` in the current scope
+error[E0599]: no function or associated item named `make_f` found for fn pointer `fn(&'a ())` in the current scope
   --> $DIR/issue-57642-higher-ranked-subtype.rs:35:25
    |
 LL |     let x = <fn (&())>::make_f();
-   |                         ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())`
+   |                         ^^^^^^ function or associated item not found in `fn(&'a ())`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
 note: `Y` defines an item `make_f`, perhaps you need to implement it
index 157850693ab506ad96fd63ebed1062efe6ac83c5..af64b6867bb0c8e376a00985c23a189b6125ac9b 100644 (file)
@@ -7,7 +7,7 @@ LL |     f
    |     ^ expected `i32`, found fn pointer
    |
    = note:    expected type `i32`
-           found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<...>)`
+           found fn pointer `fn(Cell<...>)`
            the full type name has been written to '$TEST_BUILD_DIR/regions/issue-102374/issue-102374.long-type-hash.txt'
 
 error: aborting due to previous error
index 6ae2842b2bf371ffff02549b7223416467a1bcd9..3492f4ea0f15563abe8c0acf33ef52e139effc0a 100644 (file)
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
 LL |         let (cmp, router) = self.router.at()?;
    |             ^^^^^^^^^^^^^   ----------------- this expression has type `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>`
    |             |
-   |             expected `Match<&(for<'a> fn(&'a ()), ...)>`, found `(_, _)`
+   |             expected `Match<&(fn(&'a ()), Box<Wrapper>)>`, found `(_, _)`
    |
    = note: expected struct `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>`
                found tuple `(_, _)`