-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify no-library-target error into no-target warn #14163
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -349,7 +349,7 @@ impl<'a> UnitGenerator<'a, '_> { | |
} | ||
} | ||
CompileFilter::Only { | ||
all_targets, | ||
all_targets: _, | ||
ref lib, | ||
ref bins, | ||
ref examples, | ||
|
@@ -372,21 +372,6 @@ impl<'a> UnitGenerator<'a, '_> { | |
libs.push(proposal) | ||
} | ||
} | ||
if !all_targets && libs.is_empty() && *lib == LibRule::True { | ||
let names = self | ||
.packages | ||
.iter() | ||
.map(|pkg| pkg.name()) | ||
.collect::<Vec<_>>(); | ||
if names.len() == 1 { | ||
anyhow::bail!("no library targets found in package `{}`", names[0]); | ||
} else { | ||
anyhow::bail!( | ||
"no library targets found in packages: {}", | ||
names.join(", ") | ||
); | ||
} | ||
} | ||
proposals.extend(libs); | ||
} | ||
|
||
|
@@ -510,7 +495,7 @@ Rustdoc did not scrape the following examples because they require dev-dependenc | |
let mut shell = self.ws.gctx().shell(); | ||
if let CompileFilter::Only { | ||
all_targets, | ||
lib: _, | ||
ref lib, | ||
ref bins, | ||
ref examples, | ||
ref tests, | ||
|
@@ -521,16 +506,19 @@ Rustdoc did not scrape the following examples because they require dev-dependenc | |
let mut filters = String::new(); | ||
let mut miss_count = 0; | ||
|
||
let mut append = |t: &FilterRule, s| { | ||
if let FilterRule::All = *t { | ||
miss_count += 1; | ||
filters.push_str(s); | ||
} | ||
}; | ||
|
||
Comment on lines
-524
to
-530
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needed to move closer to the actually used place to avoid borrow check error. |
||
if all_targets { | ||
filters.push_str(" `all-targets`"); | ||
} else { | ||
if *lib == LibRule::True { | ||
miss_count += 1; | ||
filters.push_str(" `lib`,"); | ||
} | ||
let mut append = |t: &FilterRule, s| { | ||
if let FilterRule::All = *t { | ||
miss_count += 1; | ||
filters.push_str(s); | ||
} | ||
}; | ||
append(bins, " `bins`,"); | ||
append(tests, " `tests`,"); | ||
append(examples, " `examples`,"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems the earliest ancestor of the following out-of-diff warn is this: https://github.com/rust-lang/cargo/pull/9549/files#diff-98da1b66b532e50e9bca971b453ee7de96b17436de1d7ef3824c9888d55be9bbR1189-R1193 (for some reason, i can't comment on the referenced pr....) (around Jun 10, 2021) return shell.warn(format!(
"target {}{} specified, but no targets matched; this is a no-op",
if miss_count > 1 { "filters" } else { "filter" },
filters,
)); |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the earliest ancestor of this error is this: https://github.com/rust-lang/cargo/pull/839/files#r1658124748 (around Nov 15, 2014)