Skip to content

DST coercions fall over with UFCS #27843

Open
@Gankra

Description

@Gankra
#![feature(core, rc_weak)]

use std::cell::RefCell;
use std::rc::{Rc, Weak};

trait Baz { fn get(&self) -> i32; }
impl Baz for i32 { fn get(&self) -> i32 { *self } }

fn main() {
    let a: Rc<RefCell<i32>> = Rc::new(RefCell::new(42));
    let c1: Weak<RefCell<Baz>> = Rc::downgrade(&a);             // Doesn't work
    let c2: Weak<RefCell<Baz>> = Rc::downgrade(&a) as Weak<_>;  // works
    let c3: Weak<RefCell<Baz>> = a.downgrade();                 // works
}

CC @nrc

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions