@@ -13,32 +13,10 @@ impl<'a> Namespace<'a> {
1313 let index = self . alloc ( ) ;
1414 if let Some ( name) = name {
1515 if let Some ( _prev) = self . names . insert ( name, index) {
16- // FIXME: temporarily allow duplicately-named data and element
17- // segments. This is a sort of dumb hack to get the spec test
18- // suite working (ironically).
19- //
20- // So as background, the text format disallows duplicate
21- // identifiers, causing a parse error if they're found. There
22- // are two tests currently upstream, however, data.wast and
23- // elem.wast, which *look* like they have duplicately named
24- // element and data segments. These tests, however, are using
25- // pre-bulk-memory syntax where a bare identifier was the
26- // table/memory being initialized. In post-bulk-memory this
27- // identifier is the name of the segment. Since we implement
28- // post-bulk-memory features that means that we're parsing the
29- // memory/table-to-initialize as the name of the segment.
30- //
31- // This is technically incorrect behavior but no one is
32- // hopefully relying on this too much. To get the spec tests
33- // passing we ignore errors for elem/data segments. Once the
34- // spec tests get updated enough we can remove this condition
35- // and return errors for them.
36- if desc != "elem" && desc != "data" {
37- return Err ( Error :: new (
38- name. span ( ) ,
39- format ! ( "duplicate {} identifier" , desc) ,
40- ) ) ;
41- }
16+ return Err ( Error :: new (
17+ name. span ( ) ,
18+ format ! ( "duplicate {} identifier" , desc) ,
19+ ) ) ;
4220 }
4321 }
4422 Ok ( index)
0 commit comments