diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/inherent-impls-overlap-check/auxiliary | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/inherent-impls-overlap-check/auxiliary')
-rw-r--r-- | src/test/ui/inherent-impls-overlap-check/auxiliary/repeat.rs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/test/ui/inherent-impls-overlap-check/auxiliary/repeat.rs b/src/test/ui/inherent-impls-overlap-check/auxiliary/repeat.rs deleted file mode 100644 index 42ed5d19d..000000000 --- a/src/test/ui/inherent-impls-overlap-check/auxiliary/repeat.rs +++ /dev/null @@ -1,54 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::{Ident, Group, TokenStream, TokenTree as Tt}; - -// This constant has to be above the ALLOCATING_ALGO_THRESHOLD -// constant in inherent_impls_overlap.rs -const REPEAT_COUNT: u32 = 501; - -#[proc_macro] -/// Repeats the input many times, while replacing idents -/// named "IDENT" with "id_$v", where v is a counter. -pub fn repeat_with_idents(input: TokenStream) -> TokenStream { - let mut res = Vec::new(); - fn visit_stream(res: &mut Vec<Tt>, stream :TokenStream, v: u32) { - let mut stream_iter = stream.into_iter(); - while let Some(tt) = stream_iter.next() { - match tt { - Tt::Group(group) => { - let tt = Tt::Group(visit_group(group, v)); - res.push(tt); - }, - Tt::Ident(id) => { - let id = if &id.to_string() == "IDENT" { - Ident::new(&format!("id_{}", v), id.span()) - } else { - id - }; - res.push(Tt::Ident(id)); - }, - Tt::Punct(p) => { - res.push(Tt::Punct(p)); - }, - Tt::Literal(lit) => { - res.push(Tt::Literal(lit)); - }, - } - } - } - fn visit_group(group :Group, v: u32) -> Group { - let mut res = Vec::new(); - visit_stream(&mut res, group.stream(), v); - let stream = res.into_iter().collect(); - let delim = group.delimiter(); - Group::new(delim, stream) - } - for v in 0 .. REPEAT_COUNT { - visit_stream(&mut res, input.clone(), v) - } - res.into_iter().collect() -} |