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

Comments

Projects
None yet
7 participants
@niconii
Copy link
Member

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
@jonas-schievink

This comment has been minimized.

Copy link
Member

jonas-schievink commented Jan 1, 2016

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

cc @sanxiyn

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Jan 4, 2016

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

@Sean1708

This comment has been minimized.

Copy link

Sean1708 commented Jan 5, 2016

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

@jonas-schievink

This comment has been minimized.

Copy link
Member

jonas-schievink commented Jan 5, 2016

@Sean1708 Looks like a different bug to me

@Sean1708

This comment has been minimized.

Copy link

Sean1708 commented Jan 5, 2016

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

@brson

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

jonas-schievink commented Jan 7, 2016

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

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Jan 7, 2016

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

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Jan 8, 2016

Thanks @GuillaumeGomez!

@brson brson closed this Jan 8, 2016

@brson

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Feb 4, 2016

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

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Feb 4, 2016

Seems like #30708 has been backported?

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Feb 4, 2016

(In #30853.)

So I think we can close?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Feb 4, 2016

@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 Feb 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.