about summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2018-01-22Make resolve_hir_path and resolve_str_path fallibleManish Goregaokar-10/+60
2018-01-21Rollup merge of #47512 - GuillaumeGomez:e0659, r=petrochenkovGuillaume Gomez-1/+1
Add E0659 for ambiguous names Still on the tracks of the "no error without error code" road.
2018-01-21Auto merge of #47116 - estebank:non-accessible-ctor, r=petrochenkovbors-18/+30
Tweaks to invalid ctor messages - Do not suggest using a constructor that isn't accessible - Suggest the appropriate syntax (`()`/`{}` as appropriate) - Add note when trying to use `Self` as a ctor CC #22488, fix #47085.
2018-01-20Fix tests by keepeing needed suggestionsEsteban Küber-1/+9
2018-01-18in which the unused-parens lint comes to cover function and method argsZack M. Davis-1/+1
Resolves #46137.
2018-01-18Add E0659 for ambiguous namesGuillaume Gomez-1/+1
2018-01-18Rollup merge of #47498 - dominikWin:missing-module-name, r=petrochenkovkennytm-4/+4
Make non-found module name optional No longer uses a magic string for missing or root module.
2018-01-16Make non-found module name optionalDominik Winecki-4/+4
No longer uses a magic string for missing or root module.
2018-01-15Review comments: remove enum suggestionEsteban Küber-25/+3
2018-01-15Further tweaks to the outputEsteban Küber-19/+16
- Properly address Variant Ctors - Show signature if span of trait method without `self` is not available
2018-01-15Reexport -> re-export in error messagesCarol (Nichols || Goulding)-1/+1
2018-01-15address review commentsEsteban Küber-13/+10
2018-01-15Add note when trying to use `Self` as a ctorEsteban Küber-1/+5
2018-01-15Readd suggestion in enum variants with incorrect argsEsteban Küber-0/+12
2018-01-15Suggest the correct syntax for different struct typesEsteban Küber-12/+22
2018-01-15Hide suggestion to use struct ctor when it is not visibleEsteban Küber-5/+11
2018-01-13Remove `impl Foo for ..` in favor of `auto trait Foo`leonardo.yvens-6/+0
No longer parse it. Remove AutoTrait variant from AST and HIR. Remove backwards compatibility lint. Remove coherence checks, they make no sense for the new syntax. Remove from rustdoc.
2018-01-12Auto merge of #46551 - jseyfried:improve_legacy_modern_macro_interaction, r=nrcbors-5/+14
macros: improve 1.0/2.0 interaction This PR supports using unhygienic macros from hygienic macros without breaking the latter's hygiene. ```rust // crate A: #[macro_export] macro_rules! m1 { () => { f(); // unhygienic: this macro needs `f` in its environment fn g() {} // (1) unhygienic: `g` is usable outside the macro definition } } // crate B: #![feature(decl_macro)] extern crate A; use A::m1; macro m2() { fn f() {} // (2) m1!(); // After this PR, `f()` in the expansion resolves to (2), not (3) g(); // After this PR, this resolves to `fn g() {}` from the above expansion. // Today, it is a resolution error. } fn test() { fn f() {} // (3) m2!(); // Today, `m2!()` can see (3) even though it should be hygienic. fn g() {} // Today, this conflicts with `fn g() {}` from the expansion, even though it should be hygienic. } ``` Once this PR lands, you can make an existing unhygienic macro hygienic by wrapping it in a hygienic macro. There is an [example](https://github.com/rust-lang/rust/pull/46551/commits/b766fa887dc0e4b923a38751fe4d570e35a75710) of this in the tests. r? @nrc
2018-01-07Auto merge of #47156 - petrochenkov:extpath, r=nikomatsakisbors-10/+16
Support `extern` in paths Implement the primary alternative to https://github.com/rust-lang/rust/pull/46613 + https://github.com/rust-lang/rust/pull/45771, achieving the same effect without requiring changes to other imports. Both need to be experimentally evaluated before making further progress. The PR also adds docs for all these related features into the unstable book. cc https://github.com/rust-lang/rust/issues/44660 r? @nikomatsakis
2018-01-07Rollup merge of #47170 - eddyb:us-vs-usize, r=nikomatsakiskennytm-2/+2
rustc: use {U,I}size instead of {U,I}s shorthands. `Us`/`Is` come from a time when `us` and `is` were the literal suffixes that are now `usize` / `isize`. r? @nikomatsakis
2018-01-04rustc: Don't use relative paths for extended errorsAlex Crichton-0/+1
These no longer work now that Cargo changes the cwd of rustc while it's running. Instead use an absolute path that's set by rustbuild.
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-2/+2
2018-01-03Support `extern` in pathsVadim Petrochenkov-10/+16
2017-12-23Auto merge of #46864 - estebank:closure-type-err-sp, r=nikomatsakisbors-22/+20
Closure type error ui tweak Do not point at the same span on all notes/help messages, and instead show them without a span.
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-30/+39
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-20Various tweaksEsteban Küber-22/+20
2017-12-17Point at def span on redefined name diagnosticEsteban Küber-3/+3
2017-12-14error for impl trait aliasAlex Burka-11/+21
2017-12-14stub out trait aliases in resolveAlex Burka-0/+12
2017-12-13Improve interaction between macros 2.0 and `macro_rules!`.Jeffrey Seyfried-5/+14
2017-12-13Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrcbors-0/+3
macros: hygienize use of `core`/`std` in builtin macros Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`). This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`. r? @nrc
2017-12-13Auto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrcbors-4/+8
Record all imports (`use`, `extern crate`) in the crate metadata This PR adds non-`pub` `use` and `extern crate` imports in the crate metadata since hygienic macros invoked in other crates may use them. We already include all other non-`pub` items in the crate metadata. This improves import suggestions in some cases. Fixes #42337. r? @nrc
2017-12-12Improve pretty printing `$crate::` paths.Jeffrey Seyfried-3/+0
2017-12-13Resolve absolute paths as extern under a feature flagVadim Petrochenkov-0/+11
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-0/+6
2017-12-05Include non-`pub` `use` and `extern crate` items in the crate metadata for ↵Jeffrey Seyfried-4/+8
macros 2.0.
2017-12-02Auto merge of #46343 - jseyfried:fix_hygiene_bug, r=nrcbors-2/+11
Fix hygiene bug. Fixes #42708. r? @nrc
2017-12-02Auto merge of #45904 - sunjay:gat-parser, r=nikomatsakisbors-73/+70
Generic Associated Types Parsing & Name Resolution Hi! This PR adds parsing for generic associated types! :tada: :tada: :tada: Tracking Issue: #44265 ## Notes For Reviewers * [x] I still need to add the stdout and stderr files to my ui tests. It takes me a *long* time to compile the compiler locally, so I'm going to add this as soon as possible in the next day or so. * [ ] My current ui tests aren't very good or very thorough. I'm reusing the `parse_generics` and `parse_where_clause` methods from elsewhere in the parser, so my changes work without being particularly complex. I'm not sure if I should duplicate all of the generics test cases for generic associated types. It might actually be appropriate to duplicate everything here, since we don't want to rely on an implementation detail in case it changes in the future. If you think so too, I'll adapt all of the generics test cases into the generic associated types test cases. * [ ] There is still more work required to make the run-pass tests pass here. In particular, we need to make the following errors disappear: ``` error[E0110]: lifetime parameters are not allowed on this type --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:23:41 | 23 | bar: <T as StreamingIterator>::Item<'static>, | ^^^^^^^ lifetime parameter not allowed on this type ``` ``` error[E0261]: use of undeclared lifetime name `'a` --> ./src/test/run-pass/rfc1598-generic-associated-types/iterable.rs:15:47 | 15 | type Iter<'a>: Iterator<Item = Self::Item<'a>>; | ^^ undeclared lifetime ``` There is a FIXME comment in streaming_iterator. If you uncomment that line, you get the following: ``` error: expected one of `!`, `+`, `,`, `::`, or `>`, found `=` --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:29:45 | 29 | fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ } | ^ expected one of `!`, `+`, `,`, `::`, or `>` here ``` r? @nikomatsakis
2017-12-01Renaming MethodRibKind to TraitOrImplItemRibKind and removing its field ↵Sunjay Varma-80/+69
which was never used. Lifting the HasTypeParameters rib to all trait item kinds and all impl item kinds
2017-12-01Adding type paramter ribs for generic associated typesSunjay Varma-2/+10
2017-12-01Auto merge of #45997 - estebank:pub-ident, r=nikomatsakisbors-1/+1
Account for missing keyword in fn/struct definition Fix #38911.
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-8/+32
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-28Fix hygiene bug.Jeffrey Seyfried-2/+11
2017-11-24Do not attemt to continue parsing after `pub ident`Esteban Küber-2/+1
Try to identify the following code in order to provide better diagnostics, but return the error to bail out early during the parse.
2017-11-24Do not rewind parser and ignore following blocksEsteban Küber-1/+2
When encountering `pub ident`, attempt to identify the code that comes afterwards, wether it is a brace block (assume it is a struct), a paren list followed by a colon (assume struct) or a paren list followed by a block (assume a fn). Consume those blocks to avoid any further parser errors and return a `Placeholder` item in order to allow the parser to continue. In the case of unenclosed blocks, the behavior is the same as it is currently: no further errors are processed.
2017-11-24Auto merge of #45942 - Menschenkindlein:master, r=estebankbors-0/+82
Add hints for the case of confusing enum with its variants A solution for https://github.com/rust-lang/rust/issues/43871. When one uses an enum in a place that accepts variants (e.g., `Option(result)` instead of `Some(result)`), suggest one of this enum's variants. cc @estebank
2017-11-23Use for_each_child_stable in find_moduleMaxim Zholobak-1/+1
2017-11-23Add module population and case of enum in place of expressionMaxim Zholobak-3/+6
2017-11-22Auto merge of #46035 - oli-obk:use_suggestions, r=petrochenkovbors-7/+18
Add structured suggestions for various "use" suggestions r? @petrochenkov
2017-11-21Report special messages for path segment keywords in wrong positionsVadim Petrochenkov-6/+30