about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2019-03-16syntax: Do not accidentally treat multi-segment meta-items as single-segmentVadim Petrochenkov-12/+11
2019-03-16resolve: Account for new importable entitiesVadim Petrochenkov-11/+7
2019-03-12resolve: Simplify import resolution for mixed 2015/2018 edition modeVadim Petrochenkov-54/+4
2019-03-09use structured suggestions for E0432Andy Russell-104/+214
2019-02-27Rollup merge of #58678 - doctorn:refuse-async-fn-2015-edition, r=varkorMazdak Farrokhzad-2/+2
Deny `async fn` in 2015 edition This commit prevents code using `async fn` from being compiled in Rust 2015 edition. Compiling code of the form: ```rust async fn foo() {} ``` Will now result in the error: ``` error[E0670]: `async fn` is not permitted in the 2015 edition --> async.rs:1:1 | 1 | async fn foo() {} | ^^^^^ error: aborting due to error For more information about an error, try `rustc --explain E0670`. ``` This resolves #58652 and also resolves #53714. r? @varkor
2019-02-27rename Substs to InternalSubstscsmoe-1/+1
Change-Id: I3fa00e999a2ee4eb72db1fdf53a8633b49176a18
2019-02-24Deny `async fn` in 2015 editionNathan Corbyn-2/+2
Fix style issues and update diagnostic messages Update src/librustc_passes/diagnostics.rs Co-Authored-By: doctorn <me@nathancorbyn.com> Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition
2019-02-23Rollup merge of #58476 - nnethercote:rm-LazyTokenStream, r=petrochenkovMazdak Farrokhzad-1/+1
Remove `LazyTokenStream`. `LazyTokenStream` was added in #40939. Perhaps it was an effective optimization then, but no longer. This PR removes it, making the code both simpler and faster. r? @alexcrichton
2019-02-22Rollup merge of #58555 - scottmcm:try-2015, r=CentrilMazdak Farrokhzad-0/+4
Add a note about 2018e if someone uses `try {` in 2015e Inspired by https://github.com/rust-lang/rust/issues/58491, where a `try_blocks` example was accidentally run in 2015, which of course produces a bunch of errors. What's the philosophy about gating for this? The keyword is stably a keyword in 2018, so I haven't gated it for now but am not mentioning what the keyword _does_. Let me know if I should do differently. Resolves #53672
2019-02-17Add a note about 2018e if someone uses `try {` in 2015eScott McMurray-0/+4
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-1/+1
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-16Rollup merge of #58074 - scottmcm:stabilize-sort_by_cached_key, r=SimonSapinkennytm-1/+0
Stabilize slice_sort_by_cached_key I was going to ask on the tracking issue (https://github.com/rust-lang/rust/issues/34447), but decided to just send this and hope for an FCP here. The method was added last March by https://github.com/rust-lang/rust/pull/48639. Signature: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key ```rust impl [T] { pub fn sort_by_cached_key<K, F>(&mut self, f: F) where F: FnMut(&T) -> K, K: Ord; } ``` That's an identical signature to the existing `sort_by_key`, so I think the questions are just naming, implementation, and the usual "do we want this?". The implementation seems to have proven its use in rustc at least, which many uses: https://github.com/rust-lang/rust/search?l=Rust&q=sort_by_cached_key (I'm asking because it's exactly what I just needed the other day: ```rust all_positions.sort_by_cached_key(|&n| data::CITIES.iter() .map(|x| *metric_closure.get_edge(n, x.pos).unwrap()) .sum::<usize>() ); ``` since caching that key is a pretty obviously good idea.) Closes #34447
2019-02-13Rollup merge of #58381 - davidtwco:issue-42944, r=estebankMazdak Farrokhzad-5/+21
Only suggest imports if not imported. Fixes #42944 and fixes #53430. This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant. r? @estebank
2019-02-12Stabilize slice_sort_by_cached_keyScott McMurray-1/+0
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-6/+4
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-65/+65
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-13Fix rebase failTaiki Endo-1/+1
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-5/+3
2019-02-12Rollup merge of #58342 - taiki-e:nll, r=matthewjasperMazdak Farrokhzad-0/+1
Revert removed #![feature(nll)] In PRs related to #58099, `#![feature(nll)]` was removed from several crates. This PR reverts it. Related: https://github.com/rust-lang/rust/pull/58265#discussion_r255021244 cc @Centril r? @matthewjasper
2019-02-11Only suggest imports if not imported.David Wood-5/+21
This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant.
2019-02-11Auto merge of #56645 - pietroalbini:fix-unused-imports, r=estebankbors-22/+181
Initial implementation of rustfixable unused_imports lint This PR adds the initial implementation of rustfixable `unused_imports` lint. The implementation works, but rustfix is not able to apply all the suggestions until https://github.com/rust-lang/rust/issues/53934 is fixed. It also needs https://github.com/rust-lang/rust/pull/58296 to hide the suggested note since it's really useless. cc https://github.com/rust-lang/rust/issues/47888 <details><summary><code>cargo fix</code> in action on the <code>unused_imports</code> lint</summary> ![screenshot from 2018-12-09 15-49-01](https://user-images.githubusercontent.com/2299951/49698874-3a026080-fbca-11e8-9bf1-24060b6c59c8.png) </details>
2019-02-10rustc: doc commentsAlexander Regueiro-65/+65
2019-02-10Revert removed #![feature(nll)]Taiki Endo-0/+1
2019-02-09Auto merge of #58065 - alexreg:refactor-smart_resolve_path_fragment, ↵bors-389/+423
r=petrochenkov Factor out error reporting from `smart_resolve_path_fragment` fn This function was ridiculously monolithic before. We now have three rather-less-monolithic-and-horrifying functions. r? @centril
2019-02-08Auto merge of #58191 - varkor:const-generics-ast, r=petrochenkovbors-72/+154
Add const generics to the AST This is mostly split out from https://github.com/rust-lang/rust/pull/53645 in an effort to make progress merging const generics piecewise instead of in one go. cc @yodaldevoid, @petrochenkov r? @eddyb
2019-02-07WIPAlexander Regueiro-3/+3
2019-02-07Minor cosmetic changes.Alexander Regueiro-9/+8
2019-02-07Addressed review points.Alexander Regueiro-404/+412
2019-02-07Factored out context-dependent help for error reporting.Alexander Regueiro-183/+195
2019-02-07Factored out error reporting from `smart_resolve_path_fragment` fn.Alexander Regueiro-332/+347
2019-02-07unused_imports: make the lint machine-applicablePietro Albini-22/+181
2019-02-07Resolve incorrect diagnostic for using a non-const value in a constantvarkor-5/+13
2019-02-07Make name resolution handle consts in GenericParamsFromOuterFunction properlyvarkor-12/+37
2019-02-07Adjust generic const param resolutionvarkor-124/+65
2019-02-07Fix E0670 doc errorvarkor-1/+4
2019-02-07Add error for const parameters depending on type parametersvarkor-2/+13
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add resolution errors for const genericsvarkor-32/+126
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Remove images' url to make it work even without internet connectionGuillaume Gomez-3/+1
2019-02-07librustc_resolve => 2018Taiki Endo-89/+96
2019-02-05Auto merge of #57973 - davidtwco:issue-52891, r=estebankbors-50/+262
Add suggestion for duplicated import. Fixes #52891. This PR 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-31Add suggestion for duplicated import.David Wood-50/+262
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-28Rollup merge of #57915 - petrochenkov:notto-disu, r=zackmdavisMazdak Farrokhzad-9/+6
Pretty print `$crate` as `crate` or `crate_name` in more cases So, people do parse output of `--pretty=expanded` (sigh), so covering only the legacy proc-macro case (like it was done in https://github.com/rust-lang/rust/pull/57155) is not enough. This PRs resolves all `$crate`s produced by macros, so they are all printed in the parseable form `$crate::foo` -> `crate::foo` or `crate_name::foo`. Fixes https://github.com/rust-lang/rust/issues/38016#issuecomment-455851334 Fixes https://github.com/rust-lang/rust/pull/57155#issuecomment-455807195
2019-01-27add typo suggestion to unknown attribute errorAndy Russell-5/+65
2019-01-26remove `_with_applicability` from suggestion fnsAndy Russell-19/+19
2019-01-26Rollup merge of #57908 - petrochenkov:errepice, r=estebankMazdak Farrokhzad-46/+45
resolve: Fix span arithmetics in the import conflict error https://github.com/rust-lang/rust/pull/56937 rebased and fixed Fixes https://github.com/rust-lang/rust/issues/56411 Fixes https://github.com/rust-lang/rust/issues/57071 Fixes https://github.com/rust-lang/rust/issues/57787 r? @estebank
2019-01-26Rollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=CentrilMazdak Farrokhzad-5/+1
Stabilize extern_crate_self Fixes #56409
2019-01-26Pretty print `$crate` as `crate` or `crate_name` in more casesVadim Petrochenkov-9/+6
2019-01-26Address review comments and cleanup codeVadim Petrochenkov-48/+45
2019-01-25#56411 do not suggest a fix for a import conflict in a macroFrançois Mockers-1/+3
2019-01-24Rollup merge of #57836 - oli-obk:existential_crisis, r=estebankMazdak Farrokhzad-0/+1
Fix some cross crate existential type ICEs fixes #53443