Commit Graph

66 Commits

Author SHA1 Message Date
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
Victor Berger
b69bf1153d Block import resolution only on 'pub' imports.
When resolving 'use' statements, only consider pub imports of the
target module as blocking.

Closes #4865
2015-08-05 21:57:27 +02:00
Victor Berger
58e35d7c2a Addressing nits & tests explanations. 2015-08-04 08:14:32 +02:00
Victor Berger
96041ccd10 More perseverant about indeterminate imports.
Most errors generated by resolve might be caused by
not-yet-resolved glob imports. This changes the behavior of the
resolve imports algorithms to not fail prematurally on first
error, but instead buffer intermediate errors and report them
only when stuck.

Fixes #18083
2015-07-31 19:10:14 +02:00
Victor Berger
88c2914e56 Remove unused resolve error message.
There is not situation where `foo` would be unresolved but not `foo::*`.
2015-07-31 19:10:14 +02:00
Oliver Schneider
00a5e66f81 remove get_ident and get_name, make as_str sound 2015-07-28 18:07:20 +02:00
Manish Goregaokar
8638dc7f9a nit 2015-07-18 03:06:35 +05:30
Alisdair Owens
94b1ca8448 Write diagnostics for E0364 and E0365 2015-07-17 21:05:51 +01:00
Guillaume Gomez
60133aa6dd Remove macro, import function and enum 2015-07-14 19:53:09 +02:00
Guillaume Gomez
31262c206e Arguments are now passed directly to the function instead of the enum variants 2015-07-14 16:32:43 +02:00
Guillaume Gomez
c5f7c19cf2 End of error code spanning centralization 2015-07-14 15:37:52 +02:00
Guillaume Gomez
f52a87c44e Centralize error spaning and add an enum to make this treatment easier 2015-07-13 19:32:45 +02:00
Guillaume Gomez
cbf0b1b399 Remove warnings by centralizing error codes usage 2015-07-13 02:05:02 +02:00
Guillaume Gomez
48ee57e656 Update error codes 2015-07-13 00:57:16 +02:00
Guillaume Gomez
8b731a5cac Add error codes 2015-07-13 00:31:09 +02:00
Guillaume Gomez
c3fd0e1229 Remove token::get_name when unneeded 2015-07-10 00:00:08 +02:00
bors
f451812763 Auto merge of #26385 - nham:fix_25396, r=alexcrichton
Currently in the E0252 message, traits and modules are all called types (as in "a type named `Foo` has already been imported", even when `Foo` was a trait or module). This commit changes that to additionally detect when the import in question is a trait or module and report it accordingly.

Fixes #25396.
2015-06-18 16:17:04 +00:00
Nick Hamann
b637f6b1bd Fix the E0252 error message to use better names for things.
Currently in the E0252 message, traits and modules are all called types
(as in "a type named `Foo` has already been imported", even when `Foo` was
a trait or module). This commit changes that to additionally detect when
the import in question is a trait or module and report it accordingly.

Fixes #25396.
2015-06-17 19:41:55 -05:00