rustc: "extern mod { ... }" should be written "extern { ... }" instead
This commit is contained in:
parent
c3ac0f8fd9
commit
4846affedb
4 changed files with 25 additions and 8 deletions
|
@ -2915,15 +2915,34 @@ struct parser {
|
||||||
attrs: ~[attribute],
|
attrs: ~[attribute],
|
||||||
items_allowed: bool)
|
items_allowed: bool)
|
||||||
-> item_or_view_item {
|
-> item_or_view_item {
|
||||||
|
|
||||||
|
let mut must_be_named_mod = false;
|
||||||
if self.is_keyword(~"mod") {
|
if self.is_keyword(~"mod") {
|
||||||
|
must_be_named_mod = true;
|
||||||
self.expect_keyword(~"mod");
|
self.expect_keyword(~"mod");
|
||||||
} else {
|
} else if self.is_keyword(~"module") {
|
||||||
|
must_be_named_mod = true;
|
||||||
self.expect_keyword(~"module");
|
self.expect_keyword(~"module");
|
||||||
|
} else if self.token != token::LBRACE {
|
||||||
|
self.span_fatal(copy self.span,
|
||||||
|
fmt!("expected `{` or `mod` but found %s",
|
||||||
|
token_to_str(self.reader, self.token)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let (sort, ident) = match self.token {
|
let (sort, ident) = match self.token {
|
||||||
token::IDENT(*) => (ast::named, self.parse_ident()),
|
token::IDENT(*) => (ast::named, self.parse_ident()),
|
||||||
_ => (ast::anonymous,
|
_ => {
|
||||||
|
if must_be_named_mod {
|
||||||
|
self.span_fatal(copy self.span,
|
||||||
|
fmt!("expected foreign module name but \
|
||||||
|
found %s",
|
||||||
|
token_to_str(self.reader,
|
||||||
|
self.token)));
|
||||||
|
}
|
||||||
|
|
||||||
|
(ast::anonymous,
|
||||||
token::special_idents::clownshoes_foreign_mod)
|
token::special_idents::clownshoes_foreign_mod)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// extern mod { ... }
|
// extern mod { ... }
|
||||||
|
|
|
@ -823,7 +823,6 @@ fn encode_info_for_foreign_item(ecx: @encode_ctxt, ebml_w: ebml::Writer,
|
||||||
encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, nitem.id));
|
encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, nitem.id));
|
||||||
encode_symbol(ecx, ebml_w, nitem.id);
|
encode_symbol(ecx, ebml_w, nitem.id);
|
||||||
encode_path(ecx, ebml_w, path, ast_map::path_name(nitem.ident));
|
encode_path(ecx, ebml_w, path, ast_map::path_name(nitem.ident));
|
||||||
ebml_w.end_tag();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
|
|
|
@ -5528,7 +5528,6 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||||
let g = do str::as_c_str(*ident) |buf| {
|
let g = do str::as_c_str(*ident) |buf| {
|
||||||
llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, typ), buf)
|
llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, typ), buf)
|
||||||
};
|
};
|
||||||
ccx.item_symbols.insert(ni.id, copy *ident);
|
|
||||||
g
|
g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
#[link_name = "rustrt"]
|
#[link_name = "rustrt"]
|
||||||
extern mod {
|
extern {
|
||||||
fn last_os_error() -> ~str;
|
fn last_os_error() -> ~str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue