Skip to content

Commit c0ca90c

Browse files
authored
Unrolled build for rust-lang#123247
Rollup merge of rust-lang#123247 - veera-sivarajan:fix-error-code-E0637-example-code, r=fmease Mention Both HRTB and Generic Lifetime Param in `E0637` documentation The compiler (rustc 1.77.0) error for `and_without_explicit_lifetime()` in the erroneous code example suggests using a HRTB. But, the corrected example uses an explicit lifetime parameter. This PR fixes it so that the documentation and the compiler suggestion for error code `E0637` are consistent with each other.
2 parents a743116 + 26ed429 commit c0ca90c

File tree

1 file changed

+17
-4
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+17
-4
lines changed

compiler/rustc_error_codes/src/error_codes/E0637.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
`'_` lifetime name or `&T` without an explicit lifetime name has been used
2-
on illegal place.
2+
in an illegal place.
33

44
Erroneous code example:
55

@@ -13,7 +13,14 @@ fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
1313
}
1414
}
1515
16-
fn and_without_explicit_lifetime<T>()
16+
fn without_explicit_lifetime<T>()
17+
where
18+
T: Iterator<Item = &u32>,
19+
//^ `&` without an explicit lifetime name
20+
{
21+
}
22+
23+
fn without_hrtb<T>()
1724
where
1825
T: Into<&u32>,
1926
//^ `&` without an explicit lifetime name
@@ -40,9 +47,15 @@ fn underscore_lifetime<'a>(str1: &'a str, str2: &'a str) -> &'a str {
4047
}
4148
}
4249
43-
fn and_without_explicit_lifetime<'foo, T>()
50+
fn without_explicit_lifetime<'a, T>()
51+
where
52+
T: Iterator<Item = &'a u32>,
53+
{
54+
}
55+
56+
fn without_hrtb<T>()
4457
where
45-
T: Into<&'foo u32>,
58+
T: for<'foo> Into<&'foo u32>,
4659
{
4760
}
4861
```

0 commit comments

Comments
 (0)