-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation failure with no explicit error when passing ref std::path::Path to std::fs::File::open #38954
Comments
minimal repro example: pub fn f(ref p: str) {} reproduces on playground, can't reproduce with locally installed rust ( |
@beamspease: I suggest you use pub fn from_filepath(p: &std::path::Path) instead. The missing error message is the issue here. To best of my knowledge the code as you wrote it is illegal, but should report an error. |
Thanks, good to know. Coming from a C background it doesn't look wrong to
me yet when the qualifiers are on the left-hand side. :)
- Steven
…On Tue, Jan 10, 2017 at 2:36 AM, Oliver Schneider ***@***.***> wrote:
@beamspease <https://github.com/beamspease>: I suggest you use
pub fn from_filepath(p: &std::path::Path)
instead. The missing error message is the issue here. To best of my
knowledge the code as you wrote it is illegal, but should report an error.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38954 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMDN20qQHsin72txpKYCENTMuQHN-nFqks5rQ18ugaJpZM4LfD9Z>
.
--
- Steven
|
Seems fine today; we should probably have a test for this, E-needstest. |
…=Mark-Simulacrum regression tests for ICEs closes rust-lang#36379 closes rust-lang#37550 closes rust-lang#37665 closes rust-lang#38160 closes rust-lang#38954 closes rust-lang#39362 r? @Mark-Simulacrum
…=Mark-Simulacrum regression tests for ICEs closes rust-lang#36379 closes rust-lang#37550 closes rust-lang#37665 closes rust-lang#38160 closes rust-lang#38954 closes rust-lang#39362 r? @Mark-Simulacrum
…=Mark-Simulacrum regression tests for ICEs closes rust-lang#36379 closes rust-lang#37550 closes rust-lang#37665 closes rust-lang#38160 closes rust-lang#38954 closes rust-lang#39362 r? @Mark-Simulacrum
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!
The text was updated successfully, but these errors were encountered: