Skip to content

Commit 68a40ad

Browse files
committed
Merge remote-tracking branch 'origin/master' into links
2 parents 70dada8 + 847f1f7 commit 68a40ad

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

+474
-481
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: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ git2-curl = "0.7"
3333
glob = "0.2"
3434
hex = "0.3"
3535
home = "0.3"
36-
ignore = "0.3"
36+
ignore = "0.4"
3737
jobserver = "0.1.9"
38+
lazycell = "0.6"
3839
libc = "0.2"
3940
libgit2-sys = "0.6"
4041
log = "0.4"
@@ -54,10 +55,10 @@ toml = "0.4"
5455
url = "1.1"
5556

5657
[target.'cfg(target_os = "macos")'.dependencies]
57-
core-foundation = { version = "0.4.4", features = ["mac_os_10_7_support"] }
58+
core-foundation = { version = "0.5.1", features = ["mac_os_10_7_support"] }
5859

5960
[target.'cfg(windows)'.dependencies]
60-
miow = "0.2"
61+
miow = "0.3"
6162

6263
[target.'cfg(windows)'.dependencies.winapi]
6364
version = "0.3"
@@ -79,11 +80,15 @@ features = [
7980

8081
[dev-dependencies]
8182
bufstream = "0.1"
82-
cargotest = { path = "tests/cargotest", version = "0.1" }
83+
cargotest = { path = "tests/testsuite/cargotest", version = "0.1" }
8384
filetime = "0.1"
8485
hamcrest = "=0.1.1"
8586

8687
[[bin]]
8788
name = "cargo"
8889
test = false
8990
doc = false
91+
92+
[[test]]
93+
name = "testsuite"
94+
path = "tests/testsuite/lib.rs"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Learn more at https://doc.rust-lang.org/cargo/
99
[![Build Status](https://travis-ci.org/rust-lang/cargo.svg?branch=master)](https://travis-ci.org/rust-lang/cargo)
1010
[![Build Status](https://ci.appveyor.com/api/projects/status/github/rust-lang/cargo?branch=master&svg=true)](https://ci.appveyor.com/project/rust-lang-libs/cargo)
1111

12+
Code documentation: https://docs.rs/cargo/
13+
1214
## Installing Cargo
1315

1416
Cargo is distributed by default with Rust, so if you've got `rustc` installed

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/init.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Options:
3232
control system (git, hg, pijul, or fossil) or do not
3333
initialize any version control at all (none), overriding
3434
a global configuration.
35-
--bin Use a binary (application) template
36-
--lib Use a library template [default]
35+
--bin Use a binary (application) template [default]
36+
--lib Use a library template
3737
--name NAME Set the resulting package name
3838
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
3939
-q, --quiet No output printed to stdout
@@ -56,17 +56,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
5656

5757
let path = &arg_path.unwrap_or_else(|| String::from("."));
5858
let opts = ops::NewOptions::new(flag_vcs,
59-
flag_bin,
60-
flag_lib,
61-
path,
62-
flag_name.as_ref().map(|s| s.as_ref()));
59+
flag_bin,
60+
flag_lib,
61+
path,
62+
flag_name.as_ref().map(|s| s.as_ref()))?;
6363

64-
let opts_lib = opts.lib;
6564
ops::init(&opts, config)?;
6665

67-
config.shell().status("Created", format!("{} project",
68-
if opts_lib { "library" }
69-
else {"binary (application)"}))?;
66+
config.shell().status("Created", format!("{} project", opts.kind))?;
7067

7168
Ok(())
7269
}

src/bin/new.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Options:
3232
control system (git, hg, pijul, or fossil) or do not
3333
initialize any version control at all (none), overriding
3434
a global configuration.
35-
--bin Use a binary (application) template
36-
--lib Use a library template [default]
35+
--bin Use a binary (application) template [default]
36+
--lib Use a library template
3737
--name NAME Set the resulting package name, defaults to the value of <path>
3838
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
3939
-q, --quiet No output printed to stdout
@@ -58,15 +58,11 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
5858
flag_bin,
5959
flag_lib,
6060
&arg_path,
61-
flag_name.as_ref().map(|s| s.as_ref()));
61+
flag_name.as_ref().map(|s| s.as_ref()))?;
6262

63-
let opts_lib = opts.lib;
6463
ops::new(&opts, config)?;
6564

66-
config.shell().status("Created", format!("{} `{}` project",
67-
if opts_lib { "library" }
68-
else {"binary (application)"},
69-
arg_path))?;
65+
config.shell().status("Created", format!("{} `{}` project", opts.kind, arg_path))?;
7066

7167
Ok(())
7268
}

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/package.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ use std::path::{Path, PathBuf};
77
use semver::Version;
88
use serde::ser;
99
use toml;
10+
use lazycell::LazyCell;
1011

1112
use core::{Dependency, Manifest, PackageId, SourceId, Target};
1213
use core::{Summary, SourceMap};
1314
use ops;
14-
use util::{Config, LazyCell, internal, lev_distance};
15+
use util::{Config, internal, lev_distance};
1516
use util::errors::{CargoResult, CargoResultExt};
1617

1718
/// Information about a package that is available somewhere in the file system.

src/cargo/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extern crate hex;
2121
extern crate home;
2222
extern crate ignore;
2323
extern crate jobserver;
24+
extern crate lazycell;
2425
extern crate libc;
2526
extern crate libgit2_sys;
2627
extern crate num_cpus;
@@ -39,7 +40,7 @@ extern crate core_foundation;
3940

4041
use std::fmt;
4142

42-
use serde::Deserialize;
43+
use serde::de::DeserializeOwned;
4344
use serde::ser;
4445
use docopt::Docopt;
4546
use failure::Error;
@@ -102,7 +103,7 @@ impl fmt::Display for VersionInfo {
102103
}
103104
}
104105

105-
pub fn call_main_without_stdin<'de, Flags: Deserialize<'de>>(
106+
pub fn call_main_without_stdin<Flags: DeserializeOwned>(
106107
exec: fn(Flags, &mut Config) -> CliResult,
107108
config: &mut Config,
108109
usage: &str,

0 commit comments

Comments
 (0)