Skip to content

Commit b58ea6a

Browse files
authored
Merge branch 'rust-lang:master' into master
2 parents deac7c3 + 4b0e263 commit b58ea6a

File tree

27 files changed

+440
-81
lines changed

27 files changed

+440
-81
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ indexmap = "2.12.0"
6363
itertools = "0.14.0"
6464
jiff = { version = "0.2.15", default-features = false, features = [ "std" ] }
6565
jobserver = "0.1.34"
66-
lazycell = "1.3.0"
6766
libc = "0.2.177"
6867
libgit2-sys = "0.18.2"
6968
libloading = "0.8.9"
@@ -185,7 +184,6 @@ indexmap.workspace = true
185184
itertools.workspace = true
186185
jiff = { workspace = true, features = ["serde", "std"] }
187186
jobserver.workspace = true
188-
lazycell.workspace = true
189187
libgit2-sys.workspace = true
190188
memchr.workspace = true
191189
opener.workspace = true

crates/cargo-test-support/src/registry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,14 @@ impl RegistryBuilder {
282282
self
283283
}
284284

285-
/// Sets whether or not to initialize as an alternative registry.
285+
/// Initializes as an alternative registry with the given name.
286286
#[must_use]
287287
pub fn alternative_named(mut self, alt: &str) -> Self {
288288
self.alternative = Some(alt.to_string());
289289
self
290290
}
291291

292-
/// Sets whether or not to initialize as an alternative registry.
292+
/// Initializes as an alternative registry named "alternative".
293293
#[must_use]
294294
pub fn alternative(self) -> Self {
295295
self.alternative_named("alternative")

crates/cargo-util-schemas/src/manifest/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,13 @@ impl<T> InheritableField<T> {
352352
}
353353
}
354354

355+
pub fn into_value(self) -> Option<T> {
356+
match self {
357+
Self::Inherit(_) => None,
358+
Self::Value(defined) => Some(defined),
359+
}
360+
}
361+
355362
pub fn is_inherited(&self) -> bool {
356363
matches!(self, Self::Inherit(_))
357364
}

src/bin/cargo/commands/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const COMPRESSED_MAN: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/man.tgz"
1414

1515
pub fn cli() -> Command {
1616
subcommand("help")
17-
.about("Displays help for a cargo subcommand")
17+
.about("Displays help for a cargo command")
1818
.arg(Arg::new("COMMAND").action(ArgAction::Set).add(
1919
clap_complete::ArgValueCandidates::new(|| {
2020
super::builtin()

src/bin/cargo/commands/run.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ pub fn cli() -> Command {
4343
.arg_unit_graph()
4444
.arg_timings()
4545
.after_help(color_print::cstr!(
46-
"Run `<bright-cyan,bold>cargo help run</>` for more detailed information.\n"
46+
"Run `<bright-cyan,bold>cargo help run</>` for more detailed information.\n\
47+
To pass `--help` to the specified binary, use `<bright-cyan,bold>-- --help</>`.\n",
4748
))
4849
}
4950

src/bin/cargo/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn list_commands(gctx: &GlobalContext) -> BTreeMap<String, CommandInfo> {
212212
commands.insert(
213213
"help".to_string(),
214214
CommandInfo::BuiltIn {
215-
about: Some("Displays help for a cargo subcommand".to_string()),
215+
about: Some("Displays help for a cargo command".to_string()),
216216
},
217217
);
218218

src/cargo/core/compiler/build_runner/compilation_files.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
//! See [`CompilationFiles`].
22
3+
use std::cell::OnceCell;
34
use std::collections::HashMap;
45
use std::fmt;
56
use std::hash::{Hash, Hasher};
67
use std::path::{Path, PathBuf};
78
use std::sync::Arc;
89

9-
use lazycell::LazyCell;
1010
use tracing::debug;
1111

1212
use super::{BuildContext, BuildRunner, CompileKind, FileFlavor, Layout};
1313
use crate::core::compiler::{CompileMode, CompileTarget, CrateType, FileType, Unit};
1414
use crate::core::{Target, TargetKind, Workspace};
15-
use crate::util::{self, CargoResult, StableHasher};
15+
use crate::util::{self, CargoResult, OnceExt, StableHasher};
1616

1717
/// This is a generic version number that can be changed to make
1818
/// backwards-incompatible changes to any file structures in the output
@@ -128,7 +128,7 @@ pub struct CompilationFiles<'a, 'gctx> {
128128
/// Metadata hash to use for each unit.
129129
metas: HashMap<Unit, Metadata>,
130130
/// For each Unit, a list all files produced.
131-
outputs: HashMap<Unit, LazyCell<Arc<Vec<OutputFile>>>>,
131+
outputs: HashMap<Unit, OnceCell<Arc<Vec<OutputFile>>>>,
132132
}
133133

134134
/// Info about a single file emitted by the compiler.
@@ -168,7 +168,7 @@ impl<'a, 'gctx: 'a> CompilationFiles<'a, 'gctx> {
168168
let outputs = metas
169169
.keys()
170170
.cloned()
171-
.map(|unit| (unit, LazyCell::new()))
171+
.map(|unit| (unit, OnceCell::new()))
172172
.collect();
173173
CompilationFiles {
174174
ws: build_runner.bcx.ws,

src/cargo/core/compiler/fingerprint/dep_info.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,19 @@ fn make_absolute_path(
503503
build_root: &Path,
504504
path: PathBuf,
505505
) -> PathBuf {
506-
match ty {
507-
DepInfoPathType::PackageRootRelative => pkg_root.join(path),
508-
// N.B. path might be absolute here in which case the join will have no effect
509-
DepInfoPathType::BuildRootRelative => build_root.join(path),
506+
let relative_to = match ty {
507+
DepInfoPathType::PackageRootRelative => pkg_root,
508+
// N.B. path might be absolute here in which case the join below will have no effect
509+
DepInfoPathType::BuildRootRelative => build_root,
510+
};
511+
512+
if path.as_os_str().is_empty() {
513+
// Joining with an empty path causes Rust to add a trailing path separator. On Windows, this
514+
// would add an invalid trailing backslash to the .d file.
515+
return relative_to.to_path_buf();
510516
}
517+
518+
relative_to.join(path)
511519
}
512520

513521
/// Some algorithms are here to ensure compatibility with possible rustc outputs.

src/cargo/core/compiler/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub mod unit_dependencies;
5252
pub mod unit_graph;
5353

5454
use std::borrow::Cow;
55+
use std::cell::OnceCell;
5556
use std::collections::{BTreeMap, HashMap, HashSet};
5657
use std::env;
5758
use std::ffi::{OsStr, OsString};
@@ -66,7 +67,6 @@ use annotate_snippets::{AnnotationKind, Group, Level, Renderer, Snippet};
6667
use anyhow::{Context as _, Error};
6768
use cargo_platform::{Cfg, Platform};
6869
use itertools::Itertools;
69-
use lazycell::LazyCell;
7070
use regex::Regex;
7171
use tracing::{debug, instrument, trace};
7272

@@ -95,6 +95,7 @@ pub use crate::core::compiler::unit::{Unit, UnitInterner};
9595
use crate::core::manifest::TargetSourcePath;
9696
use crate::core::profiles::{PanicStrategy, Profile, StripInner};
9797
use crate::core::{Feature, PackageId, Target, Verbosity};
98+
use crate::util::OnceExt;
9899
use crate::util::context::WarningHandling;
99100
use crate::util::errors::{CargoResult, VerboseError};
100101
use crate::util::interning::InternedString;
@@ -1897,7 +1898,7 @@ struct OutputOptions {
18971898
/// is fresh. The file is created lazily so that in the normal case, lots
18981899
/// of empty files are not created. If this is None, the output will not
18991900
/// be cached (such as when replaying cached messages).
1900-
cache_cell: Option<(PathBuf, LazyCell<File>)>,
1901+
cache_cell: Option<(PathBuf, OnceCell<File>)>,
19011902
/// If `true`, display any diagnostics.
19021903
/// Other types of JSON messages are processed regardless
19031904
/// of the value of this flag.
@@ -1917,7 +1918,7 @@ impl OutputOptions {
19171918
let path = build_runner.files().message_cache_path(unit);
19181919
// Remove old cache, ignore ENOENT, which is the common case.
19191920
drop(fs::remove_file(&path));
1920-
let cache_cell = Some((path, LazyCell::new()));
1921+
let cache_cell = Some((path, OnceCell::new()));
19211922
let show_diagnostics =
19221923
build_runner.bcx.gctx.warning_handling().unwrap_or_default() != WarningHandling::Allow;
19231924
OutputOptions {

0 commit comments

Comments
 (0)