Commit Graph

296 Commits

Author SHA1 Message Date
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
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
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
Guillaume Gomez
40617b60cb Add E0425 error explanation 2015-07-24 14:58:00 +02:00
Guillaume Gomez
c8b9e8363a Add E0426 error explanation 2015-07-24 14:44:44 +02:00
Guillaume Gomez
9e1ea5e5ee Add E0432 error explanation 2015-07-24 12:30:14 +02:00
Guillaume Gomez
2537abf503 Add E0431 error explanation 2015-07-24 12:24:12 +02:00
Guillaume Gomez
18f4e8ce5e Add E0430 error explanation 2015-07-24 12:19:36 +02:00
Guillaume Gomez
1f81002757 Improve error explanation 2015-07-24 11:02:26 +02:00
Guillaume Gomez
0efc7f143f Fix typo and improve explanation 2015-07-23 16:19:37 +02:00
Guillaume Gomez
8a75dcdadf Add E0424 error explanation 2015-07-23 12:44:59 +02:00
Guillaume Gomez
d6b9e0bed9 Add E0417 error explanation 2015-07-23 12:28:01 +02:00
Andrew Paseltiner
cf8a1636ef add diagnostics for E0437 and E0438 2015-07-22 16:53:50 -04:00
Steve Klabnik
b73c6fe8f2 Rollup merge of #27156 - AlisdairO:diagnostics253, r=Manishearth
This is a resubmission of my previous git failure - apologies.  Just fixing up a wording error that was discovered in E0253 after the r.

r? @Manishearth
2015-07-22 12:56:49 -04:00
Guillaume Gomez
2e919b4c51 Add E0433 error explanation 2015-07-21 19:50:28 +02:00
Guillaume Gomez
c13295bbc3 Add E0428 error explanation 2015-07-21 19:28:58 +02:00
Guillaume Gomez
95811546e6 Add E0407 error explanation 2015-07-21 19:28:58 +02:00
Guillaume Gomez
bc79f20cca Add E0404 error explanation 2015-07-21 19:28:58 +02:00