Skip to content

Commit 38694d4

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Remote
2 parents 9b3e6f7 + 63d0fe4 commit 38694d4

File tree

19 files changed

+234
-59
lines changed

19 files changed

+234
-59
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ rustc-workspace-hack = "1.0.0"
7878
core-foundation = { version = "0.9.0", features = ["mac_os_10_7_support"] }
7979

8080
[target.'cfg(windows)'.dependencies]
81-
miow = "0.3.1"
81+
miow = "0.3.6"
8282
fwdansi = "1.1.0"
8383

8484
[target.'cfg(windows)'.dependencies.winapi]
@@ -103,8 +103,8 @@ features = [
103103
]
104104

105105
[dev-dependencies]
106-
cargo-test-macro = { path = "crates/cargo-test-macro", version = "0.1.0" }
107-
cargo-test-support = { path = "crates/cargo-test-support", version = "0.1.0" }
106+
cargo-test-macro = { path = "crates/cargo-test-macro" }
107+
cargo-test-support = { path = "crates/cargo-test-support" }
108108

109109
[build-dependencies]
110110
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Available unstable (nightly-only) flags:
4343
-Z doctest-xcompile -- Compile and run doctests for non-host target using runner config
4444
-Z terminal-width -- Provide a terminal width to rustc for error truncation
4545
-Z namespaced-features -- Allow features with `dep:` prefix
46-
-Z weak-dep-features -- Allow `dep_name?/feature` feature syntax
46+
-Z weak-dep-features -- Allow `dep_name?/feature` feature syntax
4747
4848
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
4949
);

src/bin/cargo/commands/update.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn cli() -> App {
77
subcommand("update")
88
.about("Update dependencies as recorded in the local lock file")
99
.arg(opt("quiet", "No output printed to stdout").short("q"))
10+
.arg(opt("workspace", "Only update the workspace packages").short("w"))
1011
.arg_package_spec_simple("Package to update")
1112
.arg(opt(
1213
"aggressive",
@@ -30,6 +31,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3031
precise: args.value_of("precise"),
3132
to_update: values(args, "package"),
3233
dry_run: args.is_present("dry-run"),
34+
workspace: args.is_present("workspace"),
3335
config,
3436
};
3537
ops::update_lockfile(&ws, &update_opts)?;

src/cargo/core/compiler/job_queue.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,11 @@ impl<'cfg> JobQueue<'cfg> {
370370
}
371371
}
372372

373-
self.queue.queue(unit.clone(), job, queue_deps);
373+
// For now we use a fixed placeholder value for the cost of each unit, but
374+
// in the future this could be used to allow users to provide hints about
375+
// relative expected costs of units, or this could be automatically set in
376+
// a smarter way using timing data from a previous compilation.
377+
self.queue.queue(unit.clone(), job, queue_deps, 100);
374378
*self.counts.entry(unit.pkg.package_id()).or_insert(0) += 1;
375379
Ok(())
376380
}

src/cargo/core/compiler/rustdoc.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use url::Url;
1616
pub enum RustdocExternMode {
1717
/// Use a local `file://` URL.
1818
Local,
19-
/// Use a remote URL to https://doc.rust-lang.org/ (default).
19+
/// Use a remote URL to <https://doc.rust-lang.org/> (default).
2020
Remote,
2121
/// An arbitrary URL.
2222
Url(String),
@@ -52,13 +52,36 @@ impl<'de> serde::de::Deserialize<'de> for RustdocExternMode {
5252
}
5353
}
5454

55-
#[derive(serde::Deserialize, Debug, Default)]
55+
#[derive(serde::Deserialize, Debug)]
5656
#[serde(default)]
5757
pub struct RustdocExternMap {
58-
registries: HashMap<String, String>,
58+
#[serde(deserialize_with = "default_crates_io_to_docs_rs")]
59+
pub(crate) registries: HashMap<String, String>,
5960
std: Option<RustdocExternMode>,
6061
}
6162

63+
impl Default for RustdocExternMap {
64+
fn default() -> Self {
65+
let mut registries = HashMap::new();
66+
registries.insert("crates-io".into(), "https://docs.rs/".into());
67+
Self {
68+
registries,
69+
std: None,
70+
}
71+
}
72+
}
73+
74+
fn default_crates_io_to_docs_rs<'de, D: serde::Deserializer<'de>>(
75+
de: D,
76+
) -> Result<HashMap<String, String>, D::Error> {
77+
use serde::Deserialize;
78+
let mut registries = HashMap::deserialize(de)?;
79+
if !registries.contains_key("crates-io") {
80+
registries.insert("crates-io".into(), "https://docs.rs/".into());
81+
}
82+
Ok(registries)
83+
}
84+
6285
impl hash::Hash for RustdocExternMap {
6386
fn hash<H: hash::Hasher>(&self, into: &mut H) {
6487
self.std.hash(into);
@@ -80,10 +103,6 @@ pub fn add_root_urls(
80103
return Ok(());
81104
}
82105
let map = config.doc_extern_map()?;
83-
if map.registries.is_empty() && map.std.is_none() {
84-
// Skip doing unnecessary work.
85-
return Ok(());
86-
}
87106
let mut unstable_opts = false;
88107
// Collect mapping of registry name -> index url.
89108
let name2url: HashMap<&String, Url> = map

src/cargo/core/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl CliUnstable {
426426
bail!("flag -Z{} does not take a value, found: `{}`", key, v);
427427
}
428428
Ok(true)
429-
};
429+
}
430430

431431
fn parse_usize_opt(value: Option<&str>) -> CargoResult<Option<usize>> {
432432
Ok(match value {

src/cargo/core/source/source_id.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ lazy_static::lazy_static! {
1919
}
2020

2121
/// Unique identifier for a source of packages.
22-
///
23-
/// See also: [`SourceKind`].
2422
#[derive(Clone, Copy, Eq, Debug)]
2523
pub struct SourceId {
2624
inner: &'static SourceIdInner,

src/cargo/core/workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ impl<'cfg> Workspace<'cfg> {
445445
.join("Cargo.toml");
446446
debug!("find_root - pointer {}", path.display());
447447
Ok(paths::normalize_path(&path))
448-
};
448+
}
449449

450450
{
451451
let current = self.packages.load(manifest_path)?;

src/cargo/ops/cargo_generate_lockfile.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub struct UpdateOptions<'a> {
1717
pub precise: Option<&'a str>,
1818
pub aggressive: bool,
1919
pub dry_run: bool,
20+
pub workspace: bool,
2021
}
2122

2223
pub fn generate_lockfile(ws: &Workspace<'_>) -> CargoResult<()> {
@@ -78,8 +79,10 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
7879
let mut to_avoid = HashSet::new();
7980

8081
if opts.to_update.is_empty() {
81-
to_avoid.extend(previous_resolve.iter());
82-
to_avoid.extend(previous_resolve.unused_patches());
82+
if !opts.workspace {
83+
to_avoid.extend(previous_resolve.iter());
84+
to_avoid.extend(previous_resolve.unused_patches());
85+
}
8386
} else {
8487
let mut sources = Vec::new();
8588
for name in opts.to_update.iter() {

src/cargo/sources/registry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pub struct RegistryPackage<'a> {
240240
yanked: Option<bool>,
241241
/// Native library name this package links to.
242242
///
243-
/// Added early 2018 (see https://github.com/rust-lang/cargo/pull/4978),
243+
/// Added early 2018 (see <https://github.com/rust-lang/cargo/pull/4978>),
244244
/// can be `None` if published before then.
245245
links: Option<InternedString>,
246246
}

0 commit comments

Comments
 (0)