Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cfc57ac

Browse files
committedFeb 28, 2024
Bless NativePath
1 parent 1c339d7 commit cfc57ac

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed
 

‎src/tools/miri/tests/fail/shims/fs/isolated_file.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ LL | let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode a
88
= 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
99
= note: BACKTRACE:
1010
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
11-
= 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
12-
= note: inside `std::sys::pal::PLATFORM::fs::File::open_c` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
13-
= note: inside closure at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
14-
= 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
15-
= 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
16-
= 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
17-
= note: inside `std::sys::pal::PLATFORM::fs::File::open` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
11+
= 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
12+
= note: inside `std::sys::pal::PLATFORM::fs::File::open_native` at RUSTLIB/std/src/sys/pal/PLATFORM/fs.rs:LL:CC
1813
= note: inside `std::fs::OpenOptions::_open` at RUSTLIB/std/src/fs.rs:LL:CC
19-
= note: inside `std::fs::OpenOptions::open::<&std::path::Path>` at RUSTLIB/std/src/fs.rs:LL:CC
14+
= note: inside closure at RUSTLIB/std/src/fs.rs:LL:CC
15+
= 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
16+
= 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
17+
= 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
18+
= 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
19+
= note: inside `std::fs::OpenOptions::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
2020
= note: inside `std::fs::File::open::<&str>` at RUSTLIB/std/src/fs.rs:LL:CC
2121
note: inside `main`
2222
--> $DIR/isolated_file.rs:LL:CC

‎tests/ui/async-await/issue-72442.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied
22
--> $DIR/issue-72442.rs:12:36
33
|
44
LL | let mut f = File::open(path.to_str())?;
5-
| ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`
5+
| ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`, which is required by `Option<&str>: AsPath`
66
| |
77
| required by a bound introduced by this call
88
|
9+
= help: the following other types implement trait `AsPath`:
10+
&NativePath
11+
&CStr
12+
= note: required for `Option<&str>` to implement `AsPath`
913
note: required by a bound in `File::open`
1014
--> $SRC_DIR/std/src/fs.rs:LL:COL
1115
help: consider removing this method call, as the receiver has type `&Path` and `&Path: AsRef<Path>` trivially holds

0 commit comments

Comments
 (0)
Failed to load comments.