Skip to content

Compilation failure with no explicit error when passing ref std::path::Path to std::fs::File::open #38954

Closed
@beamspease

Description

@beamspease

I'm fairly new to Rust, so there may be something I'm missing here.

The following code snippet causes the Rust compiler (1.14, beta 1.15, nightly 1.16) to crash without any explicit errors on an up-to-date Arch Linux system immediately after a rustup update.

Cargo.toml
[package] name = "crash" version = "0.1.0"

lib.rs
pub fn from_filepath(ref p: std::path::Path) -> std::io::Result<std::fs::File> { std::fs::File::open(p) }

The only error I see is:
error: Could not compile 'crash'.

If I specify -vv, I just see the full command line (with a return code of -1).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-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