1
Fork 0

Forbid unnecessary visibility on view items

For `use` statements, this means disallowing qualifiers when in functions and
disallowing `priv` outside of functions.

For `extern mod` statements, this means disallowing everything everywhere. It
may have been envisioned for `pub extern mod foo` to be a thing, but it
currently doesn't do anything (resolve doesn't pick it up), so better to err on
the side of forwards-compatibility and forbid it entirely for now.

Closes #9957
This commit is contained in:
Alex Crichton 2014-01-16 13:27:27 -08:00
parent 9434e7c6cb
commit 4a78364d49
5 changed files with 55 additions and 6 deletions

View file

@ -73,7 +73,7 @@ impl fold::Folder for StandardLibraryInjector {
with_version("std"),
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::Private,
vis: ast::Inherited,
span: DUMMY_SP
}];
@ -83,7 +83,7 @@ impl fold::Folder for StandardLibraryInjector {
with_version("green"),
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::Private,
vis: ast::Inherited,
span: DUMMY_SP
});
vis.push(ast::ViewItem {
@ -91,7 +91,7 @@ impl fold::Folder for StandardLibraryInjector {
with_version("rustuv"),
ast::DUMMY_NODE_ID),
attrs: ~[],
vis: ast::Private,
vis: ast::Inherited,
span: DUMMY_SP
});
}
@ -147,7 +147,7 @@ impl fold::Folder for StandardLibraryInjector {
let vi2 = ast::ViewItem {
node: ast::ViewItemUse(~[vp]),
attrs: ~[],
vis: ast::Private,
vis: ast::Inherited,
span: DUMMY_SP,
};