Skip to content

Auto (de)ref not always handled correctly (type-mismatch false positive) #11948

Closed
@RalfJung

Description

@RalfJung

When opening the Miri source code at revision c568f32f, and opening src/diagnostics.rs in vscode, an error is reported in this line: "expected &String, found String".

[{
	"resource": "/home/r/src/rust/miri/src/diagnostics.rs",
	"owner": "rustc",
	"code": {
		"value": "type-mismatch",
		"target": {
			"$mid": 1,
			"external": "https://rust-analyzer.github.io/manual.html#type-mismatch",
			"path": "/manual.html",
			"scheme": "https",
			"authority": "rust-analyzer.github.io",
			"fragment": "type-mismatch"
		}
	},
	"severity": 8,
	"message": "expected &String, found String",
	"source": "rust-analyzer",
	"startLineNumber": 219,
	"startColumn": 19,
	"endLineNumber": 219,
	"endColumn": 32
}]

I also saw a similar error in a file somewhere in the rustc repository but forgot where...

rust-analyzer version: rust-analyzer version: 46d7ee6 2022-04-04 stable

rustc version: rustc 1.62.0-nightly (fbdb10f9f 2022-04-09)

relevant settings: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions