Skip to content

Regression in method resolution through Deref #17594

Description

@sfackler

This should compile but no longer does:

use std::cell::RefCell;

trait Foo {
    fn foo(&self) {}
}

impl<T> Foo for T where T: Clone {}

struct Bar;

impl Bar {
    fn foo(&self) {}
}

fn main() {
    let b = RefCell::new(Bar);
    b.borrow().foo()
}
test.rs:17:5: 17:21 error: the trait `core::clone::Clone` is not implemented for the type `core::cell::Ref<'_,Bar>`
test.rs:17     b.borrow().foo()
               ^~~~~~~~~~~~~~~~

Note that calling Bar.foo() directly works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions