rust/compiler/rustc_expand/src
bors a97c36dd2e 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`
2023-06-07 17:38:57 +00:00
..
mbe feat(expand): emit note for doc comment in macro matcher 2023-06-07 10:20:36 +08:00
mut_visit rustc_ast: Turn MutVisitor::token_visiting_enabled into a constant 2021-10-18 00:23:24 +03:00
parse various: translation resources from cg backend 2023-02-22 09:15:54 +00:00
tokenstream Remove TokenStreamBuilder. 2022-10-05 12:42:54 +11:00
base.rs Remember names of cfg-ed out items to mention them in diagnostics 2023-06-01 19:17:19 +02:00
build.rs Rename ast::Static to ast::StaticItem to match ast::ConstItem 2023-04-04 15:34:40 +00:00
config.rs Remember names of cfg-ed out items to mention them in diagnostics 2023-06-01 19:17:19 +02:00
errors.rs Fix static string lints 2023-04-25 18:59:55 +01:00
expand.rs Remember names of cfg-ed out items to mention them in diagnostics 2023-06-01 19:17:19 +02:00
lib.rs Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
mbe.rs Move macro_rules diagnostics to diagnostics module 2022-11-20 13:06:44 +01:00
module.rs Use ThinVec in a few more AST types. 2023-02-21 11:51:56 +11:00
placeholders.rs Rip it out 2023-05-01 16:15:13 +08:00
proc_macro_server.rs fix TODO comments 2023-05-02 10:32:07 +00:00
proc_macro.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
tests.rs Spelling - compiler 2023-04-17 16:09:18 -04:00