Skip to content

Commit 5d0697b

Browse files
committed
reworded message
1 parent 5824917 commit 5d0697b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

compiler/rustc_resolve/src/late/diagnostics.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1674,10 +1674,14 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
16741674
);
16751675
} else if suggest_note {
16761676
suggest_note = false; // Avoid displaying the same help multiple times.
1677-
err.help(&format!(
1678-
"consider introducing lifetime `{}` to the item's generics",
1679-
lifetime_ref,
1680-
));
1677+
err.span_label(
1678+
span,
1679+
&format!(
1680+
"lifetime `{}` is missing in item created through this procedural \
1681+
macro",
1682+
lifetime_ref,
1683+
),
1684+
);
16811685
}
16821686
}
16831687
MissingLifetimeSpot::HigherRanked { span, span_type } => {

src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ LL | a: &'b str,
2727
error[E0261]: use of undeclared lifetime name `'b`
2828
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
2929
|
30+
LL | #[derive(Eq, PartialEq)]
31+
| -- lifetime `'b` is missing in item created through this procedural macro
32+
LL | struct Test {
3033
LL | a: &'b str,
3134
| ^^ undeclared lifetime
3235
|
33-
= help: consider introducing lifetime `'b` to the item's generics
3436
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
3537

3638
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)