about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-37/+37
Like #43008 (f668999), but _much more aggressive_.
2017-08-13Rollup merge of #43814 - Eijebong:fix_typos2, r=petrochenkovGuillaume Gomez-1/+1
Fix some typos Follow up of #43794 If refined my script a little bit and found some more.
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-1/+1
2017-08-10Auto merge of #43522 - alexcrichton:rewrite-lints, r=michaelwoeristerbors-18/+18
rustc: Rearchitect lints to be emitted more eagerly In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite. Closes https://github.com/rust-lang/rust/issues/42511
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-18/+18
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-08-01Auto merge of #43552 - petrochenkov:instab, r=jseyfriedbors-3/+17
resolve: Try to fix instability in import suggestions cc https://github.com/rust-lang/rust/pull/42033 `lookup_import_candidates` walks module graph in DFS order and skips modules that were already visited (which is correct because there can be cycles). However it means that if we visited `std::prelude::v1::Result::Ok` first, we will never visit `std::result::Result::Ok` because `Result` will be skipped as already visited (note: enums are also modules here), and otherwise, if we visited `std::result::Result::Ok` first, we will never get to `std::prelude::v1::Result::Ok`. What child module of `std` (`prelude` or `result`) we will visit first, depends on randomized hashing, so we have instability in diagnostics. With this patch modules' children are visited in stable order in `lookup_import_candidates`, this should fix the issue, but let's see what Travis will say. r? @oli-obk
2017-07-30default binding modes: add pat_binding_modesTobias Schottdorf-1/+2
This PR kicks off the implementation of the [default binding modes RFC][1] by introducing the `pat_binding_modes` typeck table mentioned in the [mentoring instructions][2]. `pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and used wherever the HIR would be scraped prior to this PR. Unfortunately, one blemish, namely a two callers to `contains_explicit_ref_binding`, remains. This will likely have to be removed when the second part of [1], the `pat_adjustments` table, is tackled. Appropriate comments have been added. See #42640. [1]: https://github.com/rust-lang/rfcs/pull/2005 [2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-30resolve: Fix instability in import suggestionsVadim Petrochenkov-3/+17
2017-07-27Avoid duplicated errors for generic arguments in macro pathsVadim Petrochenkov-5/+14
2017-07-27Give span to angle bracketed generic argumentsVadim Petrochenkov-3/+4
2017-07-27Discern between `Path` and `Path<>` in ASTVadim Petrochenkov-5/+1
2017-07-26Rollup merge of #43447 - estebank:import-span, r=nikomatsakisMark Simulacrum-103/+150
Point at path segment on module not found Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ``` Fix #43040.
2017-07-25Point at path segment on module not foundEsteban Küber-103/+150
Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ```
2017-07-25Bump master to 1.21.0Alex Crichton-2/+0
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-14/+63
Point at `:` when using it instead of `;` When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription. Fix #42057, #41928.
2017-07-18Handle type ascription cases with a method call instead of a typeEsteban Küber-14/+63
2017-07-17Change some helps to suggestionsOliver Schneider-10/+15
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-8/+6
2017-07-08Move public reexports of private extern crates into a separate lintVadim Petrochenkov-3/+5
This is going to be a hard error while all private-in-public errors from rustc_privacy will be reclassified into lints.
2017-07-08Remove more anonymous trait method parametersVadim Petrochenkov-1/+1
2017-07-06remove associated_consts feature gateSean McArthur-3/+2
2017-06-29Make `$crate` a keywordVadim Petrochenkov-5/+7
2017-06-23Rollup merge of #42833 - durka:non-constant-used-with-constant, ↵Mark Simulacrum-1/+1
r=Mark-Simulacrum change span label for E0435 r? @Mark-Simulacrum
2017-06-23Removed as many "```ignore" as possible.kennytm-41/+57
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-22change span label for E0435 (fix #41871)Alex Burka-1/+1
2017-06-21Auto merge of #42076 - alex-ozdemir:master, r=nrcbors-23/+39
Clearer Error Message for Duplicate Definition Clearer use of the error message and span labels to communicate duplication definitions/imports. fixes #42061
2017-06-20Rollup merge of #42728 - jseyfried:fix_resolve_perf, r=nrcCorey Farwell-1/+4
resolve: fix perf bug Fixes #42544. r? @nrc
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-19resolve: fix perf bug.Jeffrey Seyfried-1/+4
2017-06-15Clearer Error Message for Duplicate DefinitionAlex Ozdemir-23/+39
Clearer use of the error message and span labels to communicate duplicaiton defitions/imports. New error format: ``` error[E0428]: the name `Foo` is defined twice --> example.rs:2:1 | 1 | trait Foo { } | ------------- previous definition of the trait `Foo` here 2 | struct Foo { } | ^^^^^^^^^^^^^^ `Foo` redefined here = note: `Foo` must be defined only once in the type namespace of this module error: aborting due to previous error ```
2017-06-13Merge crate `collections` into `alloc`Murarth-9/+9
2017-06-10Only emit one error for `use foo::self;`Tommy Ip-0/+10
Currently `use foo::self;` would emit both E0429 and E0432. This commit silence the latter one (assuming `foo` is a valid module). Fixes #42559
2017-06-09Auto merge of #42507 - ibabushkin:external-span-trans, r=eddybbors-2/+2
Fix translation of external spans Previously, I noticed that spans from external crates don't generate any output. This limitation is problematic if analysis is performed on one or more external crates, as is the case with [rust-semverver](https://github.com/ibabushkin/rust-semverver). This change should address this behaviour, with the potential drawback that a minor performance hit is to be expected, as spans from potentially large crates have to be translated now.
2017-06-07Fix translation of external spans.Inokentiy Babushkin-2/+2
2017-06-07Replace some matches with try.Masaki Hara-4/+1
2017-06-03Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrusbors-1/+30
Add E0603 error code Part of #42229. cc @Susurrus
2017-06-03Auto merge of #42334 - est31:master, r=jseyfriedbors-1/+5
Extend the unused macro lint to macros 2.0 Extends the unused macro lint (added in PR #41907) to macros 2.0 (added in PR #40847). r? @jseyfried
2017-06-02Add E0603 error codeGuillaume Gomez-1/+30
2017-05-31Fix a test and address review commentest31-1/+1
2017-05-31Extend the unused macro lint to macros 2.0est31-1/+5
2017-05-30Turn public reexporting of private extern crates into a lint againVadim Petrochenkov-2/+10
2017-05-30Turn sufficiently old compatibility lints into hard errorsVadim Petrochenkov-29/+13
2017-05-28Add note regarding parent module containing use statement.Mark Simulacrum-0/+26
2017-05-25Improve `Self`.Jeffrey Seyfried-1/+5
2017-05-25Improve intercrate hygiene.Jeffrey Seyfried-9/+9
2017-05-25Hygienize `librustc_typeck`.Jeffrey Seyfried-4/+12
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-139/+265
2017-05-25Remove `trait_item_map`, clean up `resolver.with_type_parameter_rib()`.Jeffrey Seyfried-57/+73