Skip to content

Commit e115c3c

Browse files
committed
fix(resolver): Consider --frozen, like --offline, in errors
1 parent 55cf980 commit e115c3c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/cargo/core/resolver/errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ pub(super) fn activation_error(
393393
);
394394

395395
if let Some(gctx) = gctx {
396-
if gctx.offline() {
396+
if let Some(offline_flag) = gctx.offline_flag() {
397397
let _ = write!(
398398
&mut hints,
399-
"\nAs a reminder, you're using offline mode (--offline) \
399+
"\nAs a reminder, you're using offline mode ({offline_flag}) \
400400
which can sometimes cause surprising resolution failures, \
401401
if this error is too confusing you may wish to retry \
402-
without the offline flag.",
402+
without `{offline_flag}`.",
403403
);
404404
}
405405
}

tests/testsuite/offline.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn cargo_compile_offline_not_try_update() {
184184
[ERROR] no matching package named `not_cached_dep` found
185185
location searched: crates.io index
186186
required by package `bar v0.1.0 ([ROOT]/bar)`
187-
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
187+
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without `--offline`.
188188
189189
"#]])
190190
.run();
@@ -195,7 +195,7 @@ As a reminder, you're using offline mode (--offline) which can sometimes cause s
195195
[ERROR] no matching package named `not_cached_dep` found
196196
location searched: crates.io index
197197
required by package `bar v0.1.0 ([ROOT]/bar)`
198-
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
198+
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without `--offline`.
199199
200200
"#]]).run();
201201
}
@@ -384,13 +384,13 @@ fn update_offline_not_cached() {
384384

385385
p.cargo("update --offline")
386386
.with_status(101)
387-
.with_stderr_data(str![["
387+
.with_stderr_data(str![[r#"
388388
[ERROR] no matching package named `bar` found
389389
location searched: [..]
390390
required by package `foo v0.0.1 ([ROOT]/foo)`
391-
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
391+
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without `--offline`.
392392
393-
"]])
393+
"#]])
394394
.run();
395395
}
396396

@@ -607,7 +607,7 @@ candidate versions found which didn't match: 1.0.0
607607
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
608608
required by package `foo v0.1.0 ([ROOT]/foo)`
609609
perhaps a crate was updated and forgotten to be re-vendored?
610-
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
610+
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without `--offline`.
611611
612612
"#]]
613613
)
@@ -754,7 +754,7 @@ fn main(){
754754
[ERROR] no matching package named `present_dep` found
755755
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
756756
required by package `foo v0.1.0 ([ROOT]/foo)`
757-
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
757+
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without `--offline`.
758758
759759
"#]]
760760
)

0 commit comments

Comments
 (0)