]> git.lizzy.rs Git - rust.git/blob - tests/source/issue-2179.rs
Merge pull request #3116 from kellerkindt/patch-1
[rust.git] / tests / source / issue-2179.rs
1 // rustfmt-error_on_line_overflow: false
2
3 fn issue_2179() {
4     let (opts, rustflags, clear_env_rust_log) =
5         {
6             // We mustn't lock configuration for the whole build process
7             let rls_config = rls_config.lock().unwrap();
8
9             let opts = CargoOptions::new(&rls_config);
10             trace!("Cargo compilation options:\n{:?}", opts);
11             let rustflags = prepare_cargo_rustflags(&rls_config);
12
13             // Warn about invalid specified bin target or package depending on current mode
14             // TODO: Return client notifications along with diagnostics to inform the user
15             if !rls_config.workspace_mode {
16                 let cur_pkg_targets = ws.current().unwrap().targets();
17
18                 if let &Some(ref build_bin) = rls_config.build_bin.as_ref() {
19                     let mut bins = cur_pkg_targets.iter().filter(|x| x.is_bin());
20                     if let None = bins.find(|x| x.name() == build_bin) {
21                         warn!("cargo - couldn't find binary `{}` specified in `build_bin` configuration", build_bin);
22                     }
23                 }
24             } else {
25                 for package in &opts.package {
26                     if let None = ws.members().find(|x| x.name() == package) {
27                         warn!("cargo - couldn't find member package `{}` specified in `analyze_package` configuration", package);
28                     }
29                 }
30             }
31
32             (opts, rustflags, rls_config.clear_env_rust_log)
33         };
34
35 }