about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2018-12-19Reintroduce special pretty-printing for `$crate` when it's necessary for ↵Vadim Petrochenkov-0/+11
proc macros
2018-12-19Remove `eliminate_crate_var` and special pretty-printing for `$crate`Vadim Petrochenkov-60/+1
2018-12-19Rollup merge of #56663 - Zoxc:resolver-lifetime, r=pnkfelixPietro Albini-40/+40
Remove lifetime from Resolver
2018-12-14Auto merge of #56572 - kevgrasso:let_self_err_dev, r=estebankbors-3/+16
Contexually dependent error message for E0424 when value is assigned to "self" This is an improvement for pull request #54495 referencing issue #54369. If the "self" keyword is assigned a value as though it were a valid identifier, it will now report: ``` let self = "self"; ^^^^ `self` value is a keyword and may not be bound to variables or shadowed ``` instead of ``` let self = "self"; ^^^^ `self` value is a keyword only available in methods with `self` parameter ``` If anyone has a better idea for what the error should be I'd be happy to modify it appropriately.
2018-12-13debug logging, added conditional error message, tests updatedKevyn Grasso-3/+16
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-4/+2
Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3
2018-12-10Remove lifetime from ResolverJohn Kåre Alsaker-40/+40
2018-12-08Rollup merge of #56620 - petrochenkov:noclutter, r=estebankMazdak Farrokhzad-19/+23
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-08resolve: Reduce some clutter in import ambiguity errorsVadim Petrochenkov-19/+23
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-16/+16
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-1/+1
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-07Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin ↵Vadim Petrochenkov-101/+3
attributes
2018-12-06Auto merge of #56392 - petrochenkov:regensym, r=oli-obkbors-27/+68
Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution So they cannot be cloned by macros. See https://github.com/rust-lang/rust/pull/56303 for the discussion. Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in https://github.com/rust-lang/rust/pull/56303#issuecomment-442464695. Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in https://github.com/rust-lang/rust/pull/56303#issuecomment-442274118). Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc https://github.com/rust-lang/rust/pull/55983). Add more tests for `use foo as _` imports.
2018-12-06Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakisPietro Albini-41/+41
libsyntax_pos: A few tweaks
2018-12-04Replace usages of `..i + 1` ranges with `..=i`.Corey Farwell-1/+1
2018-12-04Remove redundant cloneShotaro Yamada-1/+1
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-41/+41
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-12-03Rollup merge of #56366 - alexreg:stabilise-self_in_typedefs, r=Centrilkennytm-16/+4
Stabilize self_in_typedefs feature [**Tracking Issue**](https://github.com/rust-lang/rust/issues/49303) r? @centril
2018-12-02Address review commentsVadim Petrochenkov-4/+15
2018-12-02Delay gensym creation for "underscore items" until name resolutionVadim Petrochenkov-8/+16
Prohibit `static _` Fis unused import warnings for `use foo as _` Add more tests for `use foo as _`
2018-12-02resolve: Avoid "self-confirming" resolutions in import validationVadim Petrochenkov-21/+43
2018-12-01resolve: Support aliasing local crate root in extern preludeVadim Petrochenkov-4/+24
2018-11-30Removed feature gate.Alexander Regueiro-16/+4
2018-11-28resolve: Fix false-positives from lint `absolute_paths_not_starting_with_crate`Vadim Petrochenkov-1/+1
2018-11-27resolve: Extern prelude is for type namespace onlyVadim Petrochenkov-1/+3
2018-11-27resolve: Suggest `crate::` for resolving ambiguities when appropriateVadim Petrochenkov-16/+31
More precise spans for ambiguities from macros
2018-11-27resolve: Fallback to extern prelude in 2015 imports used from global 2018 ↵Vadim Petrochenkov-10/+47
edition
2018-11-27resolve: Generalize `early_resolve_ident_in_lexical_scope` slightlyVadim Petrochenkov-82/+78
Flatten `ModuleOrUniformRoot` variants
2018-11-27resolve: Fallback to uniform paths in 2015 imports used from global 2018 editionVadim Petrochenkov-35/+98
2018-11-27resolve: Implement edition hygiene for imports and absolute pathsVadim Petrochenkov-46/+50
Use per-span hygiene in a few other places in resolve Prefer `rust_2015`/`rust_2018` helpers to comparing editions
2018-11-25resolve: Fix some more asserts in import validationVadim Petrochenkov-1/+2
2018-11-25resolve: Fix bad span arithmetics in import conflict diagnosticsVadim Petrochenkov-5/+5
2018-11-25resolve: Prohibit relative paths in visibilities on 2018 editionVadim Petrochenkov-1/+12
2018-11-22resolve: Fix some asserts in import validationVadim Petrochenkov-2/+4
2018-11-21Auto merge of #56117 - petrochenkov:iempty, r=eddybbors-1/+4
resolve: Make "empty import canaries" invisible from other crates Empty imports `use prefix::{};` are desugared into `use prefix::{self as _};` to make sure the prefix is checked for privacy/stability/etc. This caused issues in cross-crate scenarios because gensyms are lost in crate metadata (the `_` is a gensym). Fixes https://github.com/rust-lang/rust/issues/55811
2018-11-21Auto merge of #52591 - eddyb:functional-snakes, r=oli-obkbors-10/+10
rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns. These are cruft left over from a time when `Foo::default()` didn't "just work".
2018-11-21rustc: remove {FxHash,Node,DefId,HirId,ItemLocal}{Map,Set} "constructor" fns.Eduard-Mihai Burtescu-10/+10
2018-11-21resolve: Make "empty import canaries" invisible from other cratesVadim Petrochenkov-1/+4
2018-11-21Stabilize `extern_crate_item_prelude`Vadim Petrochenkov-15/+5
2018-11-18Fix rebaseVadim Petrochenkov-15/+17
2018-11-18Add a couple more tests + address review commentsVadim Petrochenkov-1/+7
2018-11-18resolve: Refactor away `DeterminacyExt`Vadim Petrochenkov-40/+27
2018-11-18resolve: Future-proof against imports referring to local variables and ↵Vadim Petrochenkov-1/+35
generic parameters
2018-11-18resolve: Avoid sentence breaks in diagnosticsVadim Petrochenkov-13/+13
2018-11-18resolve: Support resolving macros without leaving tracesVadim Petrochenkov-8/+14
2018-11-18resolve: Avoid marking `extern crate` items as used in certain casesVadim Petrochenkov-7/+20
2018-11-18resolve: Reintroduce feature gate for uniform paths in importsVadim Petrochenkov-26/+56
2018-11-18Fix ICEs from imports of items not defined in modulesVadim Petrochenkov-5/+16
2018-11-18resolve: Tweak some articles in ambiguity diagnosticsVadim Petrochenkov-5/+5
2018-11-18resolve: Recover "did you mean" suggestions in importsVadim Petrochenkov-38/+30