Skip to content

Commit 0661b3f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 3a96d5c + cd2ae96 commit 0661b3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+785
-512
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,16 @@ and [merges][mergequeue] it into Cargo's `master` branch.
109109

110110
To contribute to the documentation, all you need to do is change the markdown
111111
files in the `src/doc` directory. To view the rendered version of changes you
112-
have made locally, run:
112+
have made locally, make sure you have `mdbook` installed and run:
113113

114114
```sh
115-
sh src/ci/dox.sh
116-
open target/doc/index.html
115+
cd src/doc
116+
mdbook build
117+
open book/index.html
117118
```
118119

120+
To install `mdbook` run `cargo install mdbook`.
121+
119122

120123
## Issue Triage
121124

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo"
3-
version = "0.26.0"
3+
version = "0.27.0"
44
authors = ["Yehuda Katz <[email protected]>",
55
"Carl Lerche <[email protected]>",
66
"Alex Crichton <[email protected]>"]
@@ -18,7 +18,7 @@ path = "src/cargo/lib.rs"
1818

1919
[dependencies]
2020
atty = "0.2"
21-
crates-io = { path = "src/crates-io", version = "0.15" }
21+
crates-io = { path = "src/crates-io", version = "0.16" }
2222
crossbeam = "0.3"
2323
crypto-hash = "0.3"
2424
curl = "0.4.6"
@@ -80,11 +80,15 @@ features = [
8080

8181
[dev-dependencies]
8282
bufstream = "0.1"
83-
cargotest = { path = "tests/cargotest", version = "0.1" }
83+
cargotest = { path = "tests/testsuite/cargotest", version = "0.1" }
8484
filetime = "0.1"
8585
hamcrest = "=0.1.1"
8686

8787
[[bin]]
8888
name = "cargo"
8989
test = false
9090
doc = false
91+
92+
[[test]]
93+
name = "testsuite"
94+
path = "tests/testsuite/lib.rs"

src/bin/cargo.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,15 @@ fn execute(flags: Flags, config: &mut Config) -> CliResult {
180180
if flags.flag_list {
181181
println!("Installed Commands:");
182182
for command in list_commands(config) {
183-
println!(" {}", command);
183+
let (command, path) = command;
184+
if flags.flag_verbose > 0 {
185+
match path {
186+
Some(p) => println!(" {:<20} {}", command, p),
187+
None => println!(" {:<20}", command),
188+
}
189+
} else {
190+
println!(" {}", command);
191+
}
184192
}
185193
return Ok(());
186194
}
@@ -301,7 +309,7 @@ fn find_closest(config: &Config, cmd: &str) -> Option<String> {
301309
// Only consider candidates with a lev_distance of 3 or less so we don't
302310
// suggest out-of-the-blue options.
303311
let mut filtered = cmds.iter()
304-
.map(|c| (lev_distance(c, cmd), c))
312+
.map(|&(ref c, _)| (lev_distance(c, cmd), c))
305313
.filter(|&(d, _)| d < 4)
306314
.collect::<Vec<_>>();
307315
filtered.sort_by(|a, b| a.0.cmp(&b.0));
@@ -347,7 +355,7 @@ fn execute_external_subcommand(config: &Config, cmd: &str, args: &[String]) -> C
347355
}
348356

349357
/// List all runnable commands
350-
fn list_commands(config: &Config) -> BTreeSet<String> {
358+
fn list_commands(config: &Config) -> BTreeSet<(String, Option<String>)> {
351359
let prefix = "cargo-";
352360
let suffix = env::consts::EXE_SUFFIX;
353361
let mut commands = BTreeSet::new();
@@ -367,13 +375,16 @@ fn list_commands(config: &Config) -> BTreeSet<String> {
367375
}
368376
if is_executable(entry.path()) {
369377
let end = filename.len() - suffix.len();
370-
commands.insert(filename[prefix.len()..end].to_string());
378+
commands.insert(
379+
(filename[prefix.len()..end].to_string(),
380+
Some(path.display().to_string()))
381+
);
371382
}
372383
}
373384
}
374385

375386
macro_rules! add_cmd {
376-
($cmd:ident) => ({ commands.insert(stringify!($cmd).replace("_", "-")); })
387+
($cmd:ident) => ({ commands.insert((stringify!($cmd).replace("_", "-"), None)); })
377388
}
378389
each_subcommand!(add_cmd);
379390
commands

src/bin/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
186186
None => Ok(()),
187187
Some(err) => {
188188
Err(match err.exit.as_ref().and_then(|e| e.code()) {
189-
Some(i) => CliError::new(format_err!("{}", err.hint()), i),
189+
Some(i) => CliError::new(format_err!("{}", err.hint(&ws)), i),
190190
None => CliError::new(err.into(), 101),
191191
})
192192
}

src/cargo/core/dependency.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct Inner {
2727
specified_req: bool,
2828
kind: Kind,
2929
only_match_name: bool,
30+
rename: Option<String>,
3031

3132
optional: bool,
3233
default_features: bool,
@@ -49,6 +50,7 @@ struct SerializedDependency<'a> {
4950
source: &'a SourceId,
5051
req: String,
5152
kind: Kind,
53+
rename: Option<&'a str>,
5254

5355
optional: bool,
5456
uses_default_features: bool,
@@ -69,6 +71,7 @@ impl ser::Serialize for Dependency {
6971
uses_default_features: self.uses_default_features(),
7072
features: self.features(),
7173
target: self.platform(),
74+
rename: self.rename(),
7275
}.serialize(s)
7376
}
7477
}
@@ -182,6 +185,7 @@ impl Dependency {
182185
default_features: true,
183186
specified_req: false,
184187
platform: None,
188+
rename: None,
185189
}),
186190
}
187191
}
@@ -221,6 +225,10 @@ impl Dependency {
221225
self.inner.platform.as_ref()
222226
}
223227

228+
pub fn rename(&self) -> Option<&str> {
229+
self.inner.rename.as_ref().map(|s| &**s)
230+
}
231+
224232
pub fn set_kind(&mut self, kind: Kind) -> &mut Dependency {
225233
Rc::make_mut(&mut self.inner).kind = kind;
226234
self
@@ -261,6 +269,11 @@ impl Dependency {
261269
self
262270
}
263271

272+
pub fn set_rename(&mut self, rename: &str) -> &mut Dependency {
273+
Rc::make_mut(&mut self.inner).rename = Some(rename.to_string());
274+
self
275+
}
276+
264277
/// Lock this dependency to depending on the specified package id
265278
pub fn lock_to(&mut self, id: &PackageId) -> &mut Dependency {
266279
assert_eq!(self.inner.source_id, *id.source_id());

src/cargo/core/features.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ features! {
159159

160160
// Using epochs
161161
[unstable] epoch: bool,
162+
163+
// Renaming a package in the manifest via the `package` key
164+
[unstable] rename_dependency: bool,
162165
}
163166
}
164167

src/cargo/core/manifest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub struct ManifestMetadata {
7878
pub repository: Option<String>, // url
7979
pub documentation: Option<String>, // url
8080
pub badges: BTreeMap<String, BTreeMap<String, String>>,
81+
pub links: Option<String>,
8182
}
8283

8384
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

0 commit comments

Comments
 (0)