Skip to content

Cannot infer type even if specified. #42424

Open
@jD91mZM2

Description

@jD91mZM2

So, I got the type annotations needed error. I tried everything. It refuses to work.

		let tmp: Result<NamedTempFile, ()> = NamedTempFile::new().map_err::<(), _>(|_: std::io::Error| ());
		let mut tmp: NamedTempFile = tmp?;

Error

image

(please don't tell me the code is stupid. I have a valid reason to ignore the error)

If this is my fault, and not an issue with Rust, apologies for spamming you with yet another false issue :(
I feel horrible

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.F-try_blocks`#![feature(try_blocks)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions