Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Produce clone of input tokenstream if contains no paste #86

Merged
merged 3 commits into from
Aug 31, 2022
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Aug 31, 2022

This is a partial mitigation for #85. It only helps if the entire macro input contains no pastes [<>], such as in the minimal repro in that issue. Every other case involving Delimiter::None still remains broken due to rust-lang/rust#67062.

    error[E0507]: cannot move out of a shared reference
       --> tests/test_expr.rs:269:5
        |
    269 |     clone!(&A).consume_self();
        |     ^^^^^^^^^^^--------------
        |     |          |
        |     |          value moved due to this method call
        |     move occurs because value has type `A`, which does not implement the `Copy` trait
        |
    note: this function takes ownership of the receiver `self`, which moves value
       --> tests/test_expr.rs:266:25
        |
    266 |         fn consume_self(self) {}
        |                         ^^^^
    error: unused `self` argument
       --> tests/test_expr.rs:266:25
        |
    266 |         fn consume_self(self) {}
        |                         ^^^^
        |
        = note: `-D clippy::unused-self` implied by `-D clippy::pedantic`
        = help: consider refactoring to a associated function
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
@dtolnay dtolnay merged commit 671460b into master Aug 31, 2022
@dtolnay dtolnay deleted the clone branch August 31, 2022 07:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant