Skip to content

Associated functions on extern types not found across crates #49659

Closed
@SimonSapin

Description

@SimonSapin

Crate a:

#![feature(extern_types)]

extern {
    pub type Void;
}

impl Void {
    /// Similar to `std::ptr::null_mut`, which requires `T: Sized`.
    pub fn null_mut() -> *mut Self {
        0 as _
    }
}

pub fn foo() {
    let _ = Void::null_mut();  // This is fine
}

Crate b:

extern crate a;

fn main() {
    let _ = a::Void::null_mut();
}
error[E0599]: no function or associated item named `null_mut` found for type `a::Void` in the current scope
 --> src/main.rs:4:13
  |
4 |     let _ = a::Void::null_mut();
  |             ^^^^^^^^^^^^^^^^^ function or associated item not found in `a::Void`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyT-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