Skip to content

The suggestion to remove generic parameters proposed by help did not remove comma #128302

Open
@A4-Tacks

Description

@A4-Tacks

Code

type Result<T> = std::result::Result<T, ()>;

fn foo() -> Result<'static, ()> { Ok(()) }

fn main() { }

Current output

error[E0107]: type alias takes 0 lifetime arguments but 1 lifetime argument was supplied
 --> src/main.rs:3:13
  |
3 | fn foo() -> Result<'static, ()> { Ok(()) }
  |             ^^^^^^ ------- help: remove this lifetime argument
  |             |
  |             expected 0 lifetime arguments
  |
note: type alias defined here, with 0 lifetime parameters
 --> src/main.rs:1:6
  |
1 | type Result<T> = std::result::Result<T, ()>;
  |      ^^^^^^

For more information about this error, try `rustc --explain E0107`.
error: could not compile `test2` (bin "test2") due to 1 previous error

Desired output

error[E0107]: type alias takes 0 lifetime arguments but 1 lifetime argument was supplied
 --> src/main.rs:3:13
  |
3 | fn foo() -> Result<'static, ()> { Ok(()) }
  |             ^^^^^^ --------- help: remove this lifetime argument
  |             |
  |             expected 0 lifetime arguments
  |
note: type alias defined here, with 0 lifetime parameters
 --> src/main.rs:1:6
  |
1 | type Result<T> = std::result::Result<T, ()>;
  |      ^^^^^^

For more information about this error, try `rustc --explain E0107`.
error: could not compile `test2` (bin "test2") due to 1 previous error

Rationale and extra context

rust-lang/rust-analyzer#17727

Due to not removing the comma, rust-analyzer still has an error after quick fix

Other cases

No response

Rust Version

rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: aarch64-unknown-linux-gnu
release: 1.80.0
LLVM version: 18.1.7

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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

No branches or pull requests

Issue actions