Skip to content

Fix a "will be a hard error" warning + drive-by #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 24, 2019
Merged

Fix a "will be a hard error" warning + drive-by #245

merged 12 commits into from
Apr 24, 2019

Conversation

SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Apr 23, 2019

See individual commits


This change is Reviewable

// Using `stringify!` enables passing arbitrary tokens
// rather than only what can be parsed as a const expression.
Input = (0, stringify! $paren ).0
($proc_macro_name: ident ! $paren: tt) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a bug, probably I'd manually de-indent this macro for now.

vimpunk and others added 12 commits April 24, 2019 15:37
That’s when `trim_start` was added
```
warning[E0506]: cannot assign to `self.input.cached_token` because it is borrowed
   --> src/parser.rs:591:17
    |
566 |     pub fn next_including_whitespace_and_comments(&mut self) -> Result<&Token<'i>, BasicParseError<'i>> {
    |                                                   - let's call the lifetime of this reference `'1`
...
579 |             Some(ref cached_token)
    |                  ---------------- borrow of `self.input.cached_token` occurs here
...
591 |                 self.input.cached_token = Some(CachedToken {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `self.input.cached_token` occurs here
...
603 |         Ok(token)
    |         --------- returning this value requires that `self.input.cached_token.0` is borrowed for `'1`
    |
    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
```
@SimonSapin
Copy link
Member Author

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 16dbe6e has been approved by SimonSapin

@bors-servo
Copy link
Contributor

⌛ Testing commit 16dbe6e with merge 6cf81e9...

bors-servo pushed a commit that referenced this pull request Apr 24, 2019
Fix a "will be a hard error" warning + drive-by

See individual commits

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/245)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - checks-travis

@SimonSapin
Copy link
Member Author

@bors-servo retry

bors-servo pushed a commit that referenced this pull request Apr 24, 2019
Fix a "will be a hard error" warning + drive-by

See individual commits

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/245)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

⌛ Testing commit 16dbe6e with merge 9c00fc4...

@SimonSapin SimonSapin mentioned this pull request Apr 24, 2019
@bors-servo
Copy link
Contributor

☀️ Test successful - checks-travis
Approved by: SimonSapin
Pushing 9c00fc4 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants