Skip to content
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

Add 'lifetime' and 'type parameter list' fragment specifiers to macro parser. #10413

Closed
brendanzab opened this issue Nov 11, 2013 · 5 comments
Closed
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@brendanzab
Copy link
Member

This would make manipulating type parameter lists much easier.

@pnkfelix
Copy link
Member

cc me

@tomjakubowski
Copy link
Contributor

cc moi

@kmcallister
Copy link
Contributor

Sigh, I guess this is another problem with using the not-actually-delimiters < and > for type parameters. If they were real delimiters you could do

(... < $($x:tt)* > ...) => ...

but this will (I think) try to consume the terminating > as another $x:tt match.

There is probably a way to fix that with a recursive macro that eats one tt at a time, and checks for > first, but bleh.

@kmcallister kmcallister added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) and removed A-syntaxext Area: Syntax extensions labels Mar 3, 2015
@steveklabnik
Copy link
Member

triage: not aware of any change here.

@Mark-Simulacrum
Copy link
Member

This is now only tracking the type parameter fragments, which would definitely need an RFC. Lifetimes in macros are tracked here: #10413. I'm going to close this since there's nothing left to be tracked in the rust-lang/rust repo for this issue.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
[significant_drop_tightening] Fix rust-lang#10413

Fix rust-lang#10413

This is quite a rewrite that unfortunately took a  large amount of time. I tried my best to comment what is going on to easy review but feel free to ask any question.

The problem basically is that the current algorithm is only taking into consideration single blocks which means that things like the following don't work or show unpredictable results.

```rust
let mutex = Mutex::new(1);
{
  let lock = mutex.lock().unwrap();
  {
    let _ = *lock;
  }
}
```

The solve the issue, each path that refers a lock is now being tracked individually.

```
changelog: [`significant_drop_tightening`]: Lift the restriction of only considerate single blocks
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants