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

Bad syntax in macro_rules! macro definition causes an ICE in beta and nightly, but not stable #30669

Closed
niconii opened this issue Jan 1, 2016 · 14 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) regression-from-stable-to-beta Performance or correctness regression from stable to beta.

Comments

@niconii
Copy link
Contributor

niconii commented Jan 1, 2016

This code:

macro_rules! foo {
    $($t:tt)* => (1);
}

fn main() {
    foo!();
}

gives the following error on 1.5 stable (which is correct, though where it points is perhaps a little odd):

<anon>:6:5: 6:12 error: malformed macro lhs
<anon>:6     foo!();
             ^~~~~~~

but this error on 1.6 beta and the current nightly:

<anon>:6:5: 6:12 error: internal compiler error: malformed macro lhs
<anon>:6     foo!();
             ^~~~~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:175
@sfackler sfackler added regression-from-stable-to-beta Performance or correctness regression from stable to beta. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jan 1, 2016
@jonas-schievink
Copy link
Contributor

The culprit seems to be cce7b8b, which changes the check from span_fatal to span_bug

cc @sanxiyn

@GuillaumeGomez
Copy link
Member

I'll take a look if no one is on it.

@Sean1708
Copy link

Sean1708 commented Jan 5, 2016

Possibly related, this code causes an ICE on nightly, but not on beta or stable.

@jonas-schievink
Copy link
Contributor

@Sean1708 Looks like a different bug to me

@Sean1708
Copy link

Sean1708 commented Jan 5, 2016

@jonas-schievink Thanks, I'll open a new issue then.

@brson
Copy link
Contributor

brson commented Jan 7, 2016

@Sean1708 When you do can you link it from here? It needs to be tagged as a regression.

@jonas-schievink
Copy link
Contributor

@brson It was #30715, which was already fixed in #30723

@GuillaumeGomez
Copy link
Member

@jonas-schievink: I just fixed the regression and added a test, not the supposed improvement.

@brson
Copy link
Contributor

brson commented Jan 8, 2016

Thanks @GuillaumeGomez!

@brson brson closed this as completed Jan 8, 2016
@brson
Copy link
Contributor

brson commented Jan 8, 2016

Oh, wait, this hasn't been backported yet. I'll leave it open a bit.

@brson brson reopened this Jan 8, 2016
@nikomatsakis
Copy link
Contributor

What precisely should be backported here? I cant' figure out through all the comments :)

@nikomatsakis
Copy link
Contributor

Seems like #30708 has been backported?

@nikomatsakis
Copy link
Contributor

(In #30853.)

So I think we can close?

@GuillaumeGomez
Copy link
Member

@nikomatsakis: I think as well. The purpose here was to fix the regression, which is done. Unless @brson has another reason?

@brson brson closed this as completed Feb 5, 2016
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, ..) regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
None yet
Development

No branches or pull requests

7 participants