104 Commits

Author SHA1 Message Date
Esteban Küber
9a561872c4 Always emit unresolved import errors and hide unused import lint 2019-09-08 11:11:26 -07:00
Vadim Petrochenkov
7dc3839b50 resolve: Mark more erroneous imports as used 2019-09-07 21:30:42 +03:00
Matthew Jasper
6fcdb36ccb Make use of hygiene in AST passes 2019-09-05 15:07:16 +01:00
Vadim Petrochenkov
23b82c3229 resolve: Move macro resolution traces from Modules to Resolver
Traces already contain module info without that.
It's easy to forget to call `finalize_*` on a module.
In particular, macros enum and trait modules weren't finalized.
By happy accident macros weren't placed into those modules until now.
2019-08-15 20:39:27 +03:00
Vadim Petrochenkov
e18ad70d2b diagnostics: Describe crate root modules in DefKind::Mod as "crate" 2019-08-10 23:17:20 +03:00
Vadim Petrochenkov
cbcc7dd182 Give built-in macros stable addresses in the standard library 2019-08-10 00:05:37 +03:00
Kornel
3bfb4c3c25 Don't recommend extern crate syntax 2019-08-05 18:19:01 +01:00
Vadim Petrochenkov
5486cc69bd tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
Vadim Petrochenkov
9be35f82c1 tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
Vadim Petrochenkov
8eaf17bca2 Introduce built-in macros through libcore 2019-07-26 13:09:54 +03:00
Samy Kacimi
e5e1397adb
normalize use of backticks in compiler messages for librustc/lint
https://github.com/rust-lang/rust/issues/60532
2019-07-17 22:49:48 +02:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
Yuki Okushi
c004451a20 Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
Vadim Petrochenkov
932ea64175 compiletest: Remove skip-codegen 2019-06-16 12:23:22 +03:00
Vadim Petrochenkov
eb09daa762 Hygienize macros in the standard library 2019-06-12 20:27:29 +03:00
memoryruins
eb4580a570 Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
bors
9a9df55f07 Auto merge of #60252 - davidtwco:issue-57672, r=Mark-Simulacrum
Don't suggest changing extern crate w/ alias to use.

Fixes #57672.
2019-05-18 15:07:38 +00:00
Eduard-Mihai Burtescu
ff174fe09e rustc: rename hir::def::Def to Res (short for "resolution"). 2019-05-03 22:50:19 +03:00
Vadim Petrochenkov
fbbec76701 resolve: Consider erroneous imports used to avoid duplicate diagnostics 2019-04-28 22:36:57 +03:00
David Wood
8869bc5ada
Do not suggest use over extern crate w/ alias.
This commit stops `unused_extern_crates` lints from occuring on `extern
crate` statements that alias the crate as the suggestion to change to a
`use` statement would result in the aliased name no longer being added
to the prelude, thereby causing compilation errors if other imports
expected this to be the case.
2019-04-25 08:06:49 +01:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
Esteban Küber
146d040f0b Reword tracking issue note 2019-04-11 11:42:06 -07:00
Esteban Küber
3ab97062cf Tweak unstable diagnostic output 2019-04-10 18:10:30 -07:00
Yuki OKUSHI
45c82abf13 Distinguish depending on error level
Remove unnecessary comment
2019-03-31 07:51:31 +09:00
kennytm
1d286f7918
Rollup merge of #59296 - petrochenkov:stdup, r=estebank
Do not encode gensymed imports in metadata

(Unless they are underscore `_` imports which are re-gensymed on crate loading, see https://github.com/rust-lang/rust/pull/56392.)

We cannot encode gensymed imports properly in metadata and if we encode them improperly, we can get erroneous name conflicts downstream.
Gensymed imports are produced by the compiler, so we control their set, and can be sure that none of them needs being encoded for use from other crates.

A workaround that fixes https://github.com/rust-lang/rust/issues/59243.
2019-03-24 19:00:04 +08:00
Esteban Küber
0a4ecf3438 Mark duplicate import removal suggestion tool only 2019-03-23 13:05:30 -07:00
Esteban Küber
3211f38828 Tweak unnecessary import suggestion 2019-03-23 13:05:30 -07:00
Vadim Petrochenkov
30d5dc9a0a Do not encode gensymed imports in metadata 2019-03-19 22:50:46 +03:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Andy Russell
4bbe8839dd
use structured suggestions for E0432 2019-03-09 11:05:30 -05:00
Esteban Küber
87dd2e1df9 Use hidden suggestions for unused imports lint 2019-02-11 11:16:22 -08:00
Pietro Albini
5ef71508fe
unused_imports: update tests 2019-02-08 08:44:56 +01:00
David Wood
1595163356
Add suggestion for duplicated import.
This commit adds a suggestion when a import is duplicated (ie. the same name
is used twice trying to import the same thing) to remove the second
import.
2019-01-31 12:01:28 +01:00
Mazdak Farrokhzad
5e6c2f40d0
Rollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=Centril
Stabilize extern_crate_self

Fixes #56409
2019-01-26 18:21:41 +01:00
Mazdak Farrokhzad
4091ca0183
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
resolve: Add a test for issue #57539

Add a test for the bugfix regression reported in https://github.com/rust-lang/rust/issues/57539

Closes https://github.com/rust-lang/rust/issues/57539
2019-01-18 18:06:32 +01:00
Ryan Leckey
09d073a4c5 stabilize extern_crate_self 2019-01-14 23:42:46 -08:00
Mazdak Farrokhzad
c04d6fa084
Rollup merge of #57557 - petrochenkov:ecused, r=varkor
resolve: Mark extern crate items as used in more cases

Fixes https://github.com/rust-lang/rust/issues/57421
2019-01-13 05:26:59 +01:00
Vadim Petrochenkov
6aa7856369 resolve: Mark extern crate items as used in more cases 2019-01-13 01:50:53 +03:00
Vadim Petrochenkov
ebdd072e3b resolve: Add a test for issue #57539 2019-01-13 00:15:23 +03:00
Vadim Petrochenkov
250935d0c7 Fix a hole in generic parameter import future-proofing
Add some tests for buggy derive helpers
2019-01-12 16:18:55 +03:00
Vadim Petrochenkov
79134c0517 Stabilize uniform_paths 2019-01-12 16:18:55 +03:00
bors
d8371c61e6 Auto merge of #57199 - petrochenkov:ambig, r=estebank
resolve: Simplify treatment of ambiguity errors

If we have a glob conflict like this
```rust
mod m1 { struct S; }
mod m2 { struct S; }

use m1::*;
use m2::*;
```
we treat it as a special "ambiguity item" that's not an error by itself, but produces an error when actually used.
```rust
use m1::*; // primary
use m2::*; // secondary

=>

ambiguity S(m1::S, m2::S);
```

Ambiguity items were *sometimes* treated as their primary items for error recovery, but pretty irregularly.

After this PR they are always treated as their primary items, except that
- If an ambiguity item is marked as used, then it still produces an error.
- Ambiguity items are still filtered away when exported to other crates (which is also a use in some sense).
2019-01-01 02:08:39 +00:00
bors
171c1fc25e Auto merge of #57185 - petrochenkov:impice4, r=estebank
resolve: Fix one more ICE in import validation

So if you have an unresolved import
```rust
mod m {
    use foo::bar;
}
```
error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors.

The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g.
```rust
mod m {
    use baz::*; // imports real existing `bar`
    use foo::bar;
}
```
causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like https://github.com/rust-lang/rust/issues/57015.
This PR stops overwriting real successful resolutions with `Def::Err`s.

Fixes https://github.com/rust-lang/rust/issues/57015
2018-12-30 03:12:16 +00:00
Vadim Petrochenkov
06f22ba427 resolve: Simplify treatment of ambiguity errors 2018-12-29 19:26:29 +03:00
Vadim Petrochenkov
ddb550a0e3 resolve: Never override real bindings with Def::Errs from error recovery 2018-12-29 03:04:25 +03:00
Ian Douglas Scott
0c58eec86c
Update references to closed issue
Issue #28979 was closed with a link to #55467.
2018-12-27 16:49:12 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Mazdak Farrokhzad
9f7f949600
Rollup merge of #56620 - petrochenkov:noclutter, r=estebank
resolve: Reduce some clutter in import ambiguity errors

Noticed in https://www.reddit.com/r/rust/comments/a3pyrw/announcing_rust_131_and_rust_2018/eb8alhi/.
The first error is distracting, but unnecessary, it's a *consequence* of the ambiguity error and appears because one of the ambiguous `actix` modules (unsurprisingly) doesn't have the expected name in it.
2018-12-08 08:43:49 +01:00
Vadim Petrochenkov
2010b4f60b resolve: Reduce some clutter in import ambiguity errors 2018-12-08 04:19:29 +03:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00