Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dtolnay/proc-macro2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.56
Choose a base ref
...
head repository: dtolnay/proc-macro2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.0.57
Choose a head ref
  • 10 commits
  • 7 files changed
  • 1 contributor

Commits on May 5, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    2b25bd9 View commit details
  2. Find out whether rust-src rustup component fixes ui test

    `cargo test --manifest-path tests/ui/Cargo.toml` is passing locally but
    fails in GitHub Actions.
    dtolnay committed May 5, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    37706ca View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    c282649 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    2d3959c View commit details

Commits on May 7, 2023

  1. Ignore new_without_default clippy lint

        error: you should consider adding a `Default` implementation for `TokenStream`
          --> src/fallback.rs:55:5
           |
        55 | /     pub fn new() -> Self {
        56 | |         TokenStream {
        57 | |             inner: RcVecBuilder::new().build(),
        58 | |         }
        59 | |     }
           | |_____^
           |
           = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
           = note: `-D clippy::new-without-default` implied by `-D clippy::all`
        help: try adding this
           |
        54 + impl Default for TokenStream {
        55 +     fn default() -> Self {
        56 +         Self::new()
        57 +     }
        58 + }
           |
    
        error: you should consider adding a `Default` implementation for `TokenStream`
          --> src/wrapper.rs:74:5
           |
        74 | /     pub fn new() -> Self {
        75 | |         if inside_proc_macro() {
        76 | |             TokenStream::Compiler(DeferredTokenStream::new(proc_macro::TokenStream::new()))
        77 | |         } else {
        78 | |             TokenStream::Fallback(fallback::TokenStream::new())
        79 | |         }
        80 | |     }
           | |_____^
           |
           = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
        help: try adding this
           |
        73 + impl Default for TokenStream {
        74 +     fn default() -> Self {
        75 +         Self::new()
        76 +     }
        77 + }
           |
    dtolnay committed May 7, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    7c637e7 View commit details
  2. Revert "Temporarily disable miri CI"

    This reverts commit 2d3959c.
    
    Fixed in nightly-2023-05-06.
    dtolnay committed May 7, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    2130305 View commit details

Commits on May 14, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    a597b3c View commit details

Commits on May 15, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    5f9d3fe View commit details
  2. Merge pull request #383 from dtolnay/procmacrospan

    Disable start()/end() on Span::Compiler
    dtolnay authored May 15, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    8bbbd60 View commit details
  3. Release 1.0.57

    dtolnay committed May 15, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    2c1b102 View commit details
Showing with 40 additions and 21 deletions.
  1. +9 −1 .github/workflows/ci.yml
  2. +1 −1 Cargo.toml
  3. +1 −1 fuzz/Cargo.toml
  4. +2 −0 rust-toolchain.toml
  5. +2 −1 src/lib.rs
  6. +0 −12 src/wrapper.rs
  7. +25 −5 tests/ui/test-not-send.stderr
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rust-src
- run: cargo test
- run: cargo test --no-default-features
- run: cargo test --features span-locations
@@ -52,6 +53,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- name: Enable type layout randomization
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
- run: cargo test
@@ -84,6 +87,7 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
with:
target: wasm32-unknown-unknown
components: rust-src
- run: cargo test --target wasm32-unknown-unknown --no-run

fuzz:
@@ -95,6 +99,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: dtolnay/install@cargo-fuzz
- run: cargo fuzz check
- run: cargo check --no-default-features --features afl
@@ -111,7 +117,9 @@ jobs:
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rust-src
- run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
- run: cargo clippy --tests --all-features -- -Dclippy::all -Dclippy::pedantic

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proc-macro2"
version = "1.0.56" # remember to update html_root_url
version = "1.0.57" # remember to update html_root_url
authors = ["David Tolnay <dtolnay@gmail.com>", "Alex Crichton <alex@alexcrichton.com>"]
autobenches = false
categories = ["development-tools::procedural-macro-helpers"]
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ publish = false
cargo-fuzz = true

[dependencies]
afl = { version = "0.12", optional = true }
afl = { version = "0.13", optional = true }
honggfuzz = { version = "0.5", optional = true }
libfuzzer-sys = { version = "0.4", optional = true }
proc-macro2 = { path = "..", default-features = false }
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
components = ["rust-src"]
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@
//! a different thread.
// Proc-macro2 types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.56")]
#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.57")]
#![cfg_attr(
any(proc_macro_span, super_unstable),
feature(proc_macro_span, proc_macro_span_shrink)
@@ -102,6 +102,7 @@
clippy::manual_assert,
clippy::must_use_candidate,
clippy::needless_doctest_main,
clippy::new_without_default,
clippy::return_self_not_must_use,
clippy::shadow_unrelated,
clippy::trivially_copy_pass_by_ref,
12 changes: 0 additions & 12 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
@@ -470,12 +470,6 @@ impl Span {
#[cfg(span_locations)]
pub fn start(&self) -> LineColumn {
match self {
#[cfg(proc_macro_span)]
Span::Compiler(s) => {
let proc_macro::LineColumn { line, column } = s.start();
LineColumn { line, column }
}
#[cfg(not(proc_macro_span))]
Span::Compiler(_) => LineColumn { line: 0, column: 0 },
Span::Fallback(s) => s.start(),
}
@@ -484,12 +478,6 @@ impl Span {
#[cfg(span_locations)]
pub fn end(&self) -> LineColumn {
match self {
#[cfg(proc_macro_span)]
Span::Compiler(s) => {
let proc_macro::LineColumn { line, column } = s.end();
LineColumn { line, column }
}
#[cfg(not(proc_macro_span))]
Span::Compiler(_) => LineColumn { line: 0, column: 0 },
Span::Fallback(s) => s.end(),
}
30 changes: 25 additions & 5 deletions tests/ui/test-not-send.stderr
Original file line number Diff line number Diff line change
@@ -5,8 +5,16 @@ error[E0277]: `proc_macro::Span` cannot be sent between threads safely
| ^^^^ `proc_macro::Span` cannot be sent between threads safely
|
= help: within `Span`, the trait `Send` is not implemented for `proc_macro::Span`
= note: required because it appears within the type `Span`
= note: required because it appears within the type `Span`
note: required because it appears within the type `Span`
--> $WORKSPACE/src/wrapper.rs
|
| pub(crate) enum Span {
| ^^^^
note: required because it appears within the type `Span`
--> $WORKSPACE/src/lib.rs
|
| pub struct Span {
| ^^^^
note: required by a bound in `requires_send`
--> test-not-send.rs:4:25
|
@@ -20,9 +28,21 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
| ^^^^ `Rc<()>` cannot be sent between threads safely
|
= help: within `Span`, the trait `Send` is not implemented for `Rc<()>`
= note: required because it appears within the type `ProcMacroAutoTraits`
= note: required because it appears within the type `PhantomData<ProcMacroAutoTraits>`
= note: required because it appears within the type `Span`
note: required because it appears within the type `ProcMacroAutoTraits`
--> $WORKSPACE/src/marker.rs
|
| pub(crate) struct ProcMacroAutoTraits(Rc<()>);
| ^^^^^^^^^^^^^^^^^^^
note: required because it appears within the type `PhantomData<ProcMacroAutoTraits>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `Span`
--> $WORKSPACE/src/lib.rs
|
| pub struct Span {
| ^^^^
note: required by a bound in `requires_send`
--> test-not-send.rs:4:25
|