Skip to content

Rollup of 8 pull requests #106565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9553a4d
Fix process-panic-after-fork.rs to pass on newer versions of Android.
pcc Dec 10, 2022
5cccb36
higher-ranked lifetime message
compiler-errors Dec 18, 2022
82cf6f2
UPDATE - migrate base.rs to new diagnostics infrastructure
JhonnyBillM Nov 17, 2022
78796ba
ADD - fixme in type_names.rs until we are able to translate InterpError
JhonnyBillM Nov 6, 2022
d41112a
UPDATE - migrate constant.rs to new diagnostics infrastructure
JhonnyBillM Nov 6, 2022
e26366a
[WIP] UPDATE - migrate intrinsic.rs to new diagnostic infrastructure
JhonnyBillM Nov 13, 2022
d1030fa
UPDATE - migrate fn simd_simple_float_intrinsic error messages
JhonnyBillM Nov 17, 2022
2774446
ADD - create and emit Bug support for Diagnostics
JhonnyBillM Nov 23, 2022
29d8c87
DELETE - fn span_invalid_monomorphization_error and localize intrinsi…
JhonnyBillM Nov 27, 2022
4d63d7d
UPDATE - migrate outstanding diagnostic in link.rs
JhonnyBillM Nov 27, 2022
8360a40
Migrate named_anon_conflict.rs
IntQuant Sep 8, 2022
2118ff4
Migrate placeholder_error.rs
IntQuant Sep 10, 2022
3935a81
Migrate trait_impl_difference.rs
IntQuant Sep 13, 2022
0634b01
Partial work on static_impl_trait.rs
IntQuant Sep 16, 2022
57fdd19
Rebase and fix
IntQuant Sep 22, 2022
6c19c08
More descriptive names for ActualImplExplNotes variants
IntQuant Sep 25, 2022
71d24da
Split into several messages
IntQuant Sep 29, 2022
eb7ce17
Use eager translation
IntQuant Oct 14, 2022
40b2218
Rename subdiagnostic fields that do not need to be unique now
IntQuant Oct 15, 2022
19b8579
Address changes of pr 103345
IntQuant Oct 24, 2022
7ecd064
Split infer_explicit_lifetime_required into several diags
IntQuant Nov 3, 2022
62f9962
Made ty_or_sig and trait_path use their actual types instead of String
IntQuant Nov 3, 2022
a861737
Fix nits
IntQuant Nov 3, 2022
dda3eba
Fix broken rebase
IntQuant Nov 7, 2022
2a8b17d
Fix formatting
IntQuant Nov 29, 2022
0c50e1f
eager is the default now
IntQuant Dec 28, 2022
ce6b717
Detect closures assigned to binding in block
estebank Jan 5, 2023
43bec83
docs: make `HashSet::retain` doctest more clear
Ezrashaw Jan 7, 2023
a7ac923
rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`
notriddle Jan 7, 2023
ce32867
Add regression test for #100772
JohnTitor Jan 5, 2023
1d3ab79
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-e…
matthiaskrgr Jan 7, 2023
59e3b36
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnost…
matthiaskrgr Jan 7, 2023
4239e54
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
matthiaskrgr Jan 7, 2023
58a2367
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
matthiaskrgr Jan 7, 2023
1730aa2
Rollup merge of #106495 - JohnTitor:issue-100772, r=compiler-errors
matthiaskrgr Jan 7, 2023
07a47a3
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco
matthiaskrgr Jan 7, 2023
e33c22c
Rollup merge of #106553 - Ezrashaw:fix-hashset-doctest, r=JohnTitor
matthiaskrgr Jan 7, 2023
9639646
Rollup merge of #106556 - notriddle:notriddle/margin-left-content-mob…
matthiaskrgr Jan 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
higher-ranked lifetime message
  • Loading branch information
compiler-errors committed Dec 18, 2022
commit 5cccb36cfbc887da04dc367c24d2b4947c993ff9
27 changes: 21 additions & 6 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
count: 1,
};
let elision_candidate = LifetimeElisionCandidate::Missing(missing_lifetime);
for rib in self.lifetime_ribs.iter().rev() {
for (i, rib) in self.lifetime_ribs.iter().enumerate().rev() {
debug!(?rib.kind);
match rib.kind {
LifetimeRibKind::AnonymousCreateParameter { binder, .. } => {
Expand All @@ -1529,16 +1529,31 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
} else {
("`'_` cannot be used here", "`'_` is a reserved lifetime name")
};
rustc_errors::struct_span_err!(
let mut diag = rustc_errors::struct_span_err!(
self.r.session,
lifetime.ident.span,
E0637,
"{}",
msg,
)
.span_label(lifetime.ident.span, note)
.emit();

);
diag.span_label(lifetime.ident.span, note);
if elided {
for rib in self.lifetime_ribs[i..].iter().rev() {
if let LifetimeRibKind::Generics {
span,
kind: LifetimeBinderKind::PolyTrait | LifetimeBinderKind::WhereBound,
..
} = &rib.kind
{
diag.span_help(
*span,
"consider introducing a higher-ranked lifetime here with `for<'a>`",
);
break;
}
}
}
diag.emit();
self.record_lifetime_res(lifetime.id, LifetimeRes::Error, elision_candidate);
return;
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/error-codes/E0637.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | T: Into<&u32>,
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/E0637.rs:13:8
|
LL | T: Into<&u32>,
| ^

error: aborting due to 3 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | fn should_error<T>() where T : Into<&u32> {}
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:5:32
|
LL | fn should_error<T>() where T : Into<&u32> {}
| ^

error[E0106]: missing lifetime specifier
--> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | T: WithType<&u32>
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/where-clause-inherent-impl-ampersand.rs:13:8
|
LL | T: WithType<&u32>
| ^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | T: WithType<&u32>
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/where-clause-inherent-impl-ampersand.rs:13:8
|
LL | T: WithType<&u32>
| ^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | T: WithType<&u32>
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/where-clause-trait-impl-region.rs:11:8
|
LL | T: WithType<&u32>
| ^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
|
LL | T: WithType<&u32>
| ^ explicit lifetime name needed here
|
help: consider introducing a higher-ranked lifetime here with `for<'a>`
--> $DIR/where-clause-trait-impl-region.rs:11:8
|
LL | T: WithType<&u32>
| ^

error: aborting due to previous error

Expand Down