mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
hard-code nightly-only CFGs
This commit is contained in:
parent
972079c0e3
commit
857f419c9d
1 changed files with 8 additions and 0 deletions
|
@ -320,6 +320,14 @@ fn find_cargo_toml(path: &Path) -> Result<PathBuf> {
|
||||||
pub fn get_rustc_cfg_options() -> CfgOptions {
|
pub fn get_rustc_cfg_options() -> CfgOptions {
|
||||||
let mut cfg_options = CfgOptions::default();
|
let mut cfg_options = CfgOptions::default();
|
||||||
|
|
||||||
|
// Some nightly-only cfgs, which are required for stdlib
|
||||||
|
{
|
||||||
|
cfg_options.insert_atom("target_thread_local".into());
|
||||||
|
for &target_has_atomic in ["16", "32", "64", "8", "cas", "ptr"].iter() {
|
||||||
|
cfg_options.insert_key_value("target_has_atomic".into(), target_has_atomic.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match (|| -> Result<_> {
|
match (|| -> Result<_> {
|
||||||
// `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here.
|
// `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here.
|
||||||
let output = Command::new("rustc").args(&["--print", "cfg", "-O"]).output()?;
|
let output = Command::new("rustc").args(&["--print", "cfg", "-O"]).output()?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue