Skip to content

Commit 055aaaf

Browse files
committed
Fixed missing whitespace on some elaborated types.
1 parent 5282d7d commit 055aaaf

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
238238
// Need to make the `end_index` relative to the full string.
239239
let end_index = start_index + end_index;
240240
// `start_index + 1` skips the `&`.
241-
// `end_index` goes until the space after the region.
242-
type_name.replace_range(start_index + 1..end_index, "");
241+
// `end_index + 1` goes to (including) the space after the region.
242+
type_name.replace_range(start_index + 1..end_index + 1, "");
243243
}
244244
}
245245
debug!("give_name_if_we_cannot_match_hir_ty: type_name={:?}", type_name);
@@ -255,7 +255,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
255255

256256
// Compute the index of the character after `&` in the original string.
257257
index = next_index + index + 1;
258-
type_name.insert_str(index, &format!("{}", region_name));
258+
type_name.insert_str(index, &format!("{} ", region_name));
259259
}
260260

261261
let (_, span) = self.get_argument_name_and_span_for_region(mir, argument_index);

src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
1111
| ----------^^^^^-----------------
1212
| | | |
1313
| | | free region requires that `'1` must outlive `'2`
14-
| | has type `&'1i32`
14+
| | has type `&'1 i32`
1515
| lifetime `'2` appears in return type
1616

1717
error: aborting due to previous error

src/test/ui/issue-52533.nll.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ error: unsatisfied lifetime constraints
1010
LL | foo(|a, b| b)
1111
| - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
1212
| | |
13-
| | has type `&'1u32`
14-
| has type `&'2u32`
13+
| | has type `&'1 u32`
14+
| has type `&'2 u32`
1515

1616
error: aborting due to previous error
1717

0 commit comments

Comments
 (0)