Commit Graph

861 Commits

Author SHA1 Message Date
David Tolnay
6c66d8acd6
Reference count TokenStream in fallback mode 2022-07-24 23:47:00 -07:00
David Tolnay
67778bc3d2
Release 1.0.41 2022-07-24 21:45:15 -07:00
David Tolnay
6a3515559b
Merge pull request #334 from dtolnay/sizehint
Expose size_hint() for TokenStream's iterator
2022-07-24 21:44:31 -07:00
David Tolnay
25a20e0671
Expose size_hint() for TokenStream's iterator 2022-07-24 21:34:18 -07:00
David Tolnay
f4273659a2
Add test of ineffective TokenStream size_hint 2022-07-24 21:34:03 -07:00
David Tolnay
6ed82b0b83
Fix typo in nika XXX comment 2022-07-20 13:54:48 -07:00
David Tolnay
e4ed201c04
Fix rountrips typo in several places 2022-07-20 13:52:59 -07:00
David Tolnay
e6bc873948
Release 1.0.40 2022-06-19 18:40:49 -07:00
David Tolnay
10a20e0872
Copy Ident::new_raw comment from proc_macro 2022-06-19 18:40:25 -07:00
David Tolnay
c08b24a02a
Touch up new_raw workaround comment
This comment was copied verbatim from quote but that code was
substantially different. They started with a string _including_ the r#
prefix, and then used &id[2..] to obtain an unraw version of it, which
is what "unraw" in the comment refers to. The code in proc-macro2 is
doing the opposite.
2022-06-19 18:36:41 -07:00
David Tolnay
3191e5e3f4
Show r# in another raw identifier panic 2022-06-19 18:28:03 -07:00
David Tolnay
0de81dab0f
Include r# in the invalid raw identifier panic
This is how quote's implementation did it prior to https://github.com/dtolnay/quote/pull/225.
2022-06-19 18:23:12 -07:00
David Tolnay
9a4f130f4e
Avoid having most of the new_raw test be unreachable code 2022-06-19 18:21:24 -07:00
David Tolnay
c1d32cef31
Merge pull request #333 from dtolnay/validate
Delete unreachable cases from raw identifier check
2022-06-19 18:20:01 -07:00
David Tolnay
4be2a86fce
Delete unreachable cases from raw identifier check
"" is ruled out by the check for `if string.is_empty()` at the top.
"$crate" and "{{root}}" are ruled out because their first character does
not pass `is_ident_start`.
2022-06-19 18:15:36 -07:00
David Tolnay
d9184771a4
Remove validate var
Not sure why this is here. Maybe it used to need to be mutated in an old
incarnation of this code.
2022-06-19 18:14:32 -07:00
David Tolnay
83ed7b8642
Merge pull request #332 from dtolnay/validate
Move raw ident validate into validate_ident
2022-06-19 18:11:47 -07:00
David Tolnay
868a8ea2d9
Restore compatibility with rustc older than 1.33
error[E0658]: multiple patterns in `if let` and `while let` are unstable (see issue #48215)
       --> src/fallback.rs:704:9
        |
    704 | /         if let "" | "_" | "super" | "self" | "Self" | "crate" | "$crate" | "{{root}}" = string {
    705 | |             panic!("`{}` cannot be a raw identifier", string);
    706 | |         }
        | |_________^
2022-06-19 18:08:24 -07:00
David Tolnay
e04304ffa3
Move raw ident validate into validate_ident 2022-06-19 18:04:40 -07:00
David Tolnay
8b3a2dd476
Format with rustfmt 1.5.0 2022-06-19 18:04:11 -07:00
David Tolnay
32a0b27e16
Merge pull request #331 from mystor/ident_new_raw
Mark Ident::new_raw as no longer semver-exempt
2022-06-19 17:57:32 -07:00
Nika Layzell
0e97a926c5 Reject invalid raw identifiers in the fallback 2022-06-19 20:03:02 -04:00
Nika Layzell
2ecccd0fc3 Mark Ident::new_raw as no longer semver-exempt
The previous Compiler behaviour appears to have been broken, in that it
would return a non-raw string literal, so it was replaced with the
fallback code from quote [1].

[1]: eeabf0d42e/src/runtime.rs (L409-L422)
2022-06-19 19:54:19 -04:00
David Tolnay
11dea16ad8
Use upstreamed docs.rs icon in docs.rs badge 2022-06-11 10:15:58 -07:00
David Tolnay
4b24b6e879
Check all crates in workspace for outdated deps 2022-06-06 14:39:23 -07:00
David Tolnay
6e59fa0959
Release 1.0.39 2022-05-16 15:30:03 -07:00
David Tolnay
aec2129b9f
Replace unicode-xid with unicode-ident crate 2022-05-16 15:27:01 -07:00
David Tolnay
8649302c7e
Run miri in stricter miri-strict-provenance mode 2022-05-06 04:01:33 -07:00
David Tolnay
b501cdf2f4
Release 1.0.38 2022-05-05 21:45:55 -07:00
David Tolnay
4445659b0f
Merge pull request #328 from dtolnay/formatpushstring
Eliminate an allocation from Literal::byte_string
2022-05-05 21:43:35 -07:00
David Tolnay
d307f5650a
Restore support for rust pre-1.33
error[E0658]: renaming imports with `_` is unstable (see issue 48216)
     --> src/fallback.rs:7:38
      |
    7 | use std::fmt::{self, Debug, Display, Write as _};
      |                                      ^^^^^^^^^^
2022-05-05 21:39:23 -07:00
David Tolnay
16c4bb476c
Eliminate an allocation from Literal::byte_string
error: `format!(..)` appended to existing `String`
       --> src/fallback.rs:879:22
        |
    879 |                 _ => escaped.push_str(&format!("\\x{:02X}", b)),
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::format-push-string` implied by `-D clippy::all`
        = help: consider using `write!` to avoid the extra allocation
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string
2022-05-05 21:35:00 -07:00
David Tolnay
4a3502c785
Merge pull request #327 from dtolnay/testliteral
Add more tests of Literal constructors
2022-05-05 21:32:02 -07:00
David Tolnay
8725ff4349
Add more tests of Literal constructors 2022-05-05 21:28:52 -07:00
David Tolnay
8e794fcb06
Add a miri test job in CI 2022-04-28 20:29:48 -07:00
David Tolnay
da22bfc565
Update workflows to actions/checkout@v3 2022-04-25 01:50:40 -07:00
David Tolnay
f08095ddee
Disable ui test on miri 2022-04-24 15:15:01 -07:00
David Tolnay
c3f914381f
Skip ui test on toolchains other than nightly 2022-04-24 15:14:40 -07:00
David Tolnay
df73b6a966
Release 1.0.37 2022-04-05 21:05:58 -07:00
David Tolnay
f09fb0092d
Merge pull request #325 from dtolnay/xid
Rely on unicode-xid to optimize ASCII properly
2022-04-05 21:04:40 -07:00
David Tolnay
affce3688f
Rely on unicode-xid to optimize ASCII properly 2022-04-05 20:59:48 -07:00
David Tolnay
1bbc8b1b71
Merge pull request #323 from dtolnay/build
Delete RUSTFLAGS fallback from build script
2022-01-03 00:45:39 -08:00
David Tolnay
43cd33189b
Delete RUSTFLAGS fallback from build script 2022-01-03 00:41:48 -08:00
David Tolnay
08ce6ff9aa
Merge pull request #322 from dtolnay/build
Simplify env var handling in build script
2022-01-03 00:41:33 -08:00
David Tolnay
3e901dbf0e
Simplify env var handling in build script 2022-01-03 00:37:25 -08:00
David Tolnay
349596b7b4
Include global rustflags in rustflags override 2022-01-01 00:29:21 -08:00
David Tolnay
878cd246b2
Detect warnings in CI 2021-12-31 22:10:52 -08:00
David Tolnay
7ecea3b88f
Release 1.0.36 2021-12-27 12:01:19 -08:00
David Tolnay
8efe7d4141
Merge pull request #321 from dtolnay/literal
Restore support for versions without FromStr for proc_macro::Literal
2021-12-27 12:00:47 -08:00
David Tolnay
1a9b24df11
Restore support for versions without FromStr for proc_macro::Literal
FromStr for proc_macro::Literal was only added in Rust 1.54.
2021-12-27 11:56:19 -08:00