about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs6
-rw-r--r--src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr2
-rw-r--r--src/test/ui/issue-52533.nll.stderr4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
index 6c400278b70..f3b437c38d8 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
@@ -238,8 +238,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 // Need to make the `end_index` relative to the full string.
                 let end_index = start_index + end_index;
                 // `start_index + 1` skips the `&`.
-                // `end_index` goes until the space after the region.
-                type_name.replace_range(start_index + 1..end_index, "");
+                // `end_index + 1` goes to (including) the space after the region.
+                type_name.replace_range(start_index + 1..end_index + 1, "");
             }
         }
         debug!("give_name_if_we_cannot_match_hir_ty: type_name={:?}", type_name);
@@ -255,7 +255,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
 
             // Compute the index of the character after `&` in the original string.
             index = next_index + index + 1;
-            type_name.insert_str(index, &format!("{}", region_name));
+            type_name.insert_str(index, &format!("{} ", region_name));
         }
 
         let (_, span) = self.get_argument_name_and_span_for_region(mir, argument_index);
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
index 77f0ab5d6bd..14d889dca73 100644
--- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
+++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
@@ -11,7 +11,7 @@ LL |     invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
    |                ----------^^^^^-----------------
    |                |   |     |
    |                |   |     free region requires that `'1` must outlive `'2`
-   |                |   has type `&'1i32`
+   |                |   has type `&'1 i32`
    |                lifetime `'2` appears in return type
 
 error: aborting due to previous error
diff --git a/src/test/ui/issue-52533.nll.stderr b/src/test/ui/issue-52533.nll.stderr
index 365ef2bac39..a13b06e3204 100644
--- a/src/test/ui/issue-52533.nll.stderr
+++ b/src/test/ui/issue-52533.nll.stderr
@@ -10,8 +10,8 @@ error: unsatisfied lifetime constraints
 LL |     foo(|a, b| b)
    |          -  -  ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
    |          |  |
-   |          |  has type `&'1u32`
-   |          has type `&'2u32`
+   |          |  has type `&'1 u32`
+   |          has type `&'2 u32`
 
 error: aborting due to previous error