about summary refs log tree commit diff
path: root/tests/ui/proc-macro/auxiliary
AgeCommit message (Collapse)AuthorLines
2025-08-10Add test showing innecessary inference spanEsteban Küber-0/+15
2025-06-12Add support for $crate to IdentDaniel Bloom-27/+113
2025-04-11Replace proc_macro::SourceFile by Span::{file, local_file}.Mara Bos-8/+7
2025-04-11Remove proc_macro::SourceFile::is_real().Mara Bos-11/+1
2025-03-18Revert "Rollup merge of #136355 - ↵Ralf Jung-53/+1
GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu" This reverts commit 08dfbf49e30d917c89e49eb14cb3f1e8b8a1c9ef, reversing changes made to 10bcdad7df0de3cfb95c7bdb7b16908e73cafc09.
2025-03-17Rollup merge of #136355 - ↵Jacob Pratt-1/+53
GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu Add `*_value` methods to proc_macro lib This is the implementation of https://github.com/rust-lang/libs-team/issues/459. It allows to get the actual value (unescaped) of the different string literals. Part of https://github.com/rust-lang/rust/issues/136652. r? libs-api
2025-03-16Add test for new proc_macro literal methodsGuillaume Gomez-1/+53
2025-02-22remove invalid suggestion of into_iter for extern macroyukang-0/+19
2024-11-27Update tests to use new proc-macro headerEric Huss-460/+2
2024-11-20Add tests for the edition of macro_rules from a proc-macroEric Huss-0/+42
2024-11-11remove attributes from generics in built-in derive macrosPonasKovas-0/+12
add a test add github issue link to description of the test replace new ThinVec with clear() Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2024-08-12Fix bug in `Parser::look_ahead`.Nicholas Nethercote-0/+44
The special case was failing to handle invisible delimiters on one path. Fixes #128895.
2024-06-13Remove superfluous escaping from byte, byte str, and c str literalsDavid Tolnay-7/+7
2024-06-13Add more Literal::to_string testsDavid Tolnay-11/+36
2024-06-13Rename proc_macro::Literal tests from parse.rs to literal.rsDavid Tolnay-2/+2
This module contains tests not just of parse (FromStr) but also to_string (Display) for literals.
2024-04-04Stabilize `Literal::c_string`Slanterns-1/+0
2024-04-04Stabilize `Literal::byte_character`Slanterns-1/+0
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-199/+199
2024-02-11Add test for the issuelong-long-float-0/+20
2024-01-22Don't insert spaces before most semicolons in `print_tts`.Nicholas Nethercote-2/+2
This gives better output for code produced by proc macros.
2024-01-16proc_macro_c_str_literals: Implement Literal::c_string constructornovafacing-4/+5
2023-12-11Add tests for `--env` usage with `tracked_env::var`Guillaume Gomez-0/+28
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-1/+1
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2023-12-11Improve `print_tts` by changing `tokenstream::Spacing`.Nicholas Nethercote-14/+13
`tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-11-20test: Add test for async-move in 2015 Rust proc macroArthur Cohen-0/+39
Add a test to ensure issue #89699 does not show up again. This test emits an `async move` closure in a proc macro, which is used in a test program compiled with edition 2015. We make sure the error message is nice and shows up properly.
2023-09-26Auto merge of #116124 - WaffleLapkin:fix-proc-macro-literal-to-string, ↵bors-0/+16
r=compiler-errors Properly print cstr literals in `proc_macro::Literal::to_string` Previously we printed the contents of the string, rather than the actual string literal (e.g. `the c string` instead of `c"the c string"`). Fixes #112820 cc #105723
2023-09-24Add a test for printing literals via `proc-macro`Maybe Waffle-0/+16
2023-09-23implement Literal::byte_characterEmil Gardström-0/+5
without this, the only way to create a `LitKind::Byte` is by doing `"b'a'".parse::<Literal>()`, this solves that by enabling `Literal::byte_character(b'a')`
2023-08-08fix proc-macro test added here to solely be exercised as a build product for ↵Felix S. Klock II-0/+2
the host. thus we should no longer see test failures for e.g. wasm32 target.
2023-08-04regression test for issue 111888.Felix S. Klock II-0/+9
2023-08-02Fix #107113, avoid suggest for macro attributesyukang-0/+13
2023-06-20Merge proc_macro_span_shrink and proc_macro_spanJacob Pratt-1/+1
2023-06-20Fix testsJacob Pratt-15/+5
2023-01-11Move /src/test to /testsAlbert Larsan-0/+2795