Skip to content

RA reports missing trait item implementation for associated constant with default value: possibly a regression. #15909

Closed
@nerditation

Description

@nerditation

description

a trait has an associated constant with a default value, when a type implements the trait and omit the associated constant, RA will show error message:

"not all trait item implemented, missing: const XXXX"

while the same code compiles without any problem.

I can't remember exactly, but I think this error starts to show up from yesterday; in previous versions, no error is shown for the exact same code base.

minimal reproducible code:

trait Marker {
	const FLAG: bool = false;
}
struct Foo;
impl Marker for Foo {}  // <--- error message shows up here

screenshot

image

rust-analyzer version:

using vscode extension preview channel,

  • rust-analyzer 0.4.1735-standalone (58de0b1 2023-11-15)
  • Extension version: 0.4.1735
INFO [11/16/2023, 10:29:17 AM]: Starting language client
INFO [11/16/2023, 10:29:17 AM]: Using server binary at d:\Applications\scoop\apps\vscode\1.83.1\data\extensions\rust-lang.rust-analyzer-0.4.1735-win32-x64\server\rust-analyzer.exe
INFO [11/16/2023, 10:29:17 AM]: d:\Applications\scoop\apps\vscode\1.83.1\data\extensions\rust-lang.rust-analyzer-0.4.1735-win32-x64\server\rust-analyzer.exe --version: {
  status: 0,
  signal: null,
  output: [
    null,
    'rust-analyzer 0.4.1735-standalone (58de0b130 2023-11-15)\n',
    ''
  ],
  pid: 17980,
  stdout: 'rust-analyzer 0.4.1735-standalone (58de0b130 2023-11-15)\n',
  stderr: ''
}

rustc version:

rustc 1.76.0-nightly (dd430bc8c 2023-11-14)

relevant settings:

nothing special, just normal installation via rustup and vscode

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions