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

Browse files
committedJun 15, 2024
Auto merge of rust-lang#126518 - matthiaskrgr:rollup-wb70rzq, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#125829 (rustc_span: Add conveniences for working with span formats) - rust-lang#126361 (Unify intrinsics body handling in StableMIR) - rust-lang#126417 (Add `f16` and `f128` inline ASM support for `x86` and `x86-64`) - rust-lang#126424 ( Also sort `crt-static` in `--print target-features` output) - rust-lang#126428 (Polish `std::path::absolute` documentation.) - rust-lang#126429 (Add `f16` and `f128` const eval for binary and unary operationations) - rust-lang#126448 (End support for Python 3.8 in tidy) - rust-lang#126488 (Use `std::path::absolute` in bootstrap) - rust-lang#126511 (.mailmap: Associate both my work and my private email with me) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2678593 + b509ed2 commit 7e3c4f8

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed
 

‎std/src/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
23022302
///
23032303
/// This function currently corresponds to the `realpath` function on Unix
23042304
/// and the `CreateFile` and `GetFinalPathNameByHandle` functions on Windows.
2305-
/// Note that, this [may change in the future][changes].
2305+
/// Note that this [may change in the future][changes].
23062306
///
23072307
/// On Windows, this converts the path to use [extended length path][path]
23082308
/// syntax, which allows your program to use longer path names, but means you

‎std/src/path.rs

+38-27
Original file line numberDiff line numberDiff line change
@@ -3345,65 +3345,76 @@ impl Error for StripPrefixError {
33453345
/// Makes the path absolute without accessing the filesystem.
33463346
///
33473347
/// If the path is relative, the current directory is used as the base directory.
3348-
/// All intermediate components will be resolved according to platforms-specific
3349-
/// rules but unlike [`canonicalize`][crate::fs::canonicalize] this does not
3348+
/// All intermediate components will be resolved according to platform-specific
3349+
/// rules, but unlike [`canonicalize`][crate::fs::canonicalize], this does not
33503350
/// resolve symlinks and may succeed even if the path does not exist.
33513351
///
33523352
/// If the `path` is empty or getting the
3353-
/// [current directory][crate::env::current_dir] fails then an error will be
3353+
/// [current directory][crate::env::current_dir] fails, then an error will be
33543354
/// returned.
33553355
///
3356+
/// # Platform-specific behavior
3357+
///
3358+
/// On POSIX platforms, the path is resolved using [POSIX semantics][posix-semantics],
3359+
/// except that it stops short of resolving symlinks. This means it will keep `..`
3360+
/// components and trailing slashes.
3361+
///
3362+
/// On Windows, for verbatim paths, this will simply return the path as given. For other
3363+
/// paths, this is currently equivalent to calling
3364+
/// [`GetFullPathNameW`][windows-path].
3365+
///
3366+
/// Note that these [may change in the future][changes].
3367+
///
3368+
/// # Errors
3369+
///
3370+
/// This function may return an error in the following situations:
3371+
///
3372+
/// * If `path` is syntactically invalid; in particular, if it is empty.
3373+
/// * If getting the [current directory][crate::env::current_dir] fails.
3374+
///
33563375
/// # Examples
33573376
///
33583377
/// ## POSIX paths
33593378
///
33603379
/// ```
33613380
/// # #[cfg(unix)]
33623381
/// fn main() -> std::io::Result<()> {
3363-
/// use std::path::{self, Path};
3382+
/// use std::path::{self, Path};
33643383
///
3365-
/// // Relative to absolute
3366-
/// let absolute = path::absolute("foo/./bar")?;
3367-
/// assert!(absolute.ends_with("foo/bar"));
3384+
/// // Relative to absolute
3385+
/// let absolute = path::absolute("foo/./bar")?;
3386+
/// assert!(absolute.ends_with("foo/bar"));
33683387
///
3369-
/// // Absolute to absolute
3370-
/// let absolute = path::absolute("/foo//test/.././bar.rs")?;
3371-
/// assert_eq!(absolute, Path::new("/foo/test/../bar.rs"));
3372-
/// Ok(())
3388+
/// // Absolute to absolute
3389+
/// let absolute = path::absolute("/foo//test/.././bar.rs")?;
3390+
/// assert_eq!(absolute, Path::new("/foo/test/../bar.rs"));
3391+
/// Ok(())
33733392
/// }
33743393
/// # #[cfg(not(unix))]
33753394
/// # fn main() {}
33763395
/// ```
33773396
///
3378-
/// The path is resolved using [POSIX semantics][posix-semantics] except that
3379-
/// it stops short of resolving symlinks. This means it will keep `..`
3380-
/// components and trailing slashes.
3381-
///
33823397
/// ## Windows paths
33833398
///
33843399
/// ```
33853400
/// # #[cfg(windows)]
33863401
/// fn main() -> std::io::Result<()> {
3387-
/// use std::path::{self, Path};
3402+
/// use std::path::{self, Path};
33883403
///
3389-
/// // Relative to absolute
3390-
/// let absolute = path::absolute("foo/./bar")?;
3391-
/// assert!(absolute.ends_with(r"foo\bar"));
3404+
/// // Relative to absolute
3405+
/// let absolute = path::absolute("foo/./bar")?;
3406+
/// assert!(absolute.ends_with(r"foo\bar"));
33923407
///
3393-
/// // Absolute to absolute
3394-
/// let absolute = path::absolute(r"C:\foo//test\..\./bar.rs")?;
3408+
/// // Absolute to absolute
3409+
/// let absolute = path::absolute(r"C:\foo//test\..\./bar.rs")?;
33953410
///
3396-
/// assert_eq!(absolute, Path::new(r"C:\foo\bar.rs"));
3397-
/// Ok(())
3411+
/// assert_eq!(absolute, Path::new(r"C:\foo\bar.rs"));
3412+
/// Ok(())
33983413
/// }
33993414
/// # #[cfg(not(windows))]
34003415
/// # fn main() {}
34013416
/// ```
34023417
///
3403-
/// For verbatim paths this will simply return the path as given. For other
3404-
/// paths this is currently equivalent to calling
3405-
/// [`GetFullPathNameW`][windows-path].
3406-
///
34073418
/// Note that this [may change in the future][changes].
34083419
///
34093420
/// [changes]: io#platform-specific-behavior

0 commit comments

Comments
 (0)
Failed to load comments.