Skip to content
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

Invalid error help of struct generic param with default value #124785

Closed
A4-Tacks opened this issue May 6, 2024 · 0 comments · Fixed by #124884
Closed

Invalid error help of struct generic param with default value #124785

A4-Tacks opened this issue May 6, 2024 · 0 comments · Fixed by #124884
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@A4-Tacks
Copy link

A4-Tacks commented May 6, 2024

I tried this code:

struct Foo<T = i32>(&'static T);

I expected to see this happen:

help: consider adding an explicit lifetime bound
  |
1 | struct Foo<T: 'static = i32>(&'static T);
  |             +++++++++

Instead, this happened:

help: consider adding an explicit lifetime bound
  |
1 | struct Foo<T = i32: 'static>(&'static T);
  |                   +++++++++

is syntax error

Meta

(rust playground version):

1.80.0-nightly

(2024-05-05 9c9b568792ef20d8459c)
@A4-Tacks A4-Tacks added the C-bug Category: This is a bug. label May 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 6, 2024
@saethlin saethlin added A-diagnostics Area: Messages for errors, warnings, and lints D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 11, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 14, 2024
place explicit lifetime bound after generic param

Fixes rust-lang#124785

An easy fix.
@bors bors closed this as completed in 74e8232 Jun 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 14, 2024
Rollup merge of rust-lang#124884 - bvanjoi:fix-124785, r=estebank

place explicit lifetime bound after generic param

Fixes rust-lang#124785

An easy fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants