diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/proc-macro/issue-75930-derive-cfg.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/proc-macro/issue-75930-derive-cfg.rs')
-rw-r--r-- | tests/ui/proc-macro/issue-75930-derive-cfg.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.rs b/tests/ui/proc-macro/issue-75930-derive-cfg.rs index ef56e8e02..e0213527c 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.rs +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.rs @@ -16,6 +16,36 @@ extern crate std; #[macro_use] extern crate test_macros; +// Note: the expected output contains this sequence: +// ``` +// Punct { +// ch: '<', +// spacing: Joint, +// span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0), +// }, +// Ident { +// ident: "B", +// span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0), +// }, +// ``` +// It's surprising to see a `Joint` token tree followed by an `Ident` token +// tree, because `Joint` is supposed to only be used if the following token is +// `Punct`. +// +// It is because of this code from below: +// ``` +// struct Foo<#[cfg(FALSE)] A, B> +// ``` +// When the token stream is formed during parsing, `<` is followed immediately +// by `#`, which is punctuation, so it is marked `Joint`. But before being +// passed to the proc macro it is rewritten to this: +// ``` +// struct Foo<B> +// ``` +// But the `Joint` marker on the `<` is not updated. Perhaps it should be +// corrected before being passed to the proc macro? But a prior attempt to do +// that kind of correction caused the problem seen in #76399, so maybe not. + #[print_helper(a)] //~ WARN derive helper attribute is used before it is introduced //~| WARN this was previously accepted #[cfg_attr(not(FALSE), allow(dead_code))] |