Commit Graph

83 Commits

Author SHA1 Message Date
Jeffrey Seyfried
845ad1b4ed Stop trying to resolve an import directive after the resolution fails 2016-02-17 23:55:00 +00:00
bors
4ce803837e Auto merge of #31648 - jseyfried:fix_diagnostics, r=nrc
This PR fixes two unrelated diagnostics bugs in resolve.

First, it reports privacy errors for an import only after the import resolution is determined, fixing #31402.

Second, it expands the per-module map from block ids to anonymous modules so that it also maps module declarations ids to modules, and it uses this map to in `with_scope` to fix #31644.

r? @nrc
2016-02-15 07:13:02 +00:00
bors
69ad91290d Auto merge of #31566 - jseyfried:fix_regression, r=nrc
This fixes a regression caused by #31461 allowing extern crates to be glob imported, and it fixes the test that was supposed to catch it.
r? @nrc
2016-02-15 05:19:29 +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
4af85643b1 Rename Module field children to resolutions 2016-02-14 08:47:55 +00:00
Jeffrey Seyfried
b7889ef235 Report privacy errors at most once per import (fixes #31402) 2016-02-13 21:35:32 +00:00
Jonas Schievink
8ac5f87db8 Autoderef in librustc_resolve 2016-02-12 19:28:42 +01:00
Jeffrey Seyfried
91894631d0 Fix regression from #31461 and fix the test that was supposed to catch it. 2016-02-11 07:27:12 +00:00
Jeffrey Seyfried
3df40c09ec Allow prelude imports to shadow eachother (needed for the [pretty] tests)
Derive the Default impl for NameResolution
2016-02-09 17:30:45 +00:00
Jeffrey Seyfried
d7734aebec Refactor away add_export and cleanup the end of resolve_single_import 2016-02-08 02:25:09 +00:00
Jeffrey Seyfried
7000e70825 Replace children and import_resolutions with a single NameResolution-valued map.
Refactor away resolve_name_in_module in resolve_imports.rs

Rewrite and improve the core name resolution procedure in NameResolution::result and Module::resolve_name

Refactor the duplicate checking code into NameResolution::try_define
2016-02-08 02:25:08 +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
4428b1cfdf Refactor away separate tracking of used_public and used_reexport.
NameBinding now encodes these directly with binding.is_public() and (binding.is_public() && binding.is_import()) (respectively)
2016-02-08 02:25:00 +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
7366d105cb Refactor away Target 2016-02-08 02:22:41 +00:00
Jeffrey Seyfried
9c166cb671 Remove unneeded borrows and slices 2016-02-03 23:40:46 +00:00
Jeffrey Seyfried
964b72b3e0 Refactor resolve_import_for_module 2016-02-03 23:39:16 +00:00
Jeffrey Seyfried
2ed210d5fe Refactor more functionality into record_import_use 2016-02-03 23:39:12 +00:00
Dirk Gadsden
5ed8e98ea2 Add fake import resolutions & targets for names in bad imports 2016-02-02 20:47:34 -08:00
bors
28bed3f5e6 Auto merge of #31317 - jseyfried:remove_external_module_children, r=nrc
This PR refactors away `Module`'s `external_module_children` and instead puts `extern crate` declarations in `children` like other items, simplifying duplicate checking and name resolution.

This PR also allows values to share a name with extern crates, which are only defined in the type namespace. Other than that, it is a pure refactoring.

r? @nrc
2016-02-01 14:26:48 +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
7a69ee0c48 Revert PR #30324, fixing a bug in which a public glob import can make preceding imports public (fixes #30159). 2016-01-31 02:21:54 +00:00
Jeffrey Seyfried
1ca9f03ead Nits and other local improvements in resolve 2016-01-29 21:18:15 +00:00
Jeffrey Seyfried
e13a0450d3 Clean up resolve_single_import 2016-01-29 21:18:14 +00:00
Jeffrey Seyfried
118c93ba5e Refactor away NameBindings, NsDef, ImportResolutionPerNamespace, DuplicateCheckingMode, and NamespaceDefinition. 2016-01-29 21:18:12 +00:00
Jeffrey Seyfried
d2d2144656 Refactor away NameSearchType 2016-01-28 05:07:40 +00:00
Vadim Petrochenkov
2084c2c33a Rename Def's variants and don't reexport them 2016-01-20 22:31:10 +03:00
Jeffrey Seyfried
a353490e6f resolve: Remove record_exports, fixes #4953 2016-01-14 22:51:58 +00: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
Nick Cameron
95dc7efad0 use structured errors 2015-12-30 14:27:59 +13:00
bors
4ce1dafd1d Auto merge of #30377 - Wafflespeanut:levenshtein, r=Manishearth
fixes part of #30197
2015-12-23 08:55:38 +00:00
Vadim Petrochenkov
8f359d5912 Prohibit public glob reexports of private variants 2015-12-18 04:14:46 +03:00
Vadim Petrochenkov
73307475f9 Prohibit private variant reexports 2015-12-18 04:12:31 +03:00
Ravi Shankar
51ff171948 Modify the Levenshtein-based suggestions to include imports 2015-12-16 16:33:24 +05:30
Jeffrey Seyfried
de0de61dd4 Partially undo the fix of issue #30159 in PR #30294 to avoid breakage. 2015-12-11 21:21:13 +00:00
Jeffrey Seyfried
ada87fae5f Rename (Ns)ImportResolution 2015-12-11 01:38:13 +00:00
Jeffrey Seyfried
27c4f9e7b1 Fix a bug in which the visibility of a use declaration defining a name in one namespace (e.g. the value namespace) is overridden by a later use declaration defining the same name in the other namespace (e.g. the type namespace). 2015-12-10 02:55:05 +00:00
Jeffrey Seyfried
4da9694a55 Fixes #30089 2015-12-01 08:13:41 +00:00
Jeffrey Seyfried
6a6e1dba55 Refactor away get_module_if_available and get_module and reformat one-liners 2015-11-18 01:22:32 +00:00
Jeffrey Seyfried
572c2f3e07 Fix issue #21546 and refactor NsDef 2015-11-17 09:10:41 +00:00
Jeffrey Seyfried
8a6187fde1 Refactor fields def_id and kind of Module into a single field def.
Change build_reduced_graph.rs so the fields def and module of NsDef are never both Some unless the NsDef represents a duplicate definition (see issue 26421).
2015-11-16 07:59:50 +00:00
Jeffrey Seyfried
ceda8383c9 Replace TypeNsDef and ValueNsDef with a more general type NsDef.
Define a newtype `NameBinding` for `Rc<RefCell<Option<NsDef>>>` and refactor `NameBindings` to be a `NameBinding` for each namespace.

Replace uses of `NameBindings` with `NameBinding` where only one binding is being used (in `NamespaceResult`, `Target,` etc).

Refactor away `resolve_definition_of_name_in_module` and `NameDefinition`.
2015-11-16 02:10:09 +00:00
corentih
889b0e9ace rustfmt librustc_resolve 2015-11-14 16:21:30 +01:00
Vadim Petrochenkov
f284cbc7af Cleanup interfaces of Name, SyntaxContext and Ident
Make sure Name, SyntaxContext and Ident are passed by value
Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-09-24 23:05:02 +03:00
Vadim Petrochenkov
40ce80484c Remove random Idents outside of libsyntax 2015-09-23 20:04:49 +03:00
Niko Matsakis
e91bef2e05 fallout from moving def-id 2015-08-24 05:35:34 -04:00
Victor Berger
5847ea7619 Customize error messages for self glob imports. 2015-08-07 14:18:20 +02:00
Victor Berger
8e24091f98 Factor inc/dec count methods. 2015-08-06 12:47:10 +02:00