Repository navigation
ICE with nested macros #4650
Copy link
Copy link
Closed
Labels
A-syntaxextArea: Syntax extensionsArea: Syntax extensionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
Activity
Seems non-critical for 0.7. Nominating for milestone 5 (production-ready).
accepted for production ready
Updated test case:
use std::util::with; use std::hashmap::HashMap; fn main() { let mut map = HashMap::new(); map.insert(1, 1); macro_rules! add_foo( ($a1:expr, $b1:expr) => ({ map.find(&$a1).map(|&m| *m + $b1); }) ); macro_rules! foo( ($a:expr, $b:expr) => ({ add_foo!($a, $b); add_foo!($b, $a); }) ); let def = 1; foo!(def, def); }
$ rustc foo.rs foo.rs:22:12: 22:15 error: internal compiler error: No variable registered for id 20 foo.rs:22 foo!(def, def); ^~~ foo.rs:8:2: 12:4 note: in expansion of add_foo! foo.rs:16:6: 16:23 note: expansion site foo.rs:14:2: 19:4 note: in expansion of foo! foo.rs:22:2: 22:17 note: expansion siteI think the tag "A-macos" is unfortunate, since this is not Mac OS specific. Or is it?
@kud1ing good catch, someone probably mistook it for macros. It's been updated to A-mac-osx though, which should prevent that.
Still ICEs.
Closed with what I believe was the renumbering of the AST. There's plenty of tests for this already present, so closing issue entirely.
Metadata
Metadata
Assignees
Labels
A-syntaxextArea: Syntax extensionsArea: Syntax extensionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
This program:
fail with: