Skip to content

Support local trait impls for non-local types for unnamed free constants #7550

Closed
@edwin0cheng

Description

@edwin0cheng

In following code:

trait Foo {}
struct A {}

const _ : () = {
    impl crate::Foo for crate::A {}  <---  (1)
};

(1) is local trait impls for non-local types. Currently we do not support it due to the fact that we do not want to look at the bodies of all functions and blocks. But is it possible to support this case solely, as an escape hatch for proc-macro author to workaround of lacking of proc-macro hygiene at the moment ?

What do you think about it @jonas-schievink ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nameresname, path and module resolutionA-tytype system / type inference / traits / method resolutionE-has-instructionsIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions