about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/queries.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-07 17:38:57 +0000
committerbors <bors@rust-lang.org>2023-06-07 17:38:57 +0000
commita97c36dd2e6f711949fc9b790476e93bd9e6d1f4 (patch)
tree396855263c5ba620f0e10489717dbfd2f09febb2 /compiler/rustc_interface/src/queries.rs
parentb2807b2bf3be9fbed9a0aadc97841c20a1ab5f79 (diff)
parenta647ba250a65b44574830cb71aab5c0403adf31b (diff)
downloadrust-a97c36dd2e6f711949fc9b790476e93bd9e6d1f4.tar.gz
rust-a97c36dd2e6f711949fc9b790476e93bd9e6d1f4.zip
Auto merge of #109005 - Nilstrieb:dont-forgor-too-much-from-cfg, r=petrochenkov
Remember names of `cfg`-ed out items to mention them in diagnostics

# Examples

## `serde::Deserialize` without the `derive` feature (a classic beginner mistake)

I had to slightly modify serde so that it uses explicit re-exports instead of a glob re-export. (Update: a serde PR was merged that adds the manual re-exports)

```
error[E0433]: failed to resolve: could not find `Serialize` in `serde`
   --> src/main.rs:1:17
    |
1   | #[derive(serde::Serialize)]
    |                 ^^^^^^^^^ could not find `Serialize` in `serde`
    |
note: crate `serde` has an item named `Serialize` but it is inactive because its cfg predicate evaluated to false
   --> /home/gh-Nilstrieb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.160/src/lib.rs:343:1
    |
343 | #[cfg(feature = "serde_derive")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344 | pub use serde_derive::{Deserialize, Serialize};
    |                                     ^^^^^^^^^
    = note: the item is gated behind the `serde_derive` feature
    = note: see https://doc.rust-lang.org/cargo/reference/features.html for how to activate a crate's feature
```
(the suggestion is not ideal but that's serde's fault)

I already tested the metadata size impact locally by compiling the `windows` crate without any features. `800k`  -> `809k`

r? `@ghost`
Diffstat (limited to 'compiler/rustc_interface/src/queries.rs')
0 files changed, 0 insertions, 0 deletions