Commit Graph

46 Commits

Author SHA1 Message Date
徐未来
367de2e160 proc-macros2 1.0.53升级至1.0.76
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
2024-04-02 19:52:52 +08:00
openharmony_ci
07a217401d
回退 'Pull Request !4 : proc-macro2 1.0.53升级至1.0.76' 2024-04-02 03:32:41 +00:00
徐未来
7bc8a79f38 1.0.53升级至1.0.76
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
2024-03-08 16:48:24 +08:00
David Tolnay
67c6cbaf16
Expose proc_macro's source_text() on Span 2023-03-21 22:48:49 -07:00
David Tolnay
cc97264f9f
Expose proc_macro's before() and after() methods on Span 2022-09-24 15:03:15 -07: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
43cd33189b
Delete RUSTFLAGS fallback from build script 2022-01-03 00:41:48 -08:00
David Tolnay
3e901dbf0e
Simplify env var handling in build script 2022-01-03 00:37:25 -08:00
David Tolnay
1385671945
Work around doc build failure due to docs.rs flags change 2021-12-14 09:59:15 -08:00
David Tolnay
bf7f11678e
Enable span_open() and span_close() on Rust 1.55+ 2021-12-05 11:45:57 -08:00
David Tolnay
1a798db43b
Invert cfgs that deal with old compiler support 2021-12-05 11:30:48 -08:00
David Tolnay
059b4c3adb
Update cargo metadata and links to dtolnay repo 2021-10-26 10:48:19 -07:00
David Tolnay
3268f28ef6
Touch up PR 300 2021-10-12 09:55:22 -07:00
bjorn3
f0b0040bf8 Use proc_macro::is_available() on rust 1.57+
This avoids the need for catching a panic, which is incompatible with
projects using panic=abort or cg_clif.
2021-10-11 18:02:21 +02:00
David Tolnay
fb3504cfdf
Use real Literal::from_str from libproc_macro 2021-08-30 12:14:56 -07:00
David Tolnay
3f29657161
Recognize CARGO_ENCODED_RUSTFLAGS 2021-07-22 19:52:51 -07:00
David Tolnay
0093bbb16d
Backport LexError's Display to rust <1.44 2020-09-30 21:02:22 -07:00
David Tolnay
5245816550
Fix spacing inconsistency in build.rs doc 2020-09-30 21:02:10 -07:00
David Tolnay
23b7dd9582
Remove unwind-safe test on rust 1.31.0
On 1.31.0:

    error[E0277]: the type `std::cell::UnsafeCell<std::option::Option<syntax::tokenstream::TokenStream>>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
      --> tests/marker.rs:9:13
       |
    9  |               assert_implemented::<$ty>();
       |               ^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<syntax::tokenstream::TokenStream>>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
    ...
    74 | /     assert_unwind_safe! {
    75 | |         Delimiter
    76 | |         Group
    77 | |         Ident
    ...  |
    84 | |         TokenTree
    85 | |     }
       | |_____- in this macro invocation
       |
       = help: within `(syntax::parse::token::Nonterminal, syntax::parse::token::LazyTokenStream)`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<std::option::Option<syntax::tokenstream::TokenStream>>`
       = note: required because it appears within the type `std::cell::RefCell<std::option::Option<syntax::tokenstream::TokenStream>>`
       = note: required because it appears within the type `rustc_data_structures::sync::Lock<std::option::Option<syntax::tokenstream::TokenStream>>`
       = note: required because it appears within the type `syntax::parse::token::LazyTokenStream`
       = note: required because it appears within the type `(syntax::parse::token::Nonterminal, syntax::parse::token::LazyTokenStream)`
       = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::rc::Rc<(syntax::parse::token::Nonterminal, syntax::parse::token::LazyTokenStream)>`
       = note: required because it appears within the type `syntax::parse::token::Token`
       = note: required because it appears within the type `syntax::tokenstream::TokenTree`
       = note: required because it appears within the type `syntax::tokenstream::TokenStreamKind`
       = note: required because it appears within the type `syntax::tokenstream::TokenStream`
       = note: required because it appears within the type `proc_macro::TokenStream`
       = note: required because it appears within the type `proc_macro2:👿:DeferredTokenStream`
       = note: required because it appears within the type `proc_macro2:👿:TokenStream`
       = note: required because it appears within the type `proc_macro2::TokenStream`
    note: required by `unwind_safe::TokenStream::assert_implemented`
      --> tests/marker.rs:8:13
       |
    8  |               fn assert_implemented<T: $($marker +)+>() {}
       |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...
    74 | /     assert_unwind_safe! {
    75 | |         Delimiter
    76 | |         Group
    77 | |         Ident
    ...  |
    84 | |         TokenTree
    85 | |     }
       | |_____- in this macro invocation
2020-09-09 12:35:30 -07:00
David Tolnay
527c9efce0
Restore compatibility back to 1.31 2020-05-30 23:47:57 -07:00
Kevin Mehall
9b4633b991 Stabilize Span::resolved_at + Span::located_at with fallback
On compilers prior to 1.45 where this is not stable, these fall back to
returning the span associated with resolution behavior, since the source
location is only cosmetic. This is a reversal of the previous fallback
implementation, which preserved source location because it does not
track resolution location. The differnce is only observable with
`span_locations` enabled.

These methods were stabilized in Rust in
https://github.com/rust-lang/rust/pull/69041
2020-05-19 18:18:49 -07:00
Kevin Mehall
9e3896db28 Add Span::mixed_site() for Rust 1.45+
Fixes #210

This was stabilized in Rust in
https://github.com/rust-lang/rust/pull/68716
2020-05-19 09:10:36 -07:00
David Tolnay
16d1bf5c02 Allow nightly features on a dev compiler 2019-09-06 20:25:56 -07:00
David Tolnay
5fd7e8d3c2
Fail better on some old compilers
This message will appear on 1.22 through 1.26. Before 1.22, the build.rs
does not compile. On 1.27 through 1.30 it never runs because editions
are detected as unstable.
2019-08-16 09:02:53 -07:00
David Tolnay
25ae9526bc
Use question mark on Option 2019-07-19 11:54:35 -07:00
David Tolnay
f081412819
Use field init shorthand 2019-07-19 11:54:00 -07:00
David Tolnay
e02a294818
No longer need to look at compiler minor version 2019-07-19 11:49:53 -07:00
David Tolnay
d7dc146ce5
Assume that proc_macro is new enough 2019-07-19 11:48:47 -07:00
David Tolnay
8418d42997
Remove slow_extend codepath 2019-07-19 11:48:00 -07:00
David Tolnay
1596a8cee7
Assume that u128 is available 2019-07-19 11:46:56 -07:00
David Tolnay
ce12a482f0
Remove double negative in !proc_macro_span_disallowed 2019-04-28 14:12:49 -07:00
David Tolnay
b455dd7764
Use a cfg called proc_macro_span to control feature(proc_macro_span) 2019-04-28 13:51:38 -07:00
Wim Looman
099db2afbb Detect if the user has disallowed usage of the proc_macro_span feature 2019-04-28 11:55:09 +02:00
David Tolnay
3b1f7d28c1
Expose span locations on stable 2019-01-28 13:34:27 -08:00
David Tolnay
40bbb1cac4
Rename Span::unstable to Span::unwrap 2019-01-19 19:43:55 -08:00
David Tolnay
17eb070e4a
Infer nightly feature on nightly toolchain
Before this commit, enabling procmacro2_semver_exempt would disable
wrap_proc_macro, meaning that real spans would not be preserved by proc
macros. One would also need to enable the "nightly" feature in order to
preserve spans when using procmacro2_semver_exempt.

This commit automatically enables wrap_proc_macro when building with
procmacro2_semver_exempt on a nightly compiler.
2019-01-05 12:52:47 -08:00
Olivier Goffart
42d3019fdd Allow to use procmacro2_semver_exempt on stable rust
procmacro2_semver_exempt is working on rust < 1.29, but
since 1.29, proc_macro2 forward to proc_macro even when
procmacro2_semver_exempt is set, which require a nightly
compiler
2018-11-16 11:39:25 +01:00
David Tolnay
d7568e5332
Work around when built as a dependency in docs.rs
Our build script has:

    if cfg!(procmacro2_semver_exempt) {
        println!("cargo:rustc-cfg=super_unstable");
    }

But when proc-macro2 is built as a dependency of another crate in docs.rs, we
are seeing the builder invoke rustc with `--cfg super_unstable` but without
`--cfg procmacro2_semver_exempt`. The super_unstable flag is only set on that
one line, so procmacro2_semver_exempt should have also been set. Hopefully this
change will result in both flags being passed.

We will need to figure out how to set unstable flags only when building our own
docs.rs docs, not when building proc-macro2 as a dependency of a different
crate.
2018-11-11 15:23:35 -08:00
Alex Crichton
69385665d7 Add support for 128-bit integers
Only compile in this support if rustc is new enough, otherwise continue
to omit the bindings for older-than-1.26 rustc

Closes #143
2018-11-08 06:30:04 -08:00
David Tolnay
e839e4f42e
Enable rich API on 1.29.0 2018-09-06 09:51:02 -07:00
David Tolnay
2ff99cefe7
Format with rustfmt 0.99.2 2018-09-01 09:40:51 -07:00
Alex Crichton
ce0904dc1a Automatically use rich API on 1.30.0+
This commit detects the rustc version in the build script of proc-macro2
to determine whether the compiler supports the necessary backend APIs.
This should hopefully allow the crate to compile on stable by default
but have a better implementation on 1.30.0+ compilers.
2018-08-27 17:37:39 -07:00
David Tolnay
4b2cd39eb3
Revert "Disable linking to proc_macro on musl"
This reverts commit f3d1b2c781.
2018-08-13 10:55:21 -07:00
David Tolnay
5a556cffc5
Format with rustfmt 0.99.1 2018-08-12 13:49:39 -07:00
Alex Crichton
f3d1b2c781 Disable linking to proc_macro on musl
Closes #52
2018-08-11 21:56:16 -07:00
Alex Crichton
5354848b97 Consolidate cfg checks for wasm/proc_macro 2018-08-11 21:54:05 -07:00