Skip to content

Commit 1e800ab

Browse files
authored
Merge branch 'master' into license-field-as-environment-variable
2 parents 8c99e20 + 5eb53f7 commit 1e800ab

File tree

27 files changed

+321
-82
lines changed

27 files changed

+321
-82
lines changed

CHANGELOG.md

Lines changed: 148 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
# Changelog
22

3+
## Cargo 1.46 (2020-08-27)
4+
[9fcb8c1d...HEAD](https://github.com/rust-lang/cargo/compare/9fcb8c1d...HEAD)
5+
6+
### Added
7+
8+
### Changed
9+
- A warning is now displayed if a git dependency includes a `#` fragment in
10+
the URL. This was potentially confusing because Cargo itself displays git
11+
URLs with this syntax, but it does not have any meaning outside of the
12+
`Cargo.lock` file, and would not work properly.
13+
[#8297](https://github.com/rust-lang/cargo/pull/8297)
14+
15+
### Fixed
16+
- Fixed a rare situation where an update to `Cargo.lock` failed once, but then
17+
subsequent runs allowed it proceed.
18+
[#8274](https://github.com/rust-lang/cargo/pull/8274)
19+
- Removed assertion that Windows dylibs must have a `.dll` extension. Some
20+
custom JSON spec targets may change the extension.
21+
[#8310](https://github.com/rust-lang/cargo/pull/8310)
22+
- Updated libgit2, which brings in a fix for zlib errors for some remote
23+
git servers like googlesource.com.
24+
[#8320](https://github.com/rust-lang/cargo/pull/8320)
25+
26+
### Nightly only
27+
- Added `-Zrustdoc-map` feature which provides external mappings for rustdoc
28+
(such as https://docs.rs/ links).
29+
[docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-map)
30+
[#8287](https://github.com/rust-lang/cargo/pull/8287)
31+
- Fixed feature calculation when a proc-macro is declared in `Cargo.toml` with
32+
an underscore (like `proc_macro = true`).
33+
[#8319](https://github.com/rust-lang/cargo/pull/8319)
34+
35+
336
## Cargo 1.45 (2020-07-16)
4-
[ebda5065e...HEAD](https://github.com/rust-lang/cargo/compare/ebda5065e...HEAD)
37+
[ebda5065e...rust-1.45.0](https://github.com/rust-lang/cargo/compare/ebda5065...rust-1.45.0)
538

639
### Added
740

@@ -29,11 +62,105 @@
2962
directory. Some obscure scenarios can cause an old dylib to be referenced
3063
between builds, and this ensures that all the latest copies are used.
3164
[#8139](https://github.com/rust-lang/cargo/pull/8139)
65+
- `package.exclude` can now match directory names. If a directory is
66+
specified, the entire directory will be excluded, and Cargo will not attempt
67+
to inspect it further. Previously Cargo would try to check every file in the
68+
directory which could cause problems if the directory contained unreadable
69+
files.
70+
[#8095](https://github.com/rust-lang/cargo/pull/8095)
71+
- When packaging with `cargo publish` or `cargo package`, Cargo can use git to
72+
guide its decision on which files to include. Previously this git-based
73+
logic required a `Cargo.toml` file to exist at the root of the repository.
74+
This is no longer required, so Cargo will now use git-based guidance even if
75+
there is not a `Cargo.toml` in the root of the repository.
76+
[#8095](https://github.com/rust-lang/cargo/pull/8095)
77+
- While unpacking a crate on Windows, if it fails to write a file because the
78+
file is a reserved Windows filename (like "aux.rs"), Cargo will display an
79+
extra message to explain why it failed.
80+
[#8136](https://github.com/rust-lang/cargo/pull/8136)
81+
- Failures to set mtime on files are now ignored. Some filesystems did not
82+
support this.
83+
[#8185](https://github.com/rust-lang/cargo/pull/8185)
84+
- Certain classes of git errors will now recommend enabling
85+
`net.git-fetch-with-cli`.
86+
[#8166](https://github.com/rust-lang/cargo/pull/8166)
87+
- When doing an LTO build, Cargo will now instruct rustc not to perform
88+
codegen when possible. This may result in a faster build and use less disk
89+
space. Additionally, for non-LTO builds, Cargo will instruct rustc to not
90+
embed LLVM bitcode in libraries, which should decrease their size.
91+
[#8192](https://github.com/rust-lang/cargo/pull/8192)
92+
[#8226](https://github.com/rust-lang/cargo/pull/8226)
93+
[#8254](https://github.com/rust-lang/cargo/pull/8254)
94+
- The implementation for `cargo clean -p` has been rewritten so that it can
95+
more accurately remove the files for a specific package.
96+
[#8210](https://github.com/rust-lang/cargo/pull/8210)
97+
- The way Cargo computes the outputs from a build has been rewritten to be
98+
more complete and accurate. Newly tracked files will be displayed in JSON
99+
messages, and may be uplifted to the output directory in some cases. Some of
100+
the changes from this are:
101+
102+
- `.exp` export files on Windows MSVC dynamic libraries are now tracked.
103+
- Proc-macros on Windows track import/export files.
104+
- All targets (like tests, etc.) that generate separate debug files
105+
(pdb/dSYM) are tracked.
106+
- Added .map files for wasm32-unknown-emscripten.
107+
- macOS dSYM directories are tracked for all dynamic libraries
108+
(dylib/cdylib/proc-macro) and for build scripts.
109+
110+
There are a variety of other changes as a consequence of this:
111+
112+
- Binary examples on Windows MSVC with a hyphen will now show up twice in
113+
the examples directory (`foo_bar.exe` and `foo-bar.exe`). Previously Cargo
114+
just renamed the file instead of hard-linking it.
115+
- Example libraries now follow the same rules for hyphen/underscore
116+
translation as normal libs (they will now use underscores).
117+
118+
[#8210](https://github.com/rust-lang/cargo/pull/8210)
119+
- Cargo attempts to scrub any secrets from the debug log for HTTP debugging.
120+
[#8222](https://github.com/rust-lang/cargo/pull/8222)
121+
- Context has been added to many of Cargo's filesystem operations, so that
122+
error messages now provide more information, such as the path that caused
123+
the problem.
124+
[#8232](https://github.com/rust-lang/cargo/pull/8232)
125+
- Several commands now ignore the error if stdout or stderr is closed while it
126+
is running. For example `cargo install --list | grep -q cargo-fuzz` would
127+
previously sometimes panic because `grep -q` may close stdout before the
128+
command finishes. Regular builds continue to fail if stdout or stderr is
129+
closed, matching the behavior of many other build systems.
130+
[#8236](https://github.com/rust-lang/cargo/pull/8236)
131+
- If `cargo install` is given an exact version, like `--version=1.2.3`, it
132+
will now avoid updating the index if that version is already installed, and
133+
exit quickly indicating it is already installed.
134+
[#8022](https://github.com/rust-lang/cargo/pull/8022)
135+
- Changes to the `[patch]` section will now attempt to automatically update
136+
`Cargo.lock` to the new version. It should now also provide better error
137+
messages for the rare cases where it is unable to automatically update.
138+
[#8248](https://github.com/rust-lang/cargo/pull/8248)
32139

33140
### Fixed
34141
- Fixed copying Windows `.pdb` files to the output directory when the filename
35142
contained dashes.
36143
[#8123](https://github.com/rust-lang/cargo/pull/8123)
144+
- Fixed error where Cargo would fail when scanning if a package is inside a
145+
git repository when any of its ancestor paths is a symlink.
146+
[#8186](https://github.com/rust-lang/cargo/pull/8186)
147+
- Fixed `cargo update` with an unused `[patch]` so that it does not get
148+
stuck and refuse to update.
149+
[#8243](https://github.com/rust-lang/cargo/pull/8243)
150+
- Fixed a situation where Cargo would hang if stderr is closed, and the
151+
compiler generated a large number of messages.
152+
[#8247](https://github.com/rust-lang/cargo/pull/8247)
153+
- Fixed backtraces on macOS not showing filenames or line numbers. As a
154+
consequence of this, binary executables on apple targets do not include a
155+
hash in the filename in Cargo's cache. This means Cargo can only track one
156+
copy, so if you switch features or rustc versions, Cargo will need to
157+
rebuild the executable.
158+
[#8329](https://github.com/rust-lang/cargo/pull/8329)
159+
[#8335](https://github.com/rust-lang/cargo/pull/8335)
160+
- Fixed fingerprinting when using lld on Windows with a dylib. Cargo was
161+
erroneously thinking the dylib was never fresh.
162+
[#8290](https://github.com/rust-lang/cargo/pull/8290)
163+
[#8335](https://github.com/rust-lang/cargo/pull/8335)
37164

38165
### Nightly only
39166
- Fixed passing the full path for `--target` to `rustdoc` when using JSON spec
@@ -44,9 +171,22 @@
44171
- Added new `resolver` field to `Cargo.toml` to opt-in to the new feature
45172
resolver.
46173
[#8129](https://github.com/rust-lang/cargo/pull/8129)
174+
- `-Zbuild-std` no longer treats std dependencies as "local". This means that
175+
it won't use incremental compilation for those dependencies, removes them
176+
from dep-info files, and caps lints at "allow".
177+
[#8177](https://github.com/rust-lang/cargo/pull/8177)
178+
- Added `-Zmultitarget` which allows multiple `--target` flags to build the
179+
same thing for multiple targets at once.
180+
[docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#multitarget)
181+
[#8167](https://github.com/rust-lang/cargo/pull/8167)
182+
- Added `strip` option to the profile to remove symbols and debug information.
183+
[docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-strip-option)
184+
[#8246](https://github.com/rust-lang/cargo/pull/8246)
185+
- Fixed panic with `cargo tree --target=all -Zfeatures=all`.
186+
[#8269](https://github.com/rust-lang/cargo/pull/8269)
47187

48188
## Cargo 1.44 (2020-06-04)
49-
[bda50510...ebda5065e](https://github.com/rust-lang/cargo/compare/bda50510...ebda5065e)
189+
[bda50510...rust-1.44.0](https://github.com/rust-lang/cargo/compare/bda50510...rust-1.44.0)
50190

51191
### Added
52192
- 🔥 Added the `cargo tree` command.
@@ -96,6 +236,10 @@
96236
[#8090](https://github.com/rust-lang/cargo/pull/8090)
97237
- Added a certain class of HTTP2 errors as "spurious" that will get retried.
98238
[#8102](https://github.com/rust-lang/cargo/pull/8102)
239+
- Allow `cargo package --list` to succeed, even if there are other validation
240+
errors (such as `Cargo.lock` generation problem, or missing dependencies).
241+
[#8175](https://github.com/rust-lang/cargo/pull/8175)
242+
[#8215](https://github.com/rust-lang/cargo/pull/8215)
99243

100244
### Fixed
101245
- Cargo no longer buffers excessive amounts of compiler output in memory.
@@ -115,6 +259,8 @@
115259
- Protect against some (unknown) situations where Cargo could panic when the
116260
system monotonic clock doesn't appear to be monotonic.
117261
[#8114](https://github.com/rust-lang/cargo/pull/8114)
262+
- Fixed panic with `cargo clean -p` if the package has a build script.
263+
[#8216](https://github.com/rust-lang/cargo/pull/8216)
118264

119265
### Nightly only
120266
- Fixed panic with new feature resolver and required-features.

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.46.0"
3+
version = "0.47.0"
44
edition = "2018"
55
authors = ["Yehuda Katz <wycats@gmail.com>",
66
"Carl Lerche <me@carllerche.com>",

crates/cargo-platform/src/error.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub struct ParseError {
66
orig: String,
77
}
88

9+
#[non_exhaustive]
910
#[derive(Debug)]
1011
pub enum ParseErrorKind {
1112
UnterminatedString,
@@ -17,9 +18,6 @@ pub enum ParseErrorKind {
1718
IncompleteExpr(&'static str),
1819
UnterminatedExpression(String),
1920
InvalidTarget(String),
20-
21-
#[doc(hidden)]
22-
__Nonexhaustive,
2321
}
2422

2523
impl fmt::Display for ParseError {
@@ -53,7 +51,6 @@ impl fmt::Display for ParseErrorKind {
5351
write!(f, "unexpected content `{}` found after cfg expression", s)
5452
}
5553
InvalidTarget(s) => write!(f, "invalid target specifier: {}", s),
56-
__Nonexhaustive => unreachable!(),
5754
}
5855
}
5956
}

src/cargo/core/compiler/compilation.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,15 @@ impl<'cfg> Compilation<'cfg> {
151151
self.rustc_process.clone()
152152
};
153153

154-
self.fill_env(rustc, &unit.pkg, unit.kind, true)
154+
let cmd = fill_rustc_tool_env(rustc, unit);
155+
self.fill_env(cmd, &unit.pkg, unit.kind, true)
155156
}
156157

157158
/// See `process`.
158159
pub fn rustdoc_process(&self, unit: &Unit) -> CargoResult<ProcessBuilder> {
159-
let mut p = self.fill_env(
160-
process(&*self.config.rustdoc()?),
161-
&unit.pkg,
162-
unit.kind,
163-
true,
164-
)?;
160+
let rustdoc = process(&*self.config.rustdoc()?);
161+
let cmd = fill_rustc_tool_env(rustdoc, unit);
162+
let mut p = self.fill_env(cmd, &unit.pkg, unit.kind, true)?;
165163
if unit.target.edition() != Edition::Edition2015 {
166164
p.arg(format!("--edition={}", unit.target.edition()));
167165
}
@@ -299,6 +297,16 @@ impl<'cfg> Compilation<'cfg> {
299297
}
300298
}
301299

300+
/// Prepares a rustc_tool process with additional environment variables
301+
/// that are only relevant in a context that has a unit
302+
fn fill_rustc_tool_env(mut cmd: ProcessBuilder, unit: &Unit) -> ProcessBuilder {
303+
if unit.target.is_bin() {
304+
cmd.env("CARGO_BIN_NAME", unit.target.name());
305+
}
306+
cmd.env("CARGO_CRATE_NAME", unit.target.crate_name());
307+
cmd
308+
}
309+
302310
fn pre_version_component(v: &Version) -> String {
303311
if v.pre.is_empty() {
304312
return String::new();

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ fn should_use_metadata(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool {
608608
// - wasm32 executables: When using emscripten, the path to the .wasm file
609609
// is embedded in the .js file, so we don't want the hash in there.
610610
// TODO: Is this necessary for wasm32-unknown-unknown?
611+
// - apple executables: The executable name is used in the dSYM directory
612+
// (such as `target/debug/foo.dSYM/Contents/Resources/DWARF/foo-64db4e4bf99c12dd`).
613+
// Unfortunately this causes problems with our current backtrace
614+
// implementation which looks for a file matching the exe name exactly.
615+
// See https://github.com/rust-lang/rust/issues/72550#issuecomment-638501691
616+
// for more details.
611617
//
612618
// This is only done for local packages, as we don't expect to export
613619
// dependencies.
@@ -622,7 +628,8 @@ fn should_use_metadata(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool {
622628
if (unit.target.is_dylib()
623629
|| unit.target.is_cdylib()
624630
|| (unit.target.is_executable() && short_name.starts_with("wasm32-"))
625-
|| (unit.target.is_executable() && short_name.contains("msvc")))
631+
|| (unit.target.is_executable() && short_name.contains("msvc"))
632+
|| (unit.target.is_executable() && short_name.contains("-apple-")))
626633
&& unit.pkg.package_id().source_id().is_path()
627634
&& env::var("__CARGO_DEFAULT_LIB_METADATA").is_err()
628635
{

src/cargo/core/compiler/fingerprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ impl Fingerprint {
894894
if a.name != b.name {
895895
let e = format_err!("`{}` != `{}`", a.name, b.name)
896896
.context("unit dependency name changed");
897-
return Err(e.into());
897+
return Err(e);
898898
}
899899

900900
if a.fingerprint.hash() != b.fingerprint.hash() {
@@ -906,7 +906,7 @@ impl Fingerprint {
906906
b.fingerprint.hash()
907907
)
908908
.context("unit dependency information changed");
909-
return Err(e.into());
909+
return Err(e);
910910
}
911911
}
912912

src/cargo/core/compiler/rustdoc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn add_root_urls(
7979
return Ok(());
8080
}
8181
let map = config.doc_extern_map()?;
82-
if map.registries.len() == 0 && map.std.is_none() {
82+
if map.registries.is_empty() && map.std.is_none() {
8383
// Skip doing unnecessary work.
8484
return Ok(());
8585
}
@@ -90,13 +90,13 @@ pub fn add_root_urls(
9090
.keys()
9191
.filter_map(|name| {
9292
if let Ok(index_url) = config.get_registry_index(name) {
93-
return Some((name, index_url));
93+
Some((name, index_url))
9494
} else {
9595
log::warn!(
9696
"`doc.extern-map.{}` specifies a registry that is not defined",
9797
name
9898
);
99-
return None;
99+
None
100100
}
101101
})
102102
.collect();

src/cargo/core/registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'cfg> PackageRegistry<'cfg> {
294294
.expect("loaded source not present");
295295
let summaries = source.query_vec(dep)?;
296296
let (summary, should_unlock) =
297-
summary_for_patch(orig_patch, &locked, summaries, source).chain_err(|| {
297+
summary_for_patch(orig_patch, locked, summaries, source).chain_err(|| {
298298
format!(
299299
"patch for `{}` in `{}` failed to resolve",
300300
orig_patch.package_name(),

src/cargo/core/resolver/resolve.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ impl Resolve {
119119

120120
pub fn register_used_patches(&mut self, patches: &[Summary]) {
121121
for summary in patches {
122-
if self.iter().any(|id| id == summary.package_id()) {
123-
continue;
124-
}
125-
self.unused_patches.push(summary.package_id());
122+
if !self.graph.contains(&summary.package_id()) {
123+
self.unused_patches.push(summary.package_id())
124+
};
126125
}
127126
}
128127

src/cargo/core/workspace.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ impl<'cfg> Workspace<'cfg> {
145145
pub fn new(manifest_path: &Path, config: &'cfg Config) -> CargoResult<Workspace<'cfg>> {
146146
let mut ws = Workspace::new_default(manifest_path.to_path_buf(), config);
147147
ws.target_dir = config.target_dir()?;
148-
ws.root_manifest = ws.find_root(manifest_path)?;
148+
149+
if manifest_path.is_relative() {
150+
anyhow::bail!(
151+
"manifest_path:{:?} is not an absolute path. Please provide an absolute path.",
152+
manifest_path
153+
)
154+
} else {
155+
ws.root_manifest = ws.find_root(manifest_path)?;
156+
}
157+
149158
ws.find_members()?;
150159
ws.resolve_behavior = match ws.root_maybe() {
151160
MaybePackage::Package(p) => p.manifest().resolve_behavior(),
@@ -863,7 +872,7 @@ impl<'cfg> Workspace<'cfg> {
863872
let err = anyhow::format_err!("{}", warning.message);
864873
let cx =
865874
anyhow::format_err!("failed to parse manifest at `{}`", path.display());
866-
return Err(err.context(cx).into());
875+
return Err(err.context(cx));
867876
} else {
868877
let msg = if self.root_manifest.is_none() {
869878
warning.message.to_string()

0 commit comments

Comments
 (0)