Skip to content

Commit d53e195

Browse files
committed
Auto merge of rust-lang#94668 - fee1-dead:rollup-8e92bht, r=fee1-dead
Rollup of 3 pull requests Successful merges: - rust-lang#92509 (doc: `Iterator::partition` use partial type hints) - rust-lang#94621 (rustbuild: support RelWithDebInfo for lld) - rust-lang#94649 (Unix path::absolute: Fix leading "." component) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ad0d1d7 + 8ea3f23 commit d53e195

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

library/core/src/iter/traits/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1877,9 +1877,9 @@ pub trait Iterator {
18771877
/// ```
18781878
/// let a = [1, 2, 3];
18791879
///
1880-
/// let (even, odd): (Vec<i32>, Vec<i32>) = a
1881-
/// .iter()
1882-
/// .partition(|&n| n % 2 == 0);
1880+
/// let (even, odd): (Vec<_>, Vec<_>) = a
1881+
/// .into_iter()
1882+
/// .partition(|n| n % 2 == 0);
18831883
///
18841884
/// assert_eq!(even, vec![2]);
18851885
/// assert_eq!(odd, vec![1, 3]);

library/std/src/path/tests.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -1710,15 +1710,23 @@ fn test_unix_absolute() {
17101710
let relative = "a/b";
17111711
let mut expected = crate::env::current_dir().unwrap();
17121712
expected.push(relative);
1713-
assert_eq!(absolute(relative).unwrap(), expected);
1713+
assert_eq!(absolute(relative).unwrap().as_os_str(), expected.as_os_str());
17141714

17151715
// Test how components are collected.
1716-
assert_eq!(absolute("/a/b/c").unwrap(), Path::new("/a/b/c"));
1717-
assert_eq!(absolute("/a//b/c").unwrap(), Path::new("/a/b/c"));
1718-
assert_eq!(absolute("//a/b/c").unwrap(), Path::new("//a/b/c"));
1719-
assert_eq!(absolute("///a/b/c").unwrap(), Path::new("/a/b/c"));
1720-
assert_eq!(absolute("/a/b/c/").unwrap(), Path::new("/a/b/c/"));
1721-
assert_eq!(absolute("/a/./b/../c/.././..").unwrap(), Path::new("/a/b/../c/../.."));
1716+
assert_eq!(absolute("/a/b/c").unwrap().as_os_str(), Path::new("/a/b/c").as_os_str());
1717+
assert_eq!(absolute("/a//b/c").unwrap().as_os_str(), Path::new("/a/b/c").as_os_str());
1718+
assert_eq!(absolute("//a/b/c").unwrap().as_os_str(), Path::new("//a/b/c").as_os_str());
1719+
assert_eq!(absolute("///a/b/c").unwrap().as_os_str(), Path::new("/a/b/c").as_os_str());
1720+
assert_eq!(absolute("/a/b/c/").unwrap().as_os_str(), Path::new("/a/b/c/").as_os_str());
1721+
assert_eq!(
1722+
absolute("/a/./b/../c/.././..").unwrap().as_os_str(),
1723+
Path::new("/a/b/../c/../..").as_os_str()
1724+
);
1725+
1726+
// Test leading `.` and `..` components
1727+
let curdir = crate::env::current_dir().unwrap();
1728+
assert_eq!(absolute("./a").unwrap().as_os_str(), curdir.join("a").as_os_str());
1729+
assert_eq!(absolute("../a").unwrap().as_os_str(), curdir.join("../a").as_os_str()); // return /pwd/../a
17221730
}
17231731

17241732
#[test]

library/std/src/sys/unix/path.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {
2828
// See 4.13 Pathname Resolution, IEEE Std 1003.1-2017
2929
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13
3030

31-
let mut components = path.components();
31+
// Get the components, skipping the redundant leading "." component if it exists.
32+
let mut components = path.strip_prefix(".").unwrap_or(path).components();
3233
let path_os = path.as_os_str().bytes();
3334

3435
let mut normalized = if path.is_absolute() {

src/bootstrap/native.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,16 @@ impl Step for Lld {
650650
// there's probably a lot of reasons you can't do that other than this.
651651
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");
652652

653+
// Re-use the same flags as llvm to control the level of debug information
654+
// generated for lld.
655+
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
656+
(false, _) => "Debug",
657+
(true, false) => "Release",
658+
(true, true) => "RelWithDebInfo",
659+
};
660+
653661
cfg.out_dir(&out_dir)
654-
.profile("Release")
662+
.profile(profile)
655663
.env("LLVM_CONFIG_REAL", &llvm_config)
656664
.define("LLVM_CONFIG_PATH", llvm_config_shim)
657665
.define("LLVM_INCLUDE_TESTS", "OFF");

0 commit comments

Comments
 (0)