Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

"rust.all_targets": false still builds cfg(test) targets. #1715

Open
eddyb opened this issue Jan 25, 2021 · 1 comment
Open

"rust.all_targets": false still builds cfg(test) targets. #1715

eddyb opened this issue Jan 25, 2021 · 1 comment

Comments

@eddyb
Copy link
Member

eddyb commented Jan 25, 2021

See #1714 for context, but I suspect this can be repeated on even simple crates, they just build much faster so it's harder to tell.
(Just checked on another project I had handy, glOOF, and it also builds gloof cfg(test) on every change, can barely see it for a second in the status bar, but it's there - there might be a better way to confirm but I don't know how to get a proper log)

I'm not sure how this is happening, based on this (and the relevant Cargo code) I would expect it to "just" work:

rls/rls/src/build/cargo.rs

Lines 214 to 227 in 581415c

filter: CompileFilter::from_raw_arguments(
opts.lib,
opts.bin,
opts.bins,
// TODO: support more crate target types.
Vec::new(),
// Check all integration tests under `tests/`.
cfg_test,
Vec::new(),
false,
Vec::new(),
false,
opts.all_targets,
),

EDIT: "rust.build_lib": true also doesn't seem to restrict the set of targets, but I'm not sure it does nothing

@eddyb
Copy link
Member Author

eddyb commented Jan 25, 2021

This is confusing, I thought I could use [lib] test = false in Cargo.toml to remove cfg(test) targets, but that doesn't remove it?
Even weirder, it seems to build cfg(test) before the library itself, at least sometimes?

Is it possible "cfg(test)" doesn't come from Cargo as a string, and RLS is misinterpreting what Cargo is actually building?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant