Skip to content

Commit ce0b8e8

Browse files
author
Jon Gjengset
committed
Merge remote-tracking branch 'upstream/master' into patch-in-config
2 parents 140a770 + e4aebf0 commit ce0b8e8

Some content is hidden

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

50 files changed

+730
-379
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,24 @@ fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
15821582
p.env_remove(&k);
15831583
}
15841584
}
1585+
if env::var_os("RUSTUP_TOOLCHAIN").is_some() {
1586+
// Override the PATH to avoid executing the rustup wrapper thousands
1587+
// of times. This makes the testsuite run substantially faster.
1588+
let path = env::var_os("PATH").unwrap_or_default();
1589+
let paths = env::split_paths(&path);
1590+
let mut outer_cargo = PathBuf::from(env::var_os("CARGO").unwrap());
1591+
outer_cargo.pop();
1592+
let new_path = env::join_paths(std::iter::once(outer_cargo).chain(paths)).unwrap();
1593+
p.env("PATH", new_path);
1594+
}
1595+
1596+
if cfg!(target_os = "macos") {
1597+
// This makes the test suite run substantially faster.
1598+
p.env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked")
1599+
.env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked")
1600+
.env("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO", "unpacked")
1601+
.env("CARGO_PROFILE_BENCH_SPLIT_DEBUGINFO", "unpacked");
1602+
}
15851603

15861604
p.cwd(&paths::root())
15871605
.env("HOME", paths::home())

crates/crates-io/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ impl fmt::Display for ResponseError {
155155
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
156156
match self {
157157
ResponseError::Curl(e) => write!(f, "{}", e),
158-
ResponseError::Api { code, errors } => write!(
159-
f,
160-
"api errors (status {} {}): {}",
161-
code,
162-
reason(*code),
163-
errors.join(", ")
164-
),
158+
ResponseError::Api { code, errors } => {
159+
f.write_str("the remote server responded with an error")?;
160+
if *code != 200 {
161+
write!(f, " (status {} {})", code, reason(*code))?;
162+
};
163+
write!(f, ": {}", errors.join(", "))
164+
}
165165
ResponseError::Code {
166166
code,
167167
headers,

crates/resolver-tests/tests/resolve.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use cargo::core::dependency::DepKind;
2-
use cargo::core::{enable_nightly_features, Dependency};
2+
use cargo::core::Dependency;
33
use cargo::util::{is_ci, Config};
44

55
use resolver_tests::{
@@ -55,9 +55,8 @@ proptest! {
5555
fn prop_minimum_version_errors_the_same(
5656
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60)
5757
) {
58-
enable_nightly_features();
59-
6058
let mut config = Config::default().unwrap();
59+
config.nightly_features_allowed = true;
6160
config
6261
.configure(
6362
1,
@@ -553,11 +552,6 @@ fn test_resolving_maximum_version_with_transitive_deps() {
553552

554553
#[test]
555554
fn test_resolving_minimum_version_with_transitive_deps() {
556-
enable_nightly_features(); // -Z minimal-versions
557-
// When the minimal-versions config option is specified then the lowest
558-
// possible version of a package should be selected. "util 1.0.0" can't be
559-
// selected because of the requirements of "bar", so the minimum version
560-
// must be 1.1.1.
561555
let reg = registry(vec![
562556
pkg!(("util", "1.2.2")),
563557
pkg!(("util", "1.0.0")),
@@ -567,6 +561,12 @@ fn test_resolving_minimum_version_with_transitive_deps() {
567561
]);
568562

569563
let mut config = Config::default().unwrap();
564+
// -Z minimal-versions
565+
// When the minimal-versions config option is specified then the lowest
566+
// possible version of a package should be selected. "util 1.0.0" can't be
567+
// selected because of the requirements of "bar", so the minimum version
568+
// must be 1.1.1.
569+
config.nightly_features_allowed = true;
570570
config
571571
.configure(
572572
1,

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Available unstable (nightly-only) flags:
4848
4949
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
5050
);
51-
if !features::nightly_features_allowed() {
51+
if !config.nightly_features_allowed {
5252
drop_println!(
5353
config,
5454
"\nUnstable flags are only available on the nightly channel \

src/bin/cargo/commands/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
117117
let version = args.value_of("version");
118118
let root = args.value_of("root");
119119

120-
// We only provide worksapce information for local crate installation from
120+
// We only provide workspace information for local crate installation from
121121
// one of the following sources:
122122
// - From current working directory (only work for edition 2015).
123123
// - From a specific local file path.

src/bin/cargo/commands/locate_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
5151
let location = ProjectLocation { root };
5252

5353
match MessageFormat::parse(args)? {
54-
MessageFormat::Json => config.shell().print_json(&location),
54+
MessageFormat::Json => config.shell().print_json(&location)?,
5555
MessageFormat::Plain => drop_println!(config, "{}", location.root),
5656
}
5757

src/bin/cargo/commands/logout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1616
if !(unstable.credential_process || unstable.unstable_options) {
1717
const SEE: &str = "See https://github.com/rust-lang/cargo/issues/8933 for more \
1818
information about the `cargo logout` command.";
19-
if features::nightly_features_allowed() {
19+
if config.nightly_features_allowed {
2020
return Err(format_err!(
2121
"the `cargo logout` command is unstable, pass `-Z unstable-options` to enable it\n\
2222
{}",

src/bin/cargo/commands/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
5353
};
5454

5555
let result = ops::output_metadata(&ws, &options)?;
56-
config.shell().print_json(&result);
56+
config.shell().print_json(&result)?;
5757
Ok(())
5858
}

src/bin/cargo/commands/read_manifest.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Deprecated, use `cargo metadata --no-deps` instead.\
1515

1616
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1717
let ws = args.workspace(config)?;
18-
config.shell().print_json(&ws.current()?.serialized(config));
18+
config
19+
.shell()
20+
.print_json(&ws.current()?.serialized(config))?;
1921
Ok(())
2022
}

src/bin/cargo/commands/verify_project.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1515
if let Err(e) = args.workspace(config) {
1616
let mut h = HashMap::new();
1717
h.insert("invalid".to_string(), e.to_string());
18-
config.shell().print_json(&h);
18+
config.shell().print_json(&h)?;
1919
process::exit(1)
2020
}
2121

2222
let mut h = HashMap::new();
2323
h.insert("success".to_string(), "true".to_string());
24-
config.shell().print_json(&h);
24+
config.shell().print_json(&h)?;
2525
Ok(())
2626
}

0 commit comments

Comments
 (0)