Skip to content

Commit 68a1c78

Browse files
committed
Merge branch 'master' into 7656-format-placeholder-code-when-generating-a-crate
2 parents a70ac57 + 972b9f5 commit 68a1c78

File tree

18 files changed

+332
-156
lines changed

18 files changed

+332
-156
lines changed

CHANGELOG.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,106 @@
11
# Changelog
22

3+
## Cargo 1.43 (2020-04-23)
4+
[9d32b7b0...HEAD](https://github.com/rust-lang/cargo/compare/9d32b7b0...HEAD)
5+
6+
### Added
7+
- 🔥 Profiles may now be specified in config files (and environment variables).
8+
[#7823](https://github.com/rust-lang/cargo/pull/7823)
9+
10+
### Changed
11+
- `cargo install --git` now honors workspaces in a git repository. This allows
12+
workspace settings, like `[patch]`, `[replace]`, or `[profile]` to be used.
13+
[#7768](https://github.com/rust-lang/cargo/pull/7768)
14+
15+
### Fixed
16+
17+
### Nightly only
18+
- Added `build.out-dir` config variable to set the output directory.
19+
[#7810](https://github.com/rust-lang/cargo/pull/7810)
20+
- Added `-Zjobserver-per-rustc` feature to support improved performance for
21+
parallel rustc.
22+
[#7731](https://github.com/rust-lang/cargo/pull/7731)
23+
24+
25+
326
## Cargo 1.42 (2020-03-12)
4-
[0bf7aafe...HEAD](https://github.com/rust-lang/cargo/compare/0bf7aafe...HEAD)
27+
[0bf7aafe...rust-1.42.0](https://github.com/rust-lang/cargo/compare/0bf7aafe...rust-1.42.0)
528

629
### Added
730
- Added documentation on git authentication.
831
[#7658](https://github.com/rust-lang/cargo/pull/7658)
932
- Bitbucket Pipeline badges are now supported on crates.io.
1033
[#7663](https://github.com/rust-lang/cargo/pull/7663)
34+
- `cargo vendor` now accepts the `--versioned-dirs` option to force it to
35+
always include the version number in each package's directory name.
36+
[#7631](https://github.com/rust-lang/cargo/pull/7631)
37+
- The `proc_macro` crate is now automatically added to the extern prelude for
38+
proc-macro packages. This means that `extern crate proc_macro;` is no longer
39+
necessary for proc-macros.
40+
[#7700](https://github.com/rust-lang/cargo/pull/7700)
1141

1242
### Changed
1343
- Emit a warning if `debug_assertions`, `test`, `proc_macro`, or `feature=` is
1444
used in a `cfg()` expression.
1545
[#7660](https://github.com/rust-lang/cargo/pull/7660)
46+
- Large update to the Cargo documentation, adding new chapters on Cargo
47+
targets, workspaces, and features.
48+
[#7733](https://github.com/rust-lang/cargo/pull/7733)
49+
- Windows: `.lib` DLL import libraries are now copied next to the dll for all
50+
Windows MSVC targets. Previously it was only supported for
51+
`pc-windows-msvc`. This adds DLL support for `uwp-windows-msvc` targets.
52+
[#7758](https://github.com/rust-lang/cargo/pull/7758)
53+
- The `ar` field in the `[target]` configuration is no longer read. It has
54+
been ignored for over 4 years.
55+
[#7763](https://github.com/rust-lang/cargo/pull/7763)
56+
- Bash completion file simplified and updated for latest changes.
57+
[#7789](https://github.com/rust-lang/cargo/pull/7789)
58+
- Credentials are only loaded when needed, instead of every Cargo command.
59+
[#7774](https://github.com/rust-lang/cargo/pull/7774)
1660

1761
### Fixed
18-
- Removed `--offline` empty index check, which was a false positive in some cases.
62+
- Removed `--offline` empty index check, which was a false positive in some
63+
cases.
1964
[#7655](https://github.com/rust-lang/cargo/pull/7655)
65+
- Files and directories starting with a `.` can now be included in a package
66+
by adding it to the `include` list.
67+
[#7680](https://github.com/rust-lang/cargo/pull/7680)
68+
- Fixed `cargo login` removing alternative registry tokens when previous
69+
entries existed in the credentials file.
70+
[#7708](https://github.com/rust-lang/cargo/pull/7708)
71+
- Fixed `cargo vendor` from panicking when used with alternative registries.
72+
[#7718](https://github.com/rust-lang/cargo/pull/7718)
73+
- Fixed incorrect explanation in the fingerprint debug log message.
74+
[#7749](https://github.com/rust-lang/cargo/pull/7749)
75+
- A `[source]` that is defined multiple times will now result in an error.
76+
Previously it was randomly picking a source, which could cause
77+
non-deterministic behavior.
78+
[#7751](https://github.com/rust-lang/cargo/pull/7751)
79+
- `dep_kinds` in `cargo metadata` are now de-duplicated.
80+
[#7756](https://github.com/rust-lang/cargo/pull/7756)
81+
- Fixed packaging where `Cargo.lock` was listed in `.gitignore` in a
82+
subdirectory inside a git repository. Previously it was assuming
83+
`Cargo.lock` was at the root of the repo.
84+
[#7779](https://github.com/rust-lang/cargo/pull/7779)
85+
- Partial file transfer errors will now cause an automatic retry.
86+
[#7788](https://github.com/rust-lang/cargo/pull/7788)
87+
- Linux: Fixed panic if CPU iowait stat decreases.
88+
[#7803](https://github.com/rust-lang/cargo/pull/7803)
89+
- Fixed using the wrong sysroot for detecting host compiler settings when
90+
`--sysroot` is passed in via `RUSTFLAGS`.
91+
[#7798](https://github.com/rust-lang/cargo/pull/7798)
2092

2193
### Nightly only
22-
94+
- `build-std` now uses `--extern` instead of `--sysroot` to find sysroot
95+
pacakges.
96+
[#7699](https://github.com/rust-lang/cargo/pull/7699)
97+
- Added `--config` command-line option to set config settings.
98+
[#7649](https://github.com/rust-lang/cargo/pull/7649)
99+
- Added `include` config setting which allows including another config file.
100+
[#7649](https://github.com/rust-lang/cargo/pull/7649)
101+
- Profiles in config files now support any named profile. Previously it was
102+
limited to dev/release.
103+
[#7750](https://github.com/rust-lang/cargo/pull/7750)
23104

24105
## Cargo 1.41 (2020-01-30)
25106
[5da4b4d4...rust-1.41.0](https://github.com/rust-lang/cargo/compare/5da4b4d4...rust-1.41.0)

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo"
3-
version = "0.43.0"
3+
version = "0.44.0"
44
edition = "2018"
55
authors = ["Yehuda Katz <[email protected]>",
66
"Carl Lerche <[email protected]>",

crates/resolver-tests/tests/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ proptest! {
6161
config
6262
.configure(
6363
1,
64-
None,
64+
false,
6565
None,
6666
false,
6767
false,
@@ -569,7 +569,7 @@ fn test_resolving_minimum_version_with_transitive_deps() {
569569
config
570570
.configure(
571571
1,
572-
None,
572+
false,
573573
None,
574574
false,
575575
false,

src/bin/cargo/cli.rs

Lines changed: 76 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Available unstable (nightly-only) flags:
3636
-Z minimal-versions -- Install minimal dependency versions instead of maximum
3737
-Z no-index-update -- Do not update the registry, avoids a network request for benchmarking
3838
-Z unstable-options -- Allow the usage of unstable options
39-
-Z config-profile -- Read profiles from .cargo/config files
4039
-Z timings -- Display concurrency information
4140
-Z doctest-xcompile -- Compile and run doctests for non-host target using runner config
4241
@@ -92,16 +91,19 @@ Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
9291
return Ok(());
9392
}
9493

95-
let args = expand_aliases(config, args)?;
96-
let (cmd, subcommand_args) = match args.subcommand() {
94+
// Global args need to be extracted before expanding aliases because the
95+
// clap code for extracting a subcommand discards global options
96+
// (appearing before the subcommand).
97+
let (expanded_args, global_args) = expand_aliases(config, args)?;
98+
let (cmd, subcommand_args) = match expanded_args.subcommand() {
9799
(cmd, Some(args)) => (cmd, args),
98100
_ => {
99101
// No subcommand provided.
100102
cli().print_help()?;
101103
return Ok(());
102104
}
103105
};
104-
config_configure(config, &args, subcommand_args)?;
106+
config_configure(config, &expanded_args, subcommand_args, global_args)?;
105107
super::init_git_transports(config);
106108

107109
execute_subcommand(config, cmd, subcommand_args)
@@ -129,7 +131,7 @@ pub fn get_version_string(is_verbose: bool) -> String {
129131
fn expand_aliases(
130132
config: &mut Config,
131133
args: ArgMatches<'static>,
132-
) -> Result<ArgMatches<'static>, CliError> {
134+
) -> Result<(ArgMatches<'static>, GlobalArgs), CliError> {
133135
if let (cmd, Some(args)) = args.subcommand() {
134136
match (
135137
commands::builtin_exec(cmd),
@@ -148,41 +150,60 @@ fn expand_aliases(
148150
.unwrap_or_default()
149151
.map(|s| s.to_string()),
150152
);
151-
let args = cli()
153+
// new_args strips out everything before the subcommand, so
154+
// capture those global options now.
155+
// Note that an alias to an external command will not receive
156+
// these arguments. That may be confusing, but such is life.
157+
let global_args = GlobalArgs::new(&args);
158+
let new_args = cli()
152159
.setting(AppSettings::NoBinaryName)
153160
.get_matches_from_safe(alias)?;
154-
return expand_aliases(config, args);
161+
let (expanded_args, _) = expand_aliases(config, new_args)?;
162+
return Ok((expanded_args, global_args));
155163
}
156164
(_, None) => {}
157165
}
158166
};
159167

160-
Ok(args)
168+
Ok((args, GlobalArgs::default()))
161169
}
162170

163171
fn config_configure(
164172
config: &mut Config,
165173
args: &ArgMatches<'_>,
166174
subcommand_args: &ArgMatches<'_>,
175+
global_args: GlobalArgs,
167176
) -> CliResult {
168177
let arg_target_dir = &subcommand_args.value_of_path("target-dir", config);
169-
let config_args: Vec<&str> = args.values_of("config").unwrap_or_default().collect();
170-
let quiet = if args.is_present("quiet") || subcommand_args.is_present("quiet") {
171-
Some(true)
172-
} else {
173-
None
174-
};
178+
let verbose = global_args.verbose + args.occurrences_of("verbose") as u32;
179+
// quiet is unusual because it is redefined in some subcommands in order
180+
// to provide custom help text.
181+
let quiet =
182+
args.is_present("quiet") || subcommand_args.is_present("quiet") || global_args.quiet;
183+
let global_color = global_args.color; // Extract so it can take reference.
184+
let color = args
185+
.value_of("color")
186+
.or_else(|| global_color.as_ref().map(|s| s.as_ref()));
187+
let frozen = args.is_present("frozen") || global_args.frozen;
188+
let locked = args.is_present("locked") || global_args.locked;
189+
let offline = args.is_present("offline") || global_args.offline;
190+
let mut unstable_flags = global_args.unstable_flags;
191+
if let Some(values) = args.values_of("unstable-features") {
192+
unstable_flags.extend(values.map(|s| s.to_string()));
193+
}
194+
let mut config_args = global_args.config_args;
195+
if let Some(values) = args.values_of("config") {
196+
config_args.extend(values.map(|s| s.to_string()));
197+
}
175198
config.configure(
176-
args.occurrences_of("verbose") as u32,
199+
verbose,
177200
quiet,
178-
args.value_of("color"),
179-
args.is_present("frozen"),
180-
args.is_present("locked"),
181-
args.is_present("offline"),
201+
color,
202+
frozen,
203+
locked,
204+
offline,
182205
arg_target_dir,
183-
&args
184-
.values_of_lossy("unstable-features")
185-
.unwrap_or_default(),
206+
&unstable_flags,
186207
&config_args,
187208
)?;
188209
Ok(())
@@ -202,6 +223,39 @@ fn execute_subcommand(
202223
super::execute_external_subcommand(config, cmd, &ext_args)
203224
}
204225

226+
#[derive(Default)]
227+
struct GlobalArgs {
228+
verbose: u32,
229+
quiet: bool,
230+
color: Option<String>,
231+
frozen: bool,
232+
locked: bool,
233+
offline: bool,
234+
unstable_flags: Vec<String>,
235+
config_args: Vec<String>,
236+
}
237+
238+
impl GlobalArgs {
239+
fn new(args: &ArgMatches<'_>) -> GlobalArgs {
240+
GlobalArgs {
241+
verbose: args.occurrences_of("verbose") as u32,
242+
quiet: args.is_present("quiet"),
243+
color: args.value_of("color").map(|s| s.to_string()),
244+
frozen: args.is_present("frozen"),
245+
locked: args.is_present("locked"),
246+
offline: args.is_present("offline"),
247+
unstable_flags: args
248+
.values_of_lossy("unstable-features")
249+
.unwrap_or_default(),
250+
config_args: args
251+
.values_of("config")
252+
.unwrap_or_default()
253+
.map(|s| s.to_string())
254+
.collect(),
255+
}
256+
}
257+
}
258+
205259
fn cli() -> App {
206260
App::new("cargo")
207261
.settings(&[

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ pub struct TargetInfo {
3939
pub rustflags: Vec<String>,
4040
/// Extra flags to pass to `rustdoc`, see `env_args`.
4141
pub rustdocflags: Vec<String>,
42-
// Remove this when it hits stable (1.41).
43-
pub supports_pathless_extern: Option<bool>,
4442
}
4543

4644
/// Kind of each file generated by a Unit, part of `FileType`.
@@ -103,13 +101,6 @@ impl TargetInfo {
103101
.args(&rustflags)
104102
.env_remove("RUSTC_LOG");
105103

106-
let mut pathless_test = process.clone();
107-
pathless_test.args(&["--extern", "proc_macro"]);
108-
let supports_pathless_extern = match kind {
109-
CompileKind::Host => Some(rustc.cached_output(&pathless_test).is_ok()),
110-
_ => None,
111-
};
112-
113104
if let CompileKind::Target(target) = kind {
114105
process.arg("--target").arg(target.rustc_target());
115106
}
@@ -192,7 +183,6 @@ impl TargetInfo {
192183
"RUSTDOCFLAGS",
193184
)?,
194185
cfg,
195-
supports_pathless_extern,
196186
})
197187
}
198188

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,13 +1018,7 @@ pub fn extern_args<'a>(
10181018
link_to(dep, dep.extern_crate_name, dep.noprelude)?;
10191019
}
10201020
}
1021-
if unit.target.proc_macro()
1022-
&& cx
1023-
.bcx
1024-
.info(CompileKind::Host)
1025-
.supports_pathless_extern
1026-
.unwrap()
1027-
{
1021+
if unit.target.proc_macro() {
10281022
// Automatically import `proc_macro`.
10291023
result.push(OsString::from("--extern"));
10301024
result.push(OsString::from("proc_macro"));

src/cargo/core/features.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ pub struct CliUnstable {
331331
pub minimal_versions: bool,
332332
pub package_features: bool,
333333
pub advanced_env: bool,
334-
pub config_profile: bool,
335334
pub config_include: bool,
336335
pub dual_proc_macros: bool,
337336
pub mtime_on_use: bool,
@@ -397,7 +396,6 @@ impl CliUnstable {
397396
"minimal-versions" => self.minimal_versions = parse_empty(k, v)?,
398397
"package-features" => self.package_features = parse_empty(k, v)?,
399398
"advanced-env" => self.advanced_env = parse_empty(k, v)?,
400-
"config-profile" => self.config_profile = parse_empty(k, v)?,
401399
"config-include" => self.config_include = parse_empty(k, v)?,
402400
"dual-proc-macros" => self.dual_proc_macros = parse_empty(k, v)?,
403401
// can also be set in .cargo/config or with and ENV

0 commit comments

Comments
 (0)