Commit Graph

515 Commits

Author SHA1 Message Date
David Tolnay
d84bcc3f01
Update ui test suite to nightly-2022-07-02 2022-07-01 20:02:56 -07:00
David Tolnay
8cf6d7b565
Use dtolnay/rust-toolchain's miri toolchain
This defaults to components miri + rust-src.
2022-06-29 10:56:00 -07:00
David Tolnay
2a6da9b8c6
Update ui test suite to nightly-2022-06-26 2022-06-25 22:54:51 -07:00
David Tolnay
5801746407
Release 1.0.20 2022-06-19 19:14:08 -07:00
David Tolnay
95bb29c8e7
Hygienic path for ::std::option::Option 2022-06-19 19:13:42 -07:00
David Tolnay
72863076c2
Merge pull request #226 from dtolnay/format
Call `format!` through an unambiguous path
2022-06-19 19:12:11 -07:00
David Tolnay
a2389eeaa8
Call 'format!' through an unambiguous path
Repro:

    use quote::format_ident;

    macro_rules! format {
        () => {};
    }

    fn main() {
        let _ = format_ident!("foo");
    }

Previously:

    error: no rules expected the token `"foo"`
     --> src/main.rs:8:13
      |
    3 | macro_rules! format {
      | ------------------- when calling this macro
    ...
    8 |     let _ = format_ident!("foo");
      |             ^^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
      |
      = note: this error originates in the macro `format_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
2022-06-19 19:06:18 -07:00
David Tolnay
cb2ba9fff5
Rearrange push_ident internals 2022-06-19 19:01:58 -07:00
David Tolnay
1e89973334
Merge pull request #225 from mystor/ident_new_raw
Use Ident::new_raw to quote raw identifiers
2022-06-19 18:59:09 -07:00
Nika Layzell
ca2b2ed3db
Use Ident::new_raw to quote raw identifiers
This requires the changes in
https://github.com/dtolnay/proc-macro2/pull/331 which expose
Ident::new_raw from proc-macro2, along with providing a fallback for
earlier versions of Rust.

Fixes #223
2022-06-19 18:55:26 -07:00
David Tolnay
46637832af
Link to explain why an invalid span workaround is needed 2022-06-19 18:54:52 -07:00
David Tolnay
3f694ca9f6
Merge pull request #224 from mystor/rm_invalid_span_workaround
Disable the invalid span workaround in spanned.rs on patched versions of rustc
2022-06-19 18:53:43 -07:00
Nika Layzell
00052ccc54 Disable the invalid span workaround in spanned.rs on patched versions of rustc
Fixes #222
2022-06-19 20:38:03 -04:00
David Tolnay
eeabf0d42e
Release 1.0.19 2022-06-18 16:43:52 -07:00
David Tolnay
75d195e1f2
Merge pull request #221 from dtolnay/semicolon
Eliminate piles of extra semicolons from expanded code
2022-06-18 16:43:30 -07:00
David Tolnay
541878c483
Eliminate piles of extra semicolons from expanded code
Look at `cargo rustc --profile=check -- -Zunpretty=expanded` of the
following program:

    use quote::quote;
    fn main() {
        let _ = quote!(1 + 1);
    }

Before:

    use quote::quote;
    fn main() {
        let _ =
            {
                let mut _s = ::quote::__private::TokenStream::new();
                ;
                ;
                ;
                ::quote::__private::parse(&mut _s, "1");
                ;
                ::quote::__private::push_add(&mut _s);
                ;
                ::quote::__private::parse(&mut _s, "1");
                ;
                ;
                ;
                ;
                _s
            };
    }

After:

    use quote::quote;
    fn main() {
        let _ =
            {
                let mut _s = ::quote::__private::TokenStream::new();
                ::quote::__private::parse(&mut _s, "1");
                ::quote::__private::push_add(&mut _s);
                ::quote::__private::parse(&mut _s, "1");
                _s
            };
    }
2022-06-18 16:38:49 -07:00
David Tolnay
81baf01f5a
Format with rustfmt 1.5.0 2022-06-18 16:31:32 -07:00
David Tolnay
c488922051
Use upstreamed docs.rs icon in docs.rs badge 2022-06-11 10:15:58 -07:00
David Tolnay
aa2f9857cd
Check all crates in workspace for outdated deps 2022-06-06 14:39:23 -07:00
David Tolnay
1fceb4a09d
Match components in CI to rust-toolchain.toml file 2022-05-06 20:53:11 -07:00
David Tolnay
fd5bc0721f
Run miri in stricter miri-strict-provenance mode 2022-05-06 04:01:34 -07:00
David Tolnay
17c7c5a964
Add a miri test job in CI 2022-04-28 20:30:35 -07:00
David Tolnay
a814eda935
Drop unneeded quoting from env variable in workflows yaml 2022-04-28 19:29:11 -07:00
David Tolnay
607a171c05
Update workflows to actions/checkout@v3 2022-04-25 01:49:18 -07:00
David Tolnay
6dd04dadec
Disable ui test on miri 2022-04-24 15:15:58 -07:00
David Tolnay
8c954ca61f
Release 1.0.18 2022-04-10 21:09:13 -07:00
David Tolnay
0447cf03ff
Merge pull request #219 from dtolnay/doc
Show simpler rules in macro documentation
2022-04-10 21:08:50 -07:00
David Tolnay
241b8d6fdb
Show simpler rules in macro documentation 2022-04-10 21:05:42 -07:00
David Tolnay
b5160b1512
Touch up PR 217 2022-04-10 21:01:28 -07:00
David Tolnay
2d23d9de7c
Merge pull request #217 from nnethercote/special-case-1-2
Special case `quote!`/`quote_spanned!` for 1 and 2 tts.
2022-04-10 20:58:17 -07:00
Nicholas Nethercote
4d75f2e550 Special case quote!/quote_spanned! for 1 and 2 tts.
These make crates that use `quote` compile faster.

I also tried specializing for 3 tts, but the rules are more complex and
the additional perf wins are much smaller than they are for 1 and 2 tts.
2022-04-11 13:52:58 +10:00
David Tolnay
31c3be473d
Update ui test suite to nightly-2022-04-06 2022-04-05 19:36:03 -07:00
David Tolnay
a53dd098d4
Merge pull request #216 from dtolnay/character0
Use a character other than \0 for testing unicode escapes
2022-03-27 20:14:17 -07:00
David Tolnay
678d83dd58
Use a character other than \0 for testing unicode escapes 2022-03-27 20:08:16 -07:00
David Tolnay
0ec6e20dc9
Release 1.0.17 2022-03-25 15:26:41 -07:00
David Tolnay
7c357e801a
Merge pull request #215 from dtolnay/comments
Touch up comments from PR #211
2022-03-25 00:57:26 -07:00
David Tolnay
8e11f47054
Touch up comments from PR 211 2022-03-25 00:49:44 -07:00
David Tolnay
927317c5ed
Merge pull request 211 from nnethercote/add-comments 2022-03-25 00:27:01 -07:00
David Tolnay
c1723f9d74
Merge pull request #214 from dtolnay/docconcat
Remove part about `concat!` from doc comment example
2022-03-25 00:15:38 -07:00
David Tolnay
86c29ac520
Remove part about concat! from doc comment example 2022-03-25 00:08:49 -07:00
Nicholas Nethercote
7f2e0d6b5b Add some comments about how quote_each_token works.
I didn't understand how this code worked until I used `trace_macros` on
an example and saw some expansions. This commit contains the comments I
wish had been present.
2022-03-21 09:23:44 +11:00
David Tolnay
8cad741724
Release 1.0.16 2022-03-17 15:46:18 -07:00
David Tolnay
5353edb24a
Reword quote_token explanation comment 2022-03-17 15:45:47 -07:00
David Tolnay
5b7afe8922
Merge pull request #210 from lqd/reorder_arguments
Reorder arguments in `quote_token` and `quote_token_spanned`
2022-03-17 15:45:43 -07:00
Rémy Rakic
9af37e4762 Add comment to quote_token about the tokens order 2022-03-17 23:19:05 +01:00
Rémy Rakic
8ee39a80ae reorder quote_token_spanned arguments 2022-03-17 23:03:40 +01:00
Rémy Rakic
738b651263 reorder quote_token arguments 2022-03-17 13:25:29 +01:00
David Tolnay
05fcc344ec
Revert "Work around clippy semicolon_if_nothing_returned regression"
This reverts commit 264221ecb5.
2022-03-17 01:21:37 -07:00
David Tolnay
3d12669786
Merge pull request #209 from nnethercote/reorder-quote_token
Order rules in `quote_token!` and `quote_token_spanned!` by frequency.
2022-03-17 01:17:51 -07:00
Nicholas Nethercote
fad6995254 Order rules in quote_token! and quote_token_spanned! by frequency.
This reduces `cargo check` times by 4-9% on a few crates that use
`quote!` heavily.
2022-03-17 14:16:50 +11:00