| author | bors <bors@rust-lang.org> 2025-03-29 23:12:40 UTC |
| committer | bors <bors@rust-lang.org> 2025-03-29 23:12:40 UTC |
| log | 2196affd0165ee2352522d33544447c61d351937 |
| tree | 996a8a3ea8f0f323430ee5685d69786ea8f77a27 |
| parent | 1799887bb281d1ab49287750f1950b8c738c6b77 |
| parent | ed1f776e5cf110d7ac10c1a78417de488e73db93 |
Rollup of 7 pull requests
Successful merges:
- #137928 (stabilize const_cell)
- #138431 (Fix `uclibc` LLVM target triples)
- #138832 (Start using `with_native_path` in `std::sys::fs`)
- #139081 (std: deduplicate `errno` accesses)
- #139100 (compiletest: Support matching diagnostics on lines below)
- #139105 (`BackendRepr::is_signed`: comment why this may panics)
- #139106 (Mark .pp files as Rust)
r? `@ghost`
`@rustbot` modify labels: rollup43 files changed, 264 insertions(+), 173 deletions(-)
.gitattributes+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | *.h rust |
| 6 | 6 | *.rs rust diff=rust |
| 7 | 7 | *.fixed linguist-language=Rust |
| 8 | *.pp linguist-language=Rust | |
| 8 | 9 | *.mir linguist-language=Rust |
| 9 | 10 | src/etc/installer/gfx/* binary |
| 10 | 11 | src/vendor/** -text |
compiler/rustc_abi/src/lib.rs+2-1| ... | ... | @@ -1462,7 +1462,8 @@ impl BackendRepr { |
| 1462 | 1462 | !self.is_unsized() |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | /// Returns `true` if this is a single signed integer scalar | |
| 1465 | /// Returns `true` if this is a single signed integer scalar. | |
| 1466 | /// Sanity check: panics if this is not a scalar type (see PR #70189). | |
| 1466 | 1467 | #[inline] |
| 1467 | 1468 | pub fn is_signed(&self) -> bool { |
| 1468 | 1469 | match self { |
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ use crate::spec::{FloatAbi, Target, TargetMetadata, TargetOptions, base}; |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| 5 | llvm_target: "armv5te-unknown-linux-uclibcgnueabi".into(), | |
| 5 | llvm_target: "armv5te-unknown-linux-gnueabi".into(), | |
| 6 | 6 | metadata: TargetMetadata { |
| 7 | 7 | description: Some("Armv5TE Linux with uClibc".into()), |
| 8 | 8 | tier: Some(3), |
compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs+1-1| ... | ... | @@ -4,7 +4,7 @@ use crate::spec::{Target, TargetMetadata, TargetOptions, base}; |
| 4 | 4 | |
| 5 | 5 | pub(crate) fn target() -> Target { |
| 6 | 6 | Target { |
| 7 | llvm_target: "mips-unknown-linux-uclibc".into(), | |
| 7 | llvm_target: "mips-unknown-linux-gnu".into(), | |
| 8 | 8 | metadata: TargetMetadata { |
| 9 | 9 | description: Some("MIPS Linux with uClibc".into()), |
| 10 | 10 | tier: Some(3), |
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ use crate::spec::{Target, TargetMetadata, TargetOptions, base}; |
| 2 | 2 | |
| 3 | 3 | pub(crate) fn target() -> Target { |
| 4 | 4 | Target { |
| 5 | llvm_target: "mipsel-unknown-linux-uclibc".into(), | |
| 5 | llvm_target: "mipsel-unknown-linux-gnu".into(), | |
| 6 | 6 | metadata: TargetMetadata { |
| 7 | 7 | description: Some("MIPS (LE) Linux with uClibc".into()), |
| 8 | 8 | tier: Some(3), |
compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { |
| 8 | 8 | base.panic_strategy = PanicStrategy::Abort; |
| 9 | 9 | |
| 10 | 10 | Target { |
| 11 | llvm_target: "x86_64-unknown-l4re-uclibc".into(), | |
| 11 | llvm_target: "x86_64-unknown-l4re-gnu".into(), | |
| 12 | 12 | metadata: TargetMetadata { |
| 13 | 13 | description: None, |
| 14 | 14 | tier: Some(3), |
library/core/src/cell.rs+5-5| ... | ... | @@ -495,7 +495,7 @@ impl<T> Cell<T> { |
| 495 | 495 | /// ``` |
| 496 | 496 | #[inline] |
| 497 | 497 | #[stable(feature = "move_cell", since = "1.17.0")] |
| 498 | #[rustc_const_unstable(feature = "const_cell", issue = "131283")] | |
| 498 | #[rustc_const_stable(feature = "const_cell", since = "CURRENT_RUSTC_VERSION")] | |
| 499 | 499 | #[rustc_confusables("swap")] |
| 500 | 500 | pub const fn replace(&self, val: T) -> T { |
| 501 | 501 | // SAFETY: This can cause data races if called from a separate thread, |
| ... | ... | @@ -537,7 +537,7 @@ impl<T: Copy> Cell<T> { |
| 537 | 537 | /// ``` |
| 538 | 538 | #[inline] |
| 539 | 539 | #[stable(feature = "rust1", since = "1.0.0")] |
| 540 | #[rustc_const_unstable(feature = "const_cell", issue = "131283")] | |
| 540 | #[rustc_const_stable(feature = "const_cell", since = "CURRENT_RUSTC_VERSION")] | |
| 541 | 541 | pub const fn get(&self) -> T { |
| 542 | 542 | // SAFETY: This can cause data races if called from a separate thread, |
| 543 | 543 | // but `Cell` is `!Sync` so this won't happen. |
| ... | ... | @@ -617,7 +617,7 @@ impl<T: ?Sized> Cell<T> { |
| 617 | 617 | /// ``` |
| 618 | 618 | #[inline] |
| 619 | 619 | #[stable(feature = "cell_get_mut", since = "1.11.0")] |
| 620 | #[rustc_const_unstable(feature = "const_cell", issue = "131283")] | |
| 620 | #[rustc_const_stable(feature = "const_cell", since = "CURRENT_RUSTC_VERSION")] | |
| 621 | 621 | pub const fn get_mut(&mut self) -> &mut T { |
| 622 | 622 | self.value.get_mut() |
| 623 | 623 | } |
| ... | ... | @@ -637,7 +637,7 @@ impl<T: ?Sized> Cell<T> { |
| 637 | 637 | /// ``` |
| 638 | 638 | #[inline] |
| 639 | 639 | #[stable(feature = "as_cell", since = "1.37.0")] |
| 640 | #[rustc_const_unstable(feature = "const_cell", issue = "131283")] | |
| 640 | #[rustc_const_stable(feature = "const_cell", since = "CURRENT_RUSTC_VERSION")] | |
| 641 | 641 | pub const fn from_mut(t: &mut T) -> &Cell<T> { |
| 642 | 642 | // SAFETY: `&mut` ensures unique access. |
| 643 | 643 | unsafe { &*(t as *mut T as *const Cell<T>) } |
| ... | ... | @@ -695,7 +695,7 @@ impl<T> Cell<[T]> { |
| 695 | 695 | /// assert_eq!(slice_cell.len(), 3); |
| 696 | 696 | /// ``` |
| 697 | 697 | #[stable(feature = "as_cell", since = "1.37.0")] |
| 698 | #[rustc_const_unstable(feature = "const_cell", issue = "131283")] | |
| 698 | #[rustc_const_stable(feature = "const_cell", since = "CURRENT_RUSTC_VERSION")] | |
| 699 | 699 | pub const fn as_slice_of_cells(&self) -> &[Cell<T>] { |
| 700 | 700 | // SAFETY: `Cell<T>` has the same memory layout as `T`. |
| 701 | 701 | unsafe { &*(self as *const Cell<[T]> as *const [Cell<T>]) } |
library/std/src/fs.rs+8-8| ... | ... | @@ -2370,7 +2370,7 @@ impl AsInner<fs_imp::DirEntry> for DirEntry { |
| 2370 | 2370 | #[doc(alias = "rm", alias = "unlink", alias = "DeleteFile")] |
| 2371 | 2371 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2372 | 2372 | pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> { |
| 2373 | fs_imp::unlink(path.as_ref()) | |
| 2373 | fs_imp::remove_file(path.as_ref()) | |
| 2374 | 2374 | } |
| 2375 | 2375 | |
| 2376 | 2376 | /// Given a path, queries the file system to get information about a file, |
| ... | ... | @@ -2409,7 +2409,7 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> { |
| 2409 | 2409 | #[doc(alias = "stat")] |
| 2410 | 2410 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2411 | 2411 | pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { |
| 2412 | fs_imp::stat(path.as_ref()).map(Metadata) | |
| 2412 | fs_imp::metadata(path.as_ref()).map(Metadata) | |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | 2415 | /// Queries the metadata about a file without following symlinks. |
| ... | ... | @@ -2444,7 +2444,7 @@ pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { |
| 2444 | 2444 | #[doc(alias = "lstat")] |
| 2445 | 2445 | #[stable(feature = "symlink_metadata", since = "1.1.0")] |
| 2446 | 2446 | pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { |
| 2447 | fs_imp::lstat(path.as_ref()).map(Metadata) | |
| 2447 | fs_imp::symlink_metadata(path.as_ref()).map(Metadata) | |
| 2448 | 2448 | } |
| 2449 | 2449 | |
| 2450 | 2450 | /// Renames a file or directory to a new name, replacing the original file if |
| ... | ... | @@ -2598,7 +2598,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> { |
| 2598 | 2598 | #[doc(alias = "CreateHardLink", alias = "linkat")] |
| 2599 | 2599 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2600 | 2600 | pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> { |
| 2601 | fs_imp::link(original.as_ref(), link.as_ref()) | |
| 2601 | fs_imp::hard_link(original.as_ref(), link.as_ref()) | |
| 2602 | 2602 | } |
| 2603 | 2603 | |
| 2604 | 2604 | /// Creates a new symbolic link on the filesystem. |
| ... | ... | @@ -2664,7 +2664,7 @@ pub fn soft_link<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Re |
| 2664 | 2664 | /// ``` |
| 2665 | 2665 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2666 | 2666 | pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> { |
| 2667 | fs_imp::readlink(path.as_ref()) | |
| 2667 | fs_imp::read_link(path.as_ref()) | |
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | /// Returns the canonical, absolute form of a path with all intermediate |
| ... | ... | @@ -2840,7 +2840,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { |
| 2840 | 2840 | #[doc(alias = "rmdir", alias = "RemoveDirectory")] |
| 2841 | 2841 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2842 | 2842 | pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { |
| 2843 | fs_imp::rmdir(path.as_ref()) | |
| 2843 | fs_imp::remove_dir(path.as_ref()) | |
| 2844 | 2844 | } |
| 2845 | 2845 | |
| 2846 | 2846 | /// Removes a directory at this path, after removing all its contents. Use |
| ... | ... | @@ -2967,7 +2967,7 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { |
| 2967 | 2967 | #[doc(alias = "ls", alias = "opendir", alias = "FindFirstFile", alias = "FindNextFile")] |
| 2968 | 2968 | #[stable(feature = "rust1", since = "1.0.0")] |
| 2969 | 2969 | pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> { |
| 2970 | fs_imp::readdir(path.as_ref()).map(ReadDir) | |
| 2970 | fs_imp::read_dir(path.as_ref()).map(ReadDir) | |
| 2971 | 2971 | } |
| 2972 | 2972 | |
| 2973 | 2973 | /// Changes the permissions found on a file or a directory. |
| ... | ... | @@ -3003,7 +3003,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> { |
| 3003 | 3003 | #[doc(alias = "chmod", alias = "SetFileAttributes")] |
| 3004 | 3004 | #[stable(feature = "set_permissions", since = "1.1.0")] |
| 3005 | 3005 | pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions) -> io::Result<()> { |
| 3006 | fs_imp::set_perm(path.as_ref(), perm.0) | |
| 3006 | fs_imp::set_permissions(path.as_ref(), perm.0) | |
| 3007 | 3007 | } |
| 3008 | 3008 | |
| 3009 | 3009 | impl DirBuilder { |
library/std/src/lib.rs+1| ... | ... | @@ -297,6 +297,7 @@ |
| 297 | 297 | #![feature(extended_varargs_abi_support)] |
| 298 | 298 | #![feature(f128)] |
| 299 | 299 | #![feature(f16)] |
| 300 | #![feature(ffi_const)] | |
| 300 | 301 | #![feature(formatting_options)] |
| 301 | 302 | #![feature(if_let_guard)] |
| 302 | 303 | #![feature(intra_doc_pointers)] |
library/std/src/sys/fs/mod.rs+94-7| ... | ... | @@ -1,28 +1,115 @@ |
| 1 | 1 | #![deny(unsafe_op_in_unsafe_fn)] |
| 2 | 2 | |
| 3 | use crate::io; | |
| 4 | use crate::path::{Path, PathBuf}; | |
| 5 | ||
| 3 | 6 | pub mod common; |
| 4 | 7 | |
| 5 | 8 | cfg_if::cfg_if! { |
| 6 | 9 | if #[cfg(target_family = "unix")] { |
| 7 | 10 | mod unix; |
| 8 | pub use unix::*; | |
| 11 | use unix as imp; | |
| 12 | pub use unix::{chown, fchown, lchown}; | |
| 13 | #[cfg(not(target_os = "fuchsia"))] | |
| 14 | pub use unix::chroot; | |
| 15 | pub(crate) use unix::debug_assert_fd_is_open; | |
| 16 | #[cfg(any(target_os = "linux", target_os = "android"))] | |
| 17 | pub(crate) use unix::CachedFileMetadata; | |
| 18 | use crate::sys::common::small_c_string::run_path_with_cstr as with_native_path; | |
| 9 | 19 | } else if #[cfg(target_os = "windows")] { |
| 10 | 20 | mod windows; |
| 11 | pub use windows::*; | |
| 21 | use windows as imp; | |
| 22 | pub use windows::{symlink_inner, junction_point}; | |
| 12 | 23 | } else if #[cfg(target_os = "hermit")] { |
| 13 | 24 | mod hermit; |
| 14 | pub use hermit::*; | |
| 25 | use hermit as imp; | |
| 15 | 26 | } else if #[cfg(target_os = "solid_asp3")] { |
| 16 | 27 | mod solid; |
| 17 | pub use solid::*; | |
| 28 | use solid as imp; | |
| 18 | 29 | } else if #[cfg(target_os = "uefi")] { |
| 19 | 30 | mod uefi; |
| 20 | pub use uefi::*; | |
| 31 | use uefi as imp; | |
| 21 | 32 | } else if #[cfg(target_os = "wasi")] { |
| 22 | 33 | mod wasi; |
| 23 | pub use wasi::*; | |
| 34 | use wasi as imp; | |
| 24 | 35 | } else { |
| 25 | 36 | mod unsupported; |
| 26 | pub use unsupported::*; | |
| 37 | use unsupported as imp; | |
| 27 | 38 | } |
| 28 | 39 | } |
| 40 | ||
| 41 | // FIXME: Replace this with platform-specific path conversion functions. | |
| 42 | #[cfg(not(target_family = "unix"))] | |
| 43 | #[inline] | |
| 44 | pub fn with_native_path<T>(path: &Path, f: &dyn Fn(&Path) -> io::Result<T>) -> io::Result<T> { | |
| 45 | f(path) | |
| 46 | } | |
| 47 | ||
| 48 | pub use imp::{ | |
| 49 | DirBuilder, DirEntry, File, FileAttr, FilePermissions, FileTimes, FileType, OpenOptions, | |
| 50 | ReadDir, | |
| 51 | }; | |
| 52 | ||
| 53 | pub fn read_dir(path: &Path) -> io::Result<ReadDir> { | |
| 54 | // FIXME: use with_native_path | |
| 55 | imp::readdir(path) | |
| 56 | } | |
| 57 | ||
| 58 | pub fn remove_file(path: &Path) -> io::Result<()> { | |
| 59 | with_native_path(path, &imp::unlink) | |
| 60 | } | |
| 61 | ||
| 62 | pub fn rename(old: &Path, new: &Path) -> io::Result<()> { | |
| 63 | with_native_path(old, &|old| with_native_path(new, &|new| imp::rename(old, new))) | |
| 64 | } | |
| 65 | ||
| 66 | pub fn remove_dir(path: &Path) -> io::Result<()> { | |
| 67 | with_native_path(path, &imp::rmdir) | |
| 68 | } | |
| 69 | ||
| 70 | pub fn remove_dir_all(path: &Path) -> io::Result<()> { | |
| 71 | // FIXME: use with_native_path | |
| 72 | imp::remove_dir_all(path) | |
| 73 | } | |
| 74 | ||
| 75 | pub fn read_link(path: &Path) -> io::Result<PathBuf> { | |
| 76 | with_native_path(path, &imp::readlink) | |
| 77 | } | |
| 78 | ||
| 79 | pub fn symlink(original: &Path, link: &Path) -> io::Result<()> { | |
| 80 | with_native_path(original, &|original| { | |
| 81 | with_native_path(link, &|link| imp::symlink(original, link)) | |
| 82 | }) | |
| 83 | } | |
| 84 | ||
| 85 | pub fn hard_link(original: &Path, link: &Path) -> io::Result<()> { | |
| 86 | with_native_path(original, &|original| { | |
| 87 | with_native_path(link, &|link| imp::link(original, link)) | |
| 88 | }) | |
| 89 | } | |
| 90 | ||
| 91 | pub fn metadata(path: &Path) -> io::Result<FileAttr> { | |
| 92 | with_native_path(path, &imp::stat) | |
| 93 | } | |
| 94 | ||
| 95 | pub fn symlink_metadata(path: &Path) -> io::Result<FileAttr> { | |
| 96 | with_native_path(path, &imp::lstat) | |
| 97 | } | |
| 98 | ||
| 99 | pub fn set_permissions(path: &Path, perm: FilePermissions) -> io::Result<()> { | |
| 100 | with_native_path(path, &|path| imp::set_perm(path, perm.clone())) | |
| 101 | } | |
| 102 | ||
| 103 | pub fn canonicalize(path: &Path) -> io::Result<PathBuf> { | |
| 104 | with_native_path(path, &imp::canonicalize) | |
| 105 | } | |
| 106 | ||
| 107 | pub fn copy(from: &Path, to: &Path) -> io::Result<u64> { | |
| 108 | // FIXME: use with_native_path | |
| 109 | imp::copy(from, to) | |
| 110 | } | |
| 111 | ||
| 112 | pub fn exists(path: &Path) -> io::Result<bool> { | |
| 113 | // FIXME: use with_native_path | |
| 114 | imp::exists(path) | |
| 115 | } |
library/std/src/sys/fs/unix.rs+79-100| ... | ... | @@ -926,7 +926,7 @@ impl DirEntry { |
| 926 | 926 | miri |
| 927 | 927 | ))] |
| 928 | 928 | pub fn metadata(&self) -> io::Result<FileAttr> { |
| 929 | lstat(&self.path()) | |
| 929 | run_path_with_cstr(&self.path(), &lstat) | |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | #[cfg(any( |
| ... | ... | @@ -1657,7 +1657,7 @@ impl fmt::Debug for File { |
| 1657 | 1657 | fn get_path(fd: c_int) -> Option<PathBuf> { |
| 1658 | 1658 | let mut p = PathBuf::from("/proc/self/fd"); |
| 1659 | 1659 | p.push(&fd.to_string()); |
| 1660 | readlink(&p).ok() | |
| 1660 | run_path_with_cstr(&p, &readlink).ok() | |
| 1661 | 1661 | } |
| 1662 | 1662 | |
| 1663 | 1663 | #[cfg(any(target_vendor = "apple", target_os = "netbsd"))] |
| ... | ... | @@ -1675,7 +1675,7 @@ impl fmt::Debug for File { |
| 1675 | 1675 | // fallback to procfs as last resort |
| 1676 | 1676 | let mut p = PathBuf::from("/proc/self/fd"); |
| 1677 | 1677 | p.push(&fd.to_string()); |
| 1678 | return readlink(&p).ok(); | |
| 1678 | return run_path_with_cstr(&p, &readlink).ok() | |
| 1679 | 1679 | } else { |
| 1680 | 1680 | return None; |
| 1681 | 1681 | } |
| ... | ... | @@ -1830,127 +1830,106 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> { |
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | pub fn unlink(p: &Path) -> io::Result<()> { | |
| 1834 | run_path_with_cstr(p, &|p| cvt(unsafe { libc::unlink(p.as_ptr()) }).map(|_| ())) | |
| 1833 | pub fn unlink(p: &CStr) -> io::Result<()> { | |
| 1834 | cvt(unsafe { libc::unlink(p.as_ptr()) }).map(|_| ()) | |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | pub fn rename(old: &Path, new: &Path) -> io::Result<()> { | |
| 1838 | run_path_with_cstr(old, &|old| { | |
| 1839 | run_path_with_cstr(new, &|new| { | |
| 1840 | cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) }).map(|_| ()) | |
| 1841 | }) | |
| 1842 | }) | |
| 1837 | pub fn rename(old: &CStr, new: &CStr) -> io::Result<()> { | |
| 1838 | cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) }).map(|_| ()) | |
| 1843 | 1839 | } |
| 1844 | 1840 | |
| 1845 | pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> { | |
| 1846 | run_path_with_cstr(p, &|p| cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ())) | |
| 1841 | pub fn set_perm(p: &CStr, perm: FilePermissions) -> io::Result<()> { | |
| 1842 | cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ()) | |
| 1847 | 1843 | } |
| 1848 | 1844 | |
| 1849 | pub fn rmdir(p: &Path) -> io::Result<()> { | |
| 1850 | run_path_with_cstr(p, &|p| cvt(unsafe { libc::rmdir(p.as_ptr()) }).map(|_| ())) | |
| 1845 | pub fn rmdir(p: &CStr) -> io::Result<()> { | |
| 1846 | cvt(unsafe { libc::rmdir(p.as_ptr()) }).map(|_| ()) | |
| 1851 | 1847 | } |
| 1852 | 1848 | |
| 1853 | pub fn readlink(p: &Path) -> io::Result<PathBuf> { | |
| 1854 | run_path_with_cstr(p, &|c_path| { | |
| 1855 | let p = c_path.as_ptr(); | |
| 1856 | ||
| 1857 | let mut buf = Vec::with_capacity(256); | |
| 1849 | pub fn readlink(c_path: &CStr) -> io::Result<PathBuf> { | |
| 1850 | let p = c_path.as_ptr(); | |
| 1858 | 1851 | |
| 1859 | loop { | |
| 1860 | let buf_read = | |
| 1861 | cvt(unsafe { libc::readlink(p, buf.as_mut_ptr() as *mut _, buf.capacity()) })? | |
| 1862 | as usize; | |
| 1852 | let mut buf = Vec::with_capacity(256); | |
| 1863 | 1853 | |
| 1864 | unsafe { | |
| 1865 | buf.set_len(buf_read); | |
| 1866 | } | |
| 1854 | loop { | |
| 1855 | let buf_read = | |
| 1856 | cvt(unsafe { libc::readlink(p, buf.as_mut_ptr() as *mut _, buf.capacity()) })? as usize; | |
| 1867 | 1857 | |
| 1868 | if buf_read != buf.capacity() { | |
| 1869 | buf.shrink_to_fit(); | |
| 1858 | unsafe { | |
| 1859 | buf.set_len(buf_read); | |
| 1860 | } | |
| 1870 | 1861 | |
| 1871 | return Ok(PathBuf::from(OsString::from_vec(buf))); | |
| 1872 | } | |
| 1862 | if buf_read != buf.capacity() { | |
| 1863 | buf.shrink_to_fit(); | |
| 1873 | 1864 | |
| 1874 | // Trigger the internal buffer resizing logic of `Vec` by requiring | |
| 1875 | // more space than the current capacity. The length is guaranteed to be | |
| 1876 | // the same as the capacity due to the if statement above. | |
| 1877 | buf.reserve(1); | |
| 1865 | return Ok(PathBuf::from(OsString::from_vec(buf))); | |
| 1878 | 1866 | } |
| 1879 | }) | |
| 1867 | ||
| 1868 | // Trigger the internal buffer resizing logic of `Vec` by requiring | |
| 1869 | // more space than the current capacity. The length is guaranteed to be | |
| 1870 | // the same as the capacity due to the if statement above. | |
| 1871 | buf.reserve(1); | |
| 1872 | } | |
| 1880 | 1873 | } |
| 1881 | 1874 | |
| 1882 | pub fn symlink(original: &Path, link: &Path) -> io::Result<()> { | |
| 1883 | run_path_with_cstr(original, &|original| { | |
| 1884 | run_path_with_cstr(link, &|link| { | |
| 1885 | cvt(unsafe { libc::symlink(original.as_ptr(), link.as_ptr()) }).map(|_| ()) | |
| 1886 | }) | |
| 1887 | }) | |
| 1875 | pub fn symlink(original: &CStr, link: &CStr) -> io::Result<()> { | |
| 1876 | cvt(unsafe { libc::symlink(original.as_ptr(), link.as_ptr()) }).map(|_| ()) | |
| 1888 | 1877 | } |
| 1889 | 1878 | |
| 1890 | pub fn link(original: &Path, link: &Path) -> io::Result<()> { | |
| 1891 | run_path_with_cstr(original, &|original| { | |
| 1892 | run_path_with_cstr(link, &|link| { | |
| 1893 | cfg_if::cfg_if! { | |
| 1894 | if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70"))] { | |
| 1895 | // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves | |
| 1896 | // it implementation-defined whether `link` follows symlinks, so rely on the | |
| 1897 | // `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior. | |
| 1898 | // Android has `linkat` on newer versions, but we happen to know `link` | |
| 1899 | // always has the correct behavior, so it's here as well. | |
| 1900 | cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?; | |
| 1901 | } else { | |
| 1902 | // Where we can, use `linkat` instead of `link`; see the comment above | |
| 1903 | // this one for details on why. | |
| 1904 | cvt(unsafe { libc::linkat(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?; | |
| 1905 | } | |
| 1906 | } | |
| 1907 | Ok(()) | |
| 1908 | }) | |
| 1909 | }) | |
| 1879 | pub fn link(original: &CStr, link: &CStr) -> io::Result<()> { | |
| 1880 | cfg_if::cfg_if! { | |
| 1881 | if #[cfg(any(target_os = "vxworks", target_os = "redox", target_os = "android", target_os = "espidf", target_os = "horizon", target_os = "vita", target_env = "nto70"))] { | |
| 1882 | // VxWorks, Redox and ESP-IDF lack `linkat`, so use `link` instead. POSIX leaves | |
| 1883 | // it implementation-defined whether `link` follows symlinks, so rely on the | |
| 1884 | // `symlink_hard_link` test in library/std/src/fs/tests.rs to check the behavior. | |
| 1885 | // Android has `linkat` on newer versions, but we happen to know `link` | |
| 1886 | // always has the correct behavior, so it's here as well. | |
| 1887 | cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?; | |
| 1888 | } else { | |
| 1889 | // Where we can, use `linkat` instead of `link`; see the comment above | |
| 1890 | // this one for details on why. | |
| 1891 | cvt(unsafe { libc::linkat(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?; | |
| 1892 | } | |
| 1893 | } | |
| 1894 | Ok(()) | |
| 1910 | 1895 | } |
| 1911 | 1896 | |
| 1912 | pub fn stat(p: &Path) -> io::Result<FileAttr> { | |
| 1913 | run_path_with_cstr(p, &|p| { | |
| 1914 | cfg_has_statx! { | |
| 1915 | if let Some(ret) = unsafe { try_statx( | |
| 1916 | libc::AT_FDCWD, | |
| 1917 | p.as_ptr(), | |
| 1918 | libc::AT_STATX_SYNC_AS_STAT, | |
| 1919 | libc::STATX_BASIC_STATS | libc::STATX_BTIME, | |
| 1920 | ) } { | |
| 1921 | return ret; | |
| 1922 | } | |
| 1897 | pub fn stat(p: &CStr) -> io::Result<FileAttr> { | |
| 1898 | cfg_has_statx! { | |
| 1899 | if let Some(ret) = unsafe { try_statx( | |
| 1900 | libc::AT_FDCWD, | |
| 1901 | p.as_ptr(), | |
| 1902 | libc::AT_STATX_SYNC_AS_STAT, | |
| 1903 | libc::STATX_BASIC_STATS | libc::STATX_BTIME, | |
| 1904 | ) } { | |
| 1905 | return ret; | |
| 1923 | 1906 | } |
| 1907 | } | |
| 1924 | 1908 | |
| 1925 | let mut stat: stat64 = unsafe { mem::zeroed() }; | |
| 1926 | cvt(unsafe { stat64(p.as_ptr(), &mut stat) })?; | |
| 1927 | Ok(FileAttr::from_stat64(stat)) | |
| 1928 | }) | |
| 1909 | let mut stat: stat64 = unsafe { mem::zeroed() }; | |
| 1910 | cvt(unsafe { stat64(p.as_ptr(), &mut stat) })?; | |
| 1911 | Ok(FileAttr::from_stat64(stat)) | |
| 1929 | 1912 | } |
| 1930 | 1913 | |
| 1931 | pub fn lstat(p: &Path) -> io::Result<FileAttr> { | |
| 1932 | run_path_with_cstr(p, &|p| { | |
| 1933 | cfg_has_statx! { | |
| 1934 | if let Some(ret) = unsafe { try_statx( | |
| 1935 | libc::AT_FDCWD, | |
| 1936 | p.as_ptr(), | |
| 1937 | libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT, | |
| 1938 | libc::STATX_BASIC_STATS | libc::STATX_BTIME, | |
| 1939 | ) } { | |
| 1940 | return ret; | |
| 1941 | } | |
| 1914 | pub fn lstat(p: &CStr) -> io::Result<FileAttr> { | |
| 1915 | cfg_has_statx! { | |
| 1916 | if let Some(ret) = unsafe { try_statx( | |
| 1917 | libc::AT_FDCWD, | |
| 1918 | p.as_ptr(), | |
| 1919 | libc::AT_SYMLINK_NOFOLLOW | libc::AT_STATX_SYNC_AS_STAT, | |
| 1920 | libc::STATX_BASIC_STATS | libc::STATX_BTIME, | |
| 1921 | ) } { | |
| 1922 | return ret; | |
| 1942 | 1923 | } |
| 1924 | } | |
| 1943 | 1925 | |
| 1944 | let mut stat: stat64 = unsafe { mem::zeroed() }; | |
| 1945 | cvt(unsafe { lstat64(p.as_ptr(), &mut stat) })?; | |
| 1946 | Ok(FileAttr::from_stat64(stat)) | |
| 1947 | }) | |
| 1926 | let mut stat: stat64 = unsafe { mem::zeroed() }; | |
| 1927 | cvt(unsafe { lstat64(p.as_ptr(), &mut stat) })?; | |
| 1928 | Ok(FileAttr::from_stat64(stat)) | |
| 1948 | 1929 | } |
| 1949 | 1930 | |
| 1950 | pub fn canonicalize(p: &Path) -> io::Result<PathBuf> { | |
| 1951 | let r = run_path_with_cstr(p, &|path| unsafe { | |
| 1952 | Ok(libc::realpath(path.as_ptr(), ptr::null_mut())) | |
| 1953 | })?; | |
| 1931 | pub fn canonicalize(path: &CStr) -> io::Result<PathBuf> { | |
| 1932 | let r = unsafe { libc::realpath(path.as_ptr(), ptr::null_mut()) }; | |
| 1954 | 1933 | if r.is_null() { |
| 1955 | 1934 | return Err(io::Error::last_os_error()); |
| 1956 | 1935 | } |
| ... | ... | @@ -2328,19 +2307,19 @@ mod remove_dir_impl { |
| 2328 | 2307 | Ok(()) |
| 2329 | 2308 | } |
| 2330 | 2309 | |
| 2331 | fn remove_dir_all_modern(p: &Path) -> io::Result<()> { | |
| 2310 | fn remove_dir_all_modern(p: &CStr) -> io::Result<()> { | |
| 2332 | 2311 | // We cannot just call remove_dir_all_recursive() here because that would not delete a passed |
| 2333 | 2312 | // symlink. No need to worry about races, because remove_dir_all_recursive() does not recurse |
| 2334 | 2313 | // into symlinks. |
| 2335 | 2314 | let attr = lstat(p)?; |
| 2336 | 2315 | if attr.file_type().is_symlink() { |
| 2337 | crate::fs::remove_file(p) | |
| 2316 | super::unlink(p) | |
| 2338 | 2317 | } else { |
| 2339 | run_path_with_cstr(p, &|p| remove_dir_all_recursive(None, &p)) | |
| 2318 | remove_dir_all_recursive(None, &p) | |
| 2340 | 2319 | } |
| 2341 | 2320 | } |
| 2342 | 2321 | |
| 2343 | 2322 | pub fn remove_dir_all(p: &Path) -> io::Result<()> { |
| 2344 | remove_dir_all_modern(p) | |
| 2323 | run_path_with_cstr(p, &remove_dir_all_modern) | |
| 2345 | 2324 | } |
| 2346 | 2325 | } |
library/std/src/sys/pal/unix/os.rs+8| ... | ... | @@ -59,11 +59,14 @@ unsafe extern "C" { |
| 59 | 59 | #[cfg_attr(any(target_os = "freebsd", target_vendor = "apple"), link_name = "__error")] |
| 60 | 60 | #[cfg_attr(target_os = "haiku", link_name = "_errnop")] |
| 61 | 61 | #[cfg_attr(target_os = "aix", link_name = "_Errno")] |
| 62 | // SAFETY: this will always return the same pointer on a given thread. | |
| 63 | #[unsafe(ffi_const)] | |
| 62 | 64 | fn errno_location() -> *mut c_int; |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | 67 | /// Returns the platform-specific value of errno |
| 66 | 68 | #[cfg(not(any(target_os = "dragonfly", target_os = "vxworks", target_os = "rtems")))] |
| 69 | #[inline] | |
| 67 | 70 | pub fn errno() -> i32 { |
| 68 | 71 | unsafe { (*errno_location()) as i32 } |
| 69 | 72 | } |
| ... | ... | @@ -72,16 +75,19 @@ pub fn errno() -> i32 { |
| 72 | 75 | // needed for readdir and syscall! |
| 73 | 76 | #[cfg(all(not(target_os = "dragonfly"), not(target_os = "vxworks"), not(target_os = "rtems")))] |
| 74 | 77 | #[allow(dead_code)] // but not all target cfgs actually end up using it |
| 78 | #[inline] | |
| 75 | 79 | pub fn set_errno(e: i32) { |
| 76 | 80 | unsafe { *errno_location() = e as c_int } |
| 77 | 81 | } |
| 78 | 82 | |
| 79 | 83 | #[cfg(target_os = "vxworks")] |
| 84 | #[inline] | |
| 80 | 85 | pub fn errno() -> i32 { |
| 81 | 86 | unsafe { libc::errnoGet() } |
| 82 | 87 | } |
| 83 | 88 | |
| 84 | 89 | #[cfg(target_os = "rtems")] |
| 90 | #[inline] | |
| 85 | 91 | pub fn errno() -> i32 { |
| 86 | 92 | unsafe extern "C" { |
| 87 | 93 | #[thread_local] |
| ... | ... | @@ -92,6 +98,7 @@ pub fn errno() -> i32 { |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | 100 | #[cfg(target_os = "dragonfly")] |
| 101 | #[inline] | |
| 95 | 102 | pub fn errno() -> i32 { |
| 96 | 103 | unsafe extern "C" { |
| 97 | 104 | #[thread_local] |
| ... | ... | @@ -103,6 +110,7 @@ pub fn errno() -> i32 { |
| 103 | 110 | |
| 104 | 111 | #[cfg(target_os = "dragonfly")] |
| 105 | 112 | #[allow(dead_code)] |
| 113 | #[inline] | |
| 106 | 114 | pub fn set_errno(e: i32) { |
| 107 | 115 | unsafe extern "C" { |
| 108 | 116 | #[thread_local] |
src/doc/rustc-dev-guide/src/tests/ui.md+15| ... | ... | @@ -202,6 +202,9 @@ several ways to match the message with the line (see the examples below): |
| 202 | 202 | * `~|`: Associates the error level and message with the *same* line as the |
| 203 | 203 | *previous comment*. This is more convenient than using multiple carets when |
| 204 | 204 | there are multiple messages associated with the same line. |
| 205 | * `~v`: Associates the error level and message with the *next* error | |
| 206 | annotation line. Each symbol (`v`) that you add adds a line to this, so `~vvv` | |
| 207 | is three lines below the error annotation line. | |
| 205 | 208 | * `~?`: Used to match error levels and messages with errors not having line |
| 206 | 209 | information. These can be placed on any line in the test file, but are |
| 207 | 210 | conventionally placed at the end. |
| ... | ... | @@ -273,6 +276,18 @@ fn main() { |
| 273 | 276 | //~| ERROR this pattern has 1 field, but the corresponding tuple struct has 3 fields [E0023] |
| 274 | 277 | ``` |
| 275 | 278 | |
| 279 | #### Positioned above error line | |
| 280 | ||
| 281 | Use the `//~v` idiom with number of v's in the string to indicate the number | |
| 282 | of lines below. This is typically used in lexer or parser tests matching on errors like unclosed | |
| 283 | delimiter or unclosed literal happening at the end of file. | |
| 284 | ||
| 285 | ```rust,ignore | |
| 286 | // ignore-tidy-trailing-newlines | |
| 287 | //~v ERROR this file contains an unclosed delimiter | |
| 288 | fn main((ؼ | |
| 289 | ``` | |
| 290 | ||
| 276 | 291 | #### Error without line information |
| 277 | 292 | |
| 278 | 293 | Use `//~?` to match an error without line information. |
src/tools/compiletest/src/errors.rs+7-1| ... | ... | @@ -122,13 +122,17 @@ fn parse_expected( |
| 122 | 122 | // //~| |
| 123 | 123 | // //~^ |
| 124 | 124 | // //~^^^^^ |
| 125 | // //~v | |
| 126 | // //~vvvvv | |
| 125 | 127 | // //~? |
| 126 | 128 | // //[rev1]~ |
| 127 | 129 | // //[rev1,rev2]~^^ |
| 128 | 130 | static RE: OnceLock<Regex> = OnceLock::new(); |
| 129 | 131 | |
| 130 | 132 | let captures = RE |
| 131 | .get_or_init(|| Regex::new(r"//(?:\[(?P<revs>[\w\-,]+)])?~(?P<adjust>\?|\||\^*)").unwrap()) | |
| 133 | .get_or_init(|| { | |
| 134 | Regex::new(r"//(?:\[(?P<revs>[\w\-,]+)])?~(?P<adjust>\?|\||[v\^]*)").unwrap() | |
| 135 | }) | |
| 132 | 136 | .captures(line)?; |
| 133 | 137 | |
| 134 | 138 | match (test_revision, captures.name("revs")) { |
| ... | ... | @@ -164,6 +168,8 @@ fn parse_expected( |
| 164 | 168 | (true, Some(last_nonfollow_error.expect("encountered //~| without preceding //~^ line"))) |
| 165 | 169 | } else if line_num_adjust == "?" { |
| 166 | 170 | (false, None) |
| 171 | } else if line_num_adjust.starts_with('v') { | |
| 172 | (false, Some(line_num + line_num_adjust.len())) | |
| 167 | 173 | } else { |
| 168 | 174 | (false, Some(line_num - line_num_adjust.len())) |
| 169 | 175 | }; |
tests/ui/parser/issues/issue-103451.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | 1 | struct R { } |
| 2 | //~vv ERROR this file contains an unclosed delimiter | |
| 3 | 3 | struct S { |
| 4 | 4 | x: [u8; R |
tests/ui/parser/issues/issue-10636-2.rs+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | //@ error-pattern: mismatched closing delimiter: `}` | |
| 2 | 1 | // FIXME(31528) we emit a bunch of silly errors here due to continuing past the |
| 3 | 2 | // first one. This would be easy-ish to address by better recovery in tokenisation. |
| 4 | 3 | |
| 4 | //~vvvvv ERROR mismatched closing delimiter: `}` | |
| 5 | 5 | pub fn trace_option(option: Option<isize>) { |
| 6 | 6 | option.map(|some| 42; |
| 7 | 7 |
tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | // Fixed in #66054. |
| 2 | 2 | // ignore-tidy-trailing-newlines |
| 3 | //@ error-pattern: this file contains an unclosed delimiter | |
| 4 | //@ error-pattern: aborting due to 1 previous error | |
| 3 | //~v ERROR this file contains an unclosed delimiter | |
| 5 | 4 | #[Ѕ |
| \ No newline at end of file |
tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/issue-58094-missing-right-square-bracket.rs:5:4 | |
| 2 | --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 | |
| 3 | 3 | | |
| 4 | 4 | LL | #[Ѕ |
| 5 | 5 | | - ^ |
tests/ui/parser/issues/issue-62524.rs+2-1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | // ignore-tidy-trailing-newlines |
| 2 | //@ error-pattern: aborting due to 1 previous error | |
| 2 | ||
| 3 | 3 | #![allow(uncommon_codepoints)] |
| 4 | 4 | |
| 5 | //~vv ERROR this file contains an unclosed delimiter | |
| 5 | 6 | y![ |
| 6 | 7 | Ϥ, |
| \ No newline at end of file |
tests/ui/parser/issues/issue-62524.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/issue-62524.rs:6:3 | |
| 2 | --> $DIR/issue-62524.rs:7:3 | |
| 3 | 3 | | |
| 4 | 4 | LL | y![ |
| 5 | 5 | | - unclosed delimiter |
tests/ui/parser/issues/issue-62554.rs+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | //@ error-pattern:this file contains an unclosed delimiter | |
| 2 | ||
| 3 | 1 | fn main() {} |
| 4 | 2 | |
| 3 | //~v ERROR this file contains an unclosed delimiter | |
| 5 | 4 | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { |
tests/ui/parser/issues/issue-62554.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/issue-62554.rs:5:89 | |
| 2 | --> $DIR/issue-62554.rs:4:89 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { |
| 5 | 5 | | - - - - -^ |
tests/ui/parser/issues/issue-62894.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Regression test for #62894, shouldn't crash. |
| 2 | //@ error-pattern: this file contains an unclosed delimiter | |
| 3 | 2 | |
| 3 | //~vvv ERROR this file contains an unclosed delimiter | |
| 4 | 4 | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! |
| 5 | 5 | |
| 6 | 6 | fn main() {} |
tests/ui/parser/issues/issue-62973.rs+3-1| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | 1 | // ignore-tidy-trailing-newlines |
| 2 | //@ error-pattern: aborting due to 3 previous errors | |
| 3 | 2 | |
| 4 | 3 | fn main() {} |
| 5 | 4 | |
| 5 | //~vvv ERROR mismatched closing delimiter: `)` | |
| 6 | //~vv ERROR mismatched closing delimiter: `)` | |
| 7 | //~vvv ERROR this file contains an unclosed delimiter | |
| 6 | 8 | fn p() { match s { v, E { [) {) } |
| 7 | 9 | |
| 8 | 10 |
tests/ui/parser/issues/issue-62973.stderr+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: mismatched closing delimiter: `)` |
| 2 | --> $DIR/issue-62973.rs:6:27 | |
| 2 | --> $DIR/issue-62973.rs:8:27 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn p() { match s { v, E { [) {) } |
| 5 | 5 | | ^^ mismatched closing delimiter |
| ... | ... | @@ -7,7 +7,7 @@ LL | fn p() { match s { v, E { [) {) } |
| 7 | 7 | | unclosed delimiter |
| 8 | 8 | |
| 9 | 9 | error: mismatched closing delimiter: `)` |
| 10 | --> $DIR/issue-62973.rs:6:30 | |
| 10 | --> $DIR/issue-62973.rs:8:30 | |
| 11 | 11 | | |
| 12 | 12 | LL | fn p() { match s { v, E { [) {) } |
| 13 | 13 | | ^^ mismatched closing delimiter |
| ... | ... | @@ -15,7 +15,7 @@ LL | fn p() { match s { v, E { [) {) } |
| 15 | 15 | | unclosed delimiter |
| 16 | 16 | |
| 17 | 17 | error: this file contains an unclosed delimiter |
| 18 | --> $DIR/issue-62973.rs:8:2 | |
| 18 | --> $DIR/issue-62973.rs:10:2 | |
| 19 | 19 | | |
| 20 | 20 | LL | fn p() { match s { v, E { [) {) } |
| 21 | 21 | | - - - - missing open `(` for this delimiter |
tests/ui/parser/issues/issue-63116.rs+2-1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | 1 | // fixed by #66361 |
| 2 | //@ error-pattern: aborting due to 2 previous errors | |
| 2 | //~vv ERROR mismatched closing delimiter: `]` | |
| 3 | //~v ERROR this file contains an unclosed delimiter | |
| 3 | 4 | impl W <s(f;Y(;] |
tests/ui/parser/issues/issue-63116.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: mismatched closing delimiter: `]` |
| 2 | --> $DIR/issue-63116.rs:3:14 | |
| 2 | --> $DIR/issue-63116.rs:4:14 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl W <s(f;Y(;] |
| 5 | 5 | | ^ ^ mismatched closing delimiter |
| ... | ... | @@ -7,7 +7,7 @@ LL | impl W <s(f;Y(;] |
| 7 | 7 | | unclosed delimiter |
| 8 | 8 | |
| 9 | 9 | error: this file contains an unclosed delimiter |
| 10 | --> $DIR/issue-63116.rs:3:18 | |
| 10 | --> $DIR/issue-63116.rs:4:18 | |
| 11 | 11 | | |
| 12 | 12 | LL | impl W <s(f;Y(;] |
| 13 | 13 | | - -^ |
tests/ui/parser/issues/issue-63135.rs+1-2| ... | ... | @@ -1,3 +1,2 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | //@ error-pattern: aborting due to 1 previous error | |
| 1 | //~v ERROR this file contains an unclosed delimiter | |
| 3 | 2 | fn i(n{...,f # |
tests/ui/parser/issues/issue-63135.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/issue-63135.rs:3:16 | |
| 2 | --> $DIR/issue-63135.rs:2:16 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn i(n{...,f # |
| 5 | 5 | | - - ^ |
tests/ui/parser/issues/issue-81804.rs+2-3| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | //@ error-pattern: this file contains an unclosed delimiter | |
| 3 | ||
| 4 | 1 | fn main() {} |
| 5 | 2 | |
| 3 | //~vv ERROR mismatched closing delimiter: `}` | |
| 4 | //~v ERROR this file contains an unclosed delimiter | |
| 6 | 5 | fn p([=(} |
tests/ui/parser/issues/issue-81804.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: mismatched closing delimiter: `}` |
| 2 | --> $DIR/issue-81804.rs:6:8 | |
| 2 | --> $DIR/issue-81804.rs:5:8 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn p([=(} |
| 5 | 5 | | ^^ mismatched closing delimiter |
| ... | ... | @@ -7,7 +7,7 @@ LL | fn p([=(} |
| 7 | 7 | | unclosed delimiter |
| 8 | 8 | |
| 9 | 9 | error: this file contains an unclosed delimiter |
| 10 | --> $DIR/issue-81804.rs:6:11 | |
| 10 | --> $DIR/issue-81804.rs:5:11 | |
| 11 | 11 | | |
| 12 | 12 | LL | fn p([=(} |
| 13 | 13 | | -- ^ |
tests/ui/parser/issues/issue-81827.rs+2-5| ... | ... | @@ -1,10 +1,7 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | //@ error-pattern: mismatched closing delimiter: `]` | |
| 3 | ||
| 4 | 1 | #![crate_name="0"] |
| 5 | 2 | |
| 6 | ||
| 7 | ||
| 8 | 3 | fn main() {} |
| 9 | 4 | |
| 5 | //~vv ERROR mismatched closing delimiter: `]` | |
| 6 | //~v ERROR this file contains an unclosed delimiter | |
| 10 | 7 | fn r()->i{0|{#[cfg(r(0{]0 |
tests/ui/parser/issues/issue-81827.stderr+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: mismatched closing delimiter: `]` |
| 2 | --> $DIR/issue-81827.rs:10:23 | |
| 2 | --> $DIR/issue-81827.rs:7:23 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn r()->i{0|{#[cfg(r(0{]0 |
| 5 | 5 | | - ^^ mismatched closing delimiter |
| ... | ... | @@ -8,7 +8,7 @@ LL | fn r()->i{0|{#[cfg(r(0{]0 |
| 8 | 8 | | closing delimiter possibly meant for this |
| 9 | 9 | |
| 10 | 10 | error: this file contains an unclosed delimiter |
| 11 | --> $DIR/issue-81827.rs:10:27 | |
| 11 | --> $DIR/issue-81827.rs:7:27 | |
| 12 | 12 | | |
| 13 | 13 | LL | fn r()->i{0|{#[cfg(r(0{]0 |
| 14 | 14 | | - - - ^ |
tests/ui/parser/issues/issue-84104.rs+1-1| ... | ... | @@ -1,2 +1,2 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 1 | //~v ERROR this file contains an unclosed delimiter | |
| 2 | 2 | #[i=i::<ښܖ< |
tests/ui/parser/issues/issue-84148-2.rs+1-1| ... | ... | @@ -1,2 +1,2 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 1 | //~v ERROR this file contains an unclosed delimiter | |
| 2 | 2 | fn f(t:for<>t? |
tests/ui/parser/issues/issue-88770.rs+1-2| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | // Regression test for the ICE described in #88770. |
| 2 | 2 | |
| 3 | //@ error-pattern:this file contains an unclosed delimiter | |
| 4 | ||
| 3 | //~vvvv ERROR this file contains an unclosed delimiter | |
| 5 | 4 | fn m(){print!("",(c for&g |
| 6 | 5 | u |
| 7 | 6 | e |
tests/ui/parser/issues/issue-88770.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/issue-88770.rs:8:3 | |
| 2 | --> $DIR/issue-88770.rs:7:3 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn m(){print!("",(c for&g |
| 5 | 5 | | - - - unclosed delimiter |
tests/ui/parser/mbe_missing_right_paren.rs+1-1| ... | ... | @@ -1,3 +1,3 @@ |
| 1 | 1 | // ignore-tidy-trailing-newlines |
| 2 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | //~v ERROR this file contains an unclosed delimiter | |
| 3 | 3 | macro_rules! abc(ؼ |
| \ No newline at end of file |
tests/ui/parser/missing_right_paren.rs+1-2| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | 1 | // ignore-tidy-trailing-newlines |
| 2 | //@ error-pattern: this file contains an unclosed delimiter | |
| 3 | //@ error-pattern: aborting due to 1 previous error | |
| 2 | //~v ERROR this file contains an unclosed delimiter | |
| 4 | 3 | fn main((ؼ |
| \ No newline at end of file |
tests/ui/parser/missing_right_paren.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error: this file contains an unclosed delimiter |
| 2 | --> $DIR/missing_right_paren.rs:4:11 | |
| 2 | --> $DIR/missing_right_paren.rs:3:11 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn main((ؼ |
| 5 | 5 | | -- ^ |
tests/ui/parser/unbalanced-doublequote.rs+1-3| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | //@ error-pattern: unterminated double quote string | |
| 2 | ||
| 3 | ||
| 1 | //~vv ERROR unterminated double quote string | |
| 4 | 2 | fn main() { |
| 5 | 3 | " |
| 6 | 4 | } |
tests/ui/parser/unbalanced-doublequote.stderr+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0765]: unterminated double quote string |
| 2 | --> $DIR/unbalanced-doublequote.rs:5:5 | |
| 2 | --> $DIR/unbalanced-doublequote.rs:3:5 | |
| 3 | 3 | | |
| 4 | 4 | LL | / " |
| 5 | 5 | LL | | } |
tests/ui/parser/use-unclosed-brace.rs+1-1| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | //@ error-pattern: this file contains an unclosed delimiter | |
| 2 | 1 | use foo::{bar, baz; |
| 3 | 2 | |
| 4 | 3 | use std::fmt::Display; |
| ... | ... | @@ -7,4 +6,5 @@ mod bar { } |
| 7 | 6 | |
| 8 | 7 | mod baz { } |
| 9 | 8 | |
| 9 | //~v ERROR this file contains an unclosed delimiter | |
| 10 | 10 | fn main() {} |