Commit Graph

146 Commits

Author SHA1 Message Date
Jeffrey Seyfried
5ff21f138a Refactor ModuleS fields public_glob_count, private_glob_count, and
`resolved_globs` into a single field `globs: RefCell<Vec<ImportDirective>>`.
2016-03-27 03:53:42 +00:00
Eduard Burtescu
5efdde0de1 rustc: move cfg, infer, traits and ty from middle to top-level. 2016-03-27 01:05:54 +02:00
Jeffrey Seyfried
1744f55ad7 Refactor away GraphBuilder 2016-03-26 18:22:40 +00:00
Jeffrey Seyfried
0bed9aea2d Make populate_module_if_necessary a method of resolver 2016-03-26 18:22:37 +00:00
Jeffrey Seyfried
77f0f4a624 Avoid repeating parent 2016-03-26 18:22:34 +00:00
Jeffrey Seyfried
ff014a3a10 Refactor away populate_external_module 2016-03-26 18:22:33 +00:00
Jeffrey Seyfried
7bc6c75d0f Refactor away handle_external_def 2016-03-26 18:22:31 +00:00
Jeffrey Seyfried
febef471e3 Refactor how the prelude is handled 2016-03-25 22:22:12 +00:00
Jeffrey Seyfried
21064d097e Refactor away resolve_imports::Shadowable and rename shadowable -> is_prelude 2016-03-25 22:18:30 +00:00
Jeffrey Seyfried
65ec4dfe61 Improve diagnostics for duplicate names 2016-03-16 08:52:31 +00:00
bors
5807fbbfde Auto merge of #32134 - jseyfried:forbid_type_alias_as_module, r=nikomatsakis
Forbid glob-importing from a type alias

This PR forbids glob-importing from a type alias or trait (fixes #30560):
```rust
type Alias = ();
use Alias::*; // This is currently allowed but shouldn't be
```

This is a [breaking-change]. Since the disallowed glob imports don't actually import anything, any breakage can be fixed by removing the offending glob import.

r? @alexcrichton
2016-03-11 09:26:47 -08:00
bors
3ac4076ac0 Auto merge of #32097 - jseyfried:fix_resolution_regression, r=nikomatsakis
Fix a regression in import resolution

This fixes #32089 (caused by #31726) by deducing that name resolution has failed (as opposed to being determinate) in more cases.

r? @nikomatsakis
2016-03-09 22:41:48 -08:00
Jeffrey Seyfried
ad28c28f46 Stop treating a type alias like a module or enum (preventing use TypeAlias::*) 2016-03-08 21:50:20 +00:00
Jeffrey Seyfried
61f1f4d21e Add a field pub_outstanding_references to NameResolution.
Add an argument `allow_private_imports` to some methods.
2016-03-07 11:24:20 +00:00
Jeffrey Seyfried
2998564615 Refactor away ExternalExports 2016-03-06 05:46:49 +00:00
Jeffrey Seyfried
b3572ae15a Finish encapsulating the details of import resolution in resolve_imports 2016-03-04 20:48:55 +00:00
Jeffrey Seyfried
20b99d303d Start importing bindings from globs as soon as the glob path is known. 2016-03-04 20:48:51 +00:00
Jeffrey Seyfried
fb4710ce21 Add a field in Module for the ResolverArenas 2016-03-04 20:48:50 +00:00
Jeffrey Seyfried
6b94bc345c Add an arena for import directives 2016-03-04 20:48:49 +00:00
Jeffrey Seyfried
064f17c6a3 Record that an import succeeded or failed in one namespace even while it is indeterminate in the other namespace (fixes #31444) 2016-03-04 20:48:43 +00:00
bors
7cee8b9ffb Auto merge of #31824 - jseyfried:privacy_in_resolve, r=nikomatsakis
This PR privacy checks paths as they are resolved instead of in `librustc_privacy` (fixes #12334 and fixes #31779). This removes the need for the `LastPrivate` system introduced in PR #9735, the limitations of which cause #31779.

This PR also reports privacy violations in paths to intra- and inter-crate items the same way -- it always reports the first inaccessible segment of the path.

Since it fixes #31779, this is a [breaking-change]. For example, the following code would break:
```rust
mod foo {
    pub use foo::bar::S;
    mod bar { // `bar` should be private to `foo`
        pub struct S;
    }
}

impl foo::S {
    fn f() {}
}

fn main() {
    foo::bar::S::f(); // This is now a privacy error
}
```

r? @alexcrichton
2016-03-03 02:21:28 +00:00
Vadim Petrochenkov
9047b201bf Move span into StructField
+ some cleanup in rustdoc
2016-03-02 10:32:04 +03:00
Vadim Petrochenkov
8b026a6e48 Use numeric field Names ("0", "1" etc) for positional fields 2016-03-02 10:31:19 +03:00
Vadim Petrochenkov
8b60b948d9 Get rid of hir::StructFieldKind 2016-03-02 10:31:19 +03:00
Jeffrey Seyfried
b20d567c2b Privacy check paths in resolve and typeck 2016-02-26 00:37:27 +00:00
Jeffrey Seyfried
07957ffb2e Refactor Module's field extern_crate_did: Option<DefId> to extern_crate_id: Option<NodeId> 2016-02-26 00:37:27 +00:00
Jeffrey Seyfried
3358fb11da Fix the visibility of extern crate declarations and stop warning on pub extern crate 2016-02-24 01:34:14 +00:00
Jeffrey Seyfried
5ad84f1301 Replace the field imports in Module with unresolved_imports and refactor away resolved_import_count 2016-02-18 00:02:50 +00:00
Jeffrey Seyfried
81d5d02c37 Rename Module field anonymous_children to module_children, expand it to include both named an anonymous modules, and fix #31644 2016-02-14 09:05:37 +00:00
Jeffrey Seyfried
d881eee608 Change try_define_child to return a Result instead of an Option 2016-02-08 02:25:07 +00:00
Jeffrey Seyfried
16e7ff1bff Write and use increment_outstanding_references_for and decrement_outstanding_references_for 2016-02-08 02:25:05 +00:00
Jeffrey Seyfried
96b4dc4b87 Refactor away the fields id and is_public of ImportResolution and rename ImportResolution to NameResolution 2016-02-08 02:25:03 +00:00
Jeffrey Seyfried
2e24c7410f Expand NameBinding to better represent bindings from imports 2016-02-08 02:24:53 +00:00
Jeffrey Seyfried
22e189ed57 Add and use an arena for NameBindings 2016-02-08 02:24:16 +00:00
Jeffrey Seyfried
9c166cb671 Remove unneeded borrows and slices 2016-02-03 23:40:46 +00:00
Jeffrey Seyfried
23bdbb13f4 Refactor block_needs_anonymous_module 2016-02-03 23:39:13 +00:00
Jeffrey Seyfried
e768fa729f Refactor away the field Module::external_module_children in resolve 2016-01-31 03:38:41 +00:00
Jeffrey Seyfried
1ca9f03ead Nits and other local improvements in resolve 2016-01-29 21:18:15 +00:00
Jeffrey Seyfried
118c93ba5e Refactor away NameBindings, NsDef, ImportResolutionPerNamespace, DuplicateCheckingMode, and NamespaceDefinition. 2016-01-29 21:18:12 +00:00
Vadim Petrochenkov
ff6b0aac6a resolve: Fix variant namespacing 2016-01-21 23:22:01 +03:00
Vadim Petrochenkov
2084c2c33a Rename Def's variants and don't reexport them 2016-01-20 22:31:10 +03:00
Vadim Petrochenkov
ceaaa1bc33 Refactor definitions of ADTs in rustc::middle::def 2016-01-20 21:50:57 +03:00
Jeffrey Seyfried
a8514d3ecc resolve: use arena allocation instead of reference counting for Modules to fix memory leaks from Rc cycles 2016-01-13 00:54:16 +00:00
Jeffrey Seyfried
834fb17e94 Fix bug in duplicate checking for extern crates. 2016-01-06 07:04:48 +00:00
Nick Cameron
aaa02b3ff9 Refactoring 2015-12-30 14:27:59 +13:00
Nick Cameron
95dc7efad0 use structured errors 2015-12-30 14:27:59 +13:00
Vadim Petrochenkov
73307475f9 Prohibit private variant reexports 2015-12-18 04:12:31 +03:00
bors
6734dccc31 Auto merge of #30325 - jseyfried:fixes_30078, r=nrc
This fixes a bug in which unused imports can get wrongly marked as used when checking for unused qualifications in `resolve_path` (issue #30078), and it removes unused imports that were previously undetected because of the bug.
2015-12-17 18:21:25 +00:00
Jeffrey Seyfried
8364a6feef Remove unused imports 2015-12-17 05:43:27 +00:00
Vadim Petrochenkov
0cc69f0ea3 rustc: Remove def::DefUse 2015-12-16 18:19:11 +03:00