Commit Graph

48 Commits

Author SHA1 Message Date
Vadim Petrochenkov
73307475f9 Prohibit private variant reexports 2015-12-18 04:12:31 +03:00
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
Nick Hamann
0c22cd7906 Fix error message for E0256 in certain cases.
Previously, it said "import `Foo` conflicts with existing submodule" even
when it was a type alias, enum, or trait. The message now says the conflict
is with "type in this module" in the case of the first two, and "trait in
this module" for the last one.

Fixes #24081.
2015-06-16 18:55:52 -05:00
Joshua Landau
d7f5fa4636 Conver reborrows to .iter() calls where appropriate 2015-06-11 13:56:07 +01:00
bors
feac9f1c7b Auto merge of #24818 - tbelaire:double-import, r=nrc
This isn't quite right, but it's interesting.
2015-05-12 08:54:40 +00:00
Theo Belaire
db9d018424 Fixed some nits 2015-05-01 11:37:38 -04:00
Tamir Duberstein
8c58fe1739 Fallout 2015-04-29 08:55:31 -07:00
Theo Belaire
5c05278fec Fixed types, and slimmed down code
I don't this we need to print the definition of the
imported value too, though it's quite possible.
2015-04-25 15:45:29 -04:00
Theo Belaire
69a5c379df Maybe it works
Still compiling, but I think I have it!
2015-04-25 15:11:56 -04:00
Theo Belaire
168615f869 Now passing in the ImportResolver to check_conflict...
It compiles, yay.
2015-04-25 14:35:47 -04:00
Theo Belaire
74648b5d64 First attempt at fixing #20591
This isn't quite right, but it's interesting.
2015-04-25 14:09:41 -04:00
Tamir Duberstein
29ac04402d Positive case of len() -> is_empty()
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14 20:26:03 -07:00
Niko Matsakis
d9530c01a7 Fallout out rustc 2015-04-01 11:22:39 -04:00
Alex Crichton
28a6b16130 rollup merge of #23741: alexcrichton/remove-int-uint
Conflicts:
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/adt.rs
	src/librustc_typeck/check/mod.rs
	src/libserialize/json.rs
	src/test/run-pass/spawn-fn.rs
2015-03-27 10:10:05 -07:00
Alexis Beingessner
1b98f6da7a default => or_insert per RFC 2015-03-27 07:42:03 -04:00
Alex Crichton
43bfaa4a33 Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
2015-03-26 12:10:22 -07:00
Aaron Turon
5fe0bb743a Future-proof indexing on maps: remove IndexMut
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in
order to future-proof the API against the eventual inclusion of an
`IndexSet` trait.

Ideally, we would eventually be able to support:

```rust
map[owned_key] = val;
map[borrowed_key].mutating_method(arguments);
&mut map[borrowed_key];
```

but to keep the design space as unconstrained as possible, we do not
currently want to support `IndexMut`, in case some other strategy will
eventually be needed.

Code currently using mutating index notation can use `get_mut` instead.

[breaking-change]

Closes #23448
2015-03-20 10:46:31 -07:00
Nick Cameron
2df1ceb001 resolve: factor out resolve imports to its own module 2015-03-16 11:03:54 +13:00