Commit Graph

311 Commits

Author SHA1 Message Date
Alexis Beingessner
5bbaa3c9ac fallout of reworking rc and arc APIs 2015-08-19 15:52:12 -07:00
bors
e47eb7c2c8 Auto merge of #27493 - GSam:master, r=nrc
In order to test the validity of identifiers, exposing the name resolution module is necessary. Other changes mostly comprise of exposing modules publicly like parts of save-analysis, so they can be called appropriately.
2015-08-19 03:50:05 +00:00
Alex Crichton
2972b77134 Add issue for the rustc_private feature everywhere 2015-08-15 18:09:17 -07:00
bors
82169afba7 Auto merge of #27698 - arielb1:foreign-type-import, r=alexcrichton
Fixes #22968
Probably fixes #27602 (the issue needs a reproduction)

r? @alexcrichton
2015-08-12 22:42:12 +00:00
Ariel Ben-Yehuda
1dd0c058cf stop cross-crate associated types from being imported
Fixes #22968
Probably fixes #27602
2015-08-12 19:58:32 +03:00
Alex Crichton
726c9f2c80 rollup merge of #27635: GuillaumeGomez/patch-4
r? @Manishearth
2015-08-11 22:42:19 -07:00
Alex Crichton
737397c584 rollup merge of #27622: eefriedman/https-url
Also fixes a few outdated links.
2015-08-11 22:11:25 -07:00
Guillaume Gomez
f1e613eeb1 Update E0425 error explanation 2015-08-11 19:16:23 +02:00
bors
8856927f64 Auto merge of #27451 - seanmonstar:use-groups-as, r=alexcrichton
An implementation of [RFC 1219](https://github.com/rust-lang/rfcs/pull/1219).

The RFC is not merged yet, but once merged, this could be.
2015-08-10 20:24:06 +00:00
bors
1db1417736 Auto merge of #27547 - vberger:more_perseverant_resolve, r=nrc
As noted in my previous PR #27439 , the import resolution algorithm has two cases where it bails out:

- The algorithm will delay an import if the module containing the target of the import still has unresolved glob imports
- The algorithm will delay a glob import of the target module still has unresolved imports

This PR alters the behaviour to only bail out when the above described unresolved imports are `pub`, as non-pub imports don't affect the result anyway.

It is still possible to fail the algorithm with examples like
```rust
pub mod a {
    pub use b::*;
}

pub mod b {
    pub use a::*;
}
```
but such configurations cannot be resolved in any meaningful way, as these are cyclic imports.

Closes #4865
2015-08-10 14:40:07 +00:00
Guillaume Gomez
347991540a Add another example for E0425 2015-08-10 15:29:06 +02:00
Garming Sam
fc9ecae444 Modify the callback to be run from a macro 2015-08-10 19:12:47 +12:00
Eli Friedman
bbbfed2f93 Use https URLs to refer to rust-lang.org where appropriate.
Also fixes a few outdated links.
2015-08-09 14:28:46 -07:00
Garming Sam
fdba872944 Add a proper comment for create_resolver 2015-08-09 21:09:55 +12:00
Garming Sam
8b98256f64 Remove some duplicated code with new create_resolver 2015-08-09 20:54:12 +12:00
Garming Sam
251696ed0d Remove unused language items 2015-08-09 20:54:11 +12:00
Garming Sam
ff6dd5c24b Avoid change to current module on escape from callback 2015-08-09 20:54:11 +12:00
Garming Sam
f4ea3928ac Introduce callback to resolver
Sets a flag to pass through the rest of the walker.
2015-08-09 20:53:57 +12:00
Sean McArthur
cfcd449c4c rustc: rename multiple imports in a list 2015-08-08 11:54:15 -07:00
bors
e5d90d9840 Auto merge of #27378 - GuillaumeGomez:patch-2, r=brson
Part of #24407.
r? @Manishearth
2015-08-07 17:58:17 +00:00
Guillaume Gomez
c3d147eea6 Add a guard example for E0416 2015-08-07 15:23:00 +02:00
Victor Berger
5847ea7619 Customize error messages for self glob imports. 2015-08-07 14:18:20 +02:00
Guillaume Gomez
2a08cff97c Add another example for E0412 2015-08-06 20:57:36 +02:00
Guillaume Gomez
99796a6c9c Update E0423 example 2015-08-06 19:46:09 +02:00
Ariel Ben-Yehuda
34942331a3 remove ty::{VariantInfo, FieldTy} 2015-08-06 17:02:23 +03:00
Guillaume Gomez
378aba4743 Add E0416 error explanation 2015-08-06 15:30:33 +02:00
Guillaume Gomez
4840c13f1a Add E0415 error explanation 2015-08-06 15:21:25 +02:00
Victor Berger
8e24091f98 Factor inc/dec count methods. 2015-08-06 12:47:10 +02:00
Guillaume Gomez
59574759a8 Add E0419 error explanation 2015-08-06 12:07:55 +02:00
Guillaume Gomez
6ae31b6f89 Add examples in E0412 2015-08-06 11:57:53 +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
bors
6a3545ef05 Auto merge of #27439 - vberger:more_perseverant_resolve, r=nrc
(This is a second try at #26242. This time I think things should be ok.)

The current algorithm handling import resolutions works sequentially, handling imports in the order they appear in the source file, and blocking/bailing on the first one generating an error/being unresolved.

This can lead to situations where the order of the `use` statements can make the difference between "this code compiles" and "this code fails on an unresolved import" (see #18083 for example). This is especially true when considering glob imports.

This PR changes the behaviour of the algorithm to instead try to resolve all imports in a module. If one fails, it is recorded and the next one is tried (instead of directly giving up). Also, all errors generated are stored (and not reported directly).

The main loop of the algorithms guaranties that the algorithm will always finish: if a round of resolution does not resolve anything new, we are stuck and give up. At this point, the new version of the algorithm will display all errors generated by the last round of resolve. This way we are sure to not silence relevant errors or help messages, but also to not give up too early.

**As a consequence, the import resolution becomes independent of the order in which the `use` statements are written in the source files.** I personally don't see any situations where this could be a problem, but this might need some thought.

I passed `rpass` and `cfail` tests on my computer, and now am compiling a full stage2 compiler to ensure the crates reporting errors in my previous attempts still build correctly. I guess once I have checked it, this will need a crater run?

Fixes #18083.

r? @alexcrichton , cc @nrc @brson
2015-08-05 03:52:39 +00:00
Manish Goregaokar
6be272cff5 Rollup merge of #27491 - GuillaumeGomez:patch-4, r=Manishearth 2015-08-04 18:00:53 +05:30
Guillaume Gomez
050b8d370b Add E0412 error explanation 2015-08-04 12:02:30 +02:00
Victor Berger
58e35d7c2a Addressing nits & tests explanations. 2015-08-04 08:14:32 +02:00
Eduard Burtescu
a34b0a4691 rustc: replace def::MethodProvenance with ty::ImplOrTraitItemContainer. 2015-08-04 01:16:53 +03:00
Guillaume Gomez
d6f713be3f Improve E0423 error message 2015-08-03 10:43:13 +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
Guillaume Gomez
cd0af4515b Add E0435 error explanation 2015-07-31 14:40:27 +02:00
Guillaume Gomez
3254ae6a52 Replace "impls" by "implementations" 2015-07-31 12:55:53 +02:00
Manish Goregaokar
c9a34d2092 Rollup merge of #27352 - nagisa:illegal-to-invalid-docs, r=steveklabnik
r? @steveklabnik
2015-07-30 01:43:53 +05:30
Guillaume Gomez
086a5c74fe Add E0413 error explanation 2015-07-29 20:11:41 +02:00
Guillaume Gomez
5429c9be78 Add E0423 error explanation 2015-07-29 14:45:24 +02:00
bors
6fcf62831e Auto merge of #27349 - arielb1:constant-at, r=alexcrichton
Fixes #27033
Fixes #27077 

r? @alexcrichton
2015-07-29 08:23:04 +00:00
Ariel Ben-Yehuda
757b0c176f prohibit the lhs of an @-pattern being a constant
as this breaks code that worked under some conditions, this is a
[breaking-change]

Fixes #27033
Fixes #27077
2015-07-28 19:51:08 +03:00
Oliver Schneider
00a5e66f81 remove get_ident and get_name, make as_str sound 2015-07-28 18:07:20 +02:00
Simonas Kazlauskas
91397a6aa3 Replace occurences of illegal in user facing docs 2015-07-28 17:55:44 +03:00
bors
3e6b03c2d8 Auto merge of #27230 - GuillaumeGomez:patch-1, r=brson
Part of #24407.
cc @Manishearth
2015-07-27 19:44:22 +00:00
Guillaume Gomez
fc65f5551d Fix typo 2015-07-24 17:26:41 +02:00