Skip to content

Failed type inference on having a mutable references. #18064

@dfireBird

Description

@dfireBird

rust-analyzer version: rust-analyzer version: 1 (779d9ee 2024-09-01) (Any version after release 2024-08-19 (v0.3.2078)

rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)

editor or extension: Code-OSS

relevant settings: default settings

code snippet to reproduce:

fn t_factory<T>() -> T {loop {}}
fn main() {
    let mut t = t_factory();
    unit_acceptor(&mut t)
}
fn unit_acceptor(_: &mut ()) {}

With minimal reproduction, the the type of t will be unknown currently. Caused by my PR #17595.
Currently have no valid fix as it's not clear how to fix and could be fixed after the introduction of the new trait solver (as mentioned by @flodiebold in Zulip, if I'm wrong please correct it).

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/HIR.20lowering.20for.20lifetimes (see last 5-10 messages)

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