path-uri: clarify host-native path conversion (#29501)

## Why

Downstream refactors are producing confusing code with this
functionality having a very generic name. Encoding the specific
conversion approach in the method name makes it clearer.

## What

Rename `PathUri::from_path` to `PathUri::from_host_native_path` and
update its Rust call sites.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-23 00:02:33 +00:00
committed by GitHub
parent c53b1dae09
commit 11fab432be
31 changed files with 250 additions and 198 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ impl PathUri {
/// Relative paths are reported as invalid input. Absolute paths without a
/// valid URI representation use the fallback documented on
/// [`Self::from_abs_path`].
pub fn from_path(path: impl AsRef<Path>) -> io::Result<Self> {
pub fn from_host_native_path(path: impl AsRef<Path>) -> io::Result<Self> {
let path = AbsolutePathBuf::from_absolute_path_checked(path)
.map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err))?;
Ok(Self::from_abs_path(&path))
+2 -1
View File
@@ -423,7 +423,8 @@ fn path_uri_deserializes_legacy_absolute_paths() {
#[test]
fn path_uri_rejects_relative_native_paths() {
let error = PathUri::from_path("src/lib.rs").expect_err("relative path should be rejected");
let error =
PathUri::from_host_native_path("src/lib.rs").expect_err("relative path should be rejected");
assert_eq!(error.kind(), io::ErrorKind::InvalidInput);
}