rust-lang / rust-lang/rust

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

Open
#128,302 6 comments 0 reactions 1 assignee View on GitHub

@chansuke is already working on this.

Since Aug 12, 2024.

A-diagnostics T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

https://github.com/rust-lang/rust-analyzer/issues/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.