Skip to content

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

@A4-Tacks

Description

@A4-Tacks
Contributor

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)

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 6, 2024
added
A-diagnosticsArea: Messages for errors, warnings, and lints
D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 11, 2024
added 2 commits that reference this issue on Jun 14, 2024
130c1a8
74e8232
added a commit that references this issue on Jun 14, 2024
cd50baa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @saethlin@rustbot@A4-Tacks

      Issue actions

        Invalid error help of struct generic param with default value · Issue #124785 · rust-lang/rust