mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Add a test for #2179
This commit is contained in:
parent
20805acf42
commit
cb5c3a9914
35
tests/source/issue-2179.rs
Normal file
35
tests/source/issue-2179.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
fn issue_2179() {
|
||||
let (opts, rustflags, clear_env_rust_log) =
|
||||
{
|
||||
// We mustn't lock configuration for the whole build process
|
||||
let rls_config = rls_config.lock().unwrap();
|
||||
|
||||
let opts = CargoOptions::new(&rls_config);
|
||||
trace!("Cargo compilation options:\n{:?}", opts);
|
||||
let rustflags = prepare_cargo_rustflags(&rls_config);
|
||||
|
||||
// Warn about invalid specified bin target or package depending on current mode
|
||||
// TODO: Return client notifications along with diagnostics to inform the user
|
||||
if !rls_config.workspace_mode {
|
||||
let cur_pkg_targets = ws.current().unwrap().targets();
|
||||
|
||||
if let &Some(ref build_bin) = rls_config.build_bin.as_ref() {
|
||||
let mut bins = cur_pkg_targets.iter().filter(|x| x.is_bin());
|
||||
if let None = bins.find(|x| x.name() == build_bin) {
|
||||
warn!("cargo - couldn't find binary `{}` specified in `build_bin` configuration", build_bin);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for package in &opts.package {
|
||||
if let None = ws.members().find(|x| x.name() == package) {
|
||||
warn!("cargo - couldn't find member package `{}` specified in `analyze_package` configuration", package);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(opts, rustflags, rls_config.clear_env_rust_log)
|
||||
};
|
||||
|
||||
}
|
36
tests/target/issue-2179.rs
Normal file
36
tests/target/issue-2179.rs
Normal file
@ -0,0 +1,36 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
fn issue_2179() {
|
||||
let (opts, rustflags, clear_env_rust_log) = {
|
||||
// We mustn't lock configuration for the whole build process
|
||||
let rls_config = rls_config.lock().unwrap();
|
||||
|
||||
let opts = CargoOptions::new(&rls_config);
|
||||
trace!("Cargo compilation options:\n{:?}", opts);
|
||||
let rustflags = prepare_cargo_rustflags(&rls_config);
|
||||
|
||||
// Warn about invalid specified bin target or package depending on current mode
|
||||
// TODO: Return client notifications along with diagnostics to inform the user
|
||||
if !rls_config.workspace_mode {
|
||||
let cur_pkg_targets = ws.current().unwrap().targets();
|
||||
|
||||
if let &Some(ref build_bin) = rls_config.build_bin.as_ref() {
|
||||
let mut bins = cur_pkg_targets.iter().filter(|x| x.is_bin());
|
||||
if let None = bins.find(|x| x.name() == build_bin) {
|
||||
warn!(
|
||||
"cargo - couldn't find binary `{}` specified in `build_bin` configuration",
|
||||
build_bin
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for package in &opts.package {
|
||||
if let None = ws.members().find(|x| x.name() == package) {
|
||||
warn!("cargo - couldn't find member package `{}` specified in `analyze_package` configuration", package);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(opts, rustflags, rls_config.clear_env_rust_log)
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user