Skip to content

Commit

Permalink
Bless NativePath
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Feb 28, 2024
1 parent b8bf308 commit 1578ab6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/tools/miri/tests/fail/shims/fs/isolated_file.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a
= help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning
= note: BACKTRACE:
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::cvt_r::<i32, {closure@std::sys::pal::PLATFORM::fs::File::open_c::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr_stack::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::sys::pal::PLATFORM::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::cvt_r::<i32, {closure@std::sys::pal::PLATFORM::fs::File::open_native::{closure#0}}>` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::fs::File::open_native` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
= note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC
= note: inside closure at RUSTLIB/std/src/fs.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr_stack::<std::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_with_cstr::<std::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::pal::PLATFORM::small_c_string::run_path_with_cstr::<std::fs::File>` at RUSTLIB/std/src/sys/pal/PLATFORM/small_c_string.rs:LL:CC
= note: inside `std::sys::path::cstr_native::<impl std::path::AsPath for &str>::with_native_path::<std::fs::File, {closure@std::fs::OpenOptions::open<&str>::{closure#0}}>` at RUSTLIB/std/src/sys/path/cstr_native.rs:LL:CC
= note: inside `std::fs::OpenOptions::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
= note: inside `std::fs::File::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
note: inside `main`
--> $DIR/isolated_file.rs:LL:CC
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/async-await/issue-72442.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied
--> $DIR/issue-72442.rs:12:36
|
LL | let mut f = File::open(path.to_str())?;
| ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`
| ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`, which is required by `Option<&str>: AsPath`
| |
| required by a bound introduced by this call
|
= help: the trait `AsPath` is implemented for `&NativePath`
= note: required for `Option<&str>` to implement `AsPath`
note: required by a bound in `File::open`
--> $SRC_DIR/std/src/fs.rs:LL:COL
help: consider removing this method call, as the receiver has type `&Path` and `&Path: AsRef<Path>` trivially holds
Expand Down

0 comments on commit 1578ab6

Please sign in to comment.