summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2017-03-09Fix const expression macro invocations.Jeffrey Seyfried-10/+10
2017-01-25Auto merge of #38920 - petrochenkov:selfimpl, r=eddybbors-53/+61
Partially implement RFC 1647 (`Self` in impl headers) The name resolution part is easy, but the typeck part contains an unexpected problem. It turns out that `Self` type *depends* on bounds and `where` clauses, so we need to convert them first to determine what the `Self` type is! If bounds/`where` clauses can refer to `Self` then we have a cyclic dependency. This is required to support impls like this: ``` // Found in libcollections impl<I: IntoIterator> SpecExtend<I> for LinkedList<I::Item> { .... } ^^^^^ associated type `Item` is found using information from bounds ``` I'm not yet sure how to resolve this issue. One possible solution (that feels hacky) is to make two passes over generics - first collect predicates ignoring everything involving `Self`, then determine `Self`, then collect predicates again without ignoring anything. (Some kind of lazy on-demand checking or something looks like a proper solution.) This patch in its current state doesn't solve the problem with `Self` in bounds, so the only observable things it does is improving error messages and supporting `impl Trait<Self> for Type {}`. There's also a question about feature gating. It's non-trivial to *detect* "newly resolved" `Self`s to feature gate them, but it's simple to *enable* the new resolution behavior when the feature gate is already specified. Alternatively this can be considered a bug fix and merged without a feature gate. cc https://github.com/rust-lang/rust/issues/38864 r? @nikomatsakis cc @eddyb Whitespace ignoring diff https://github.com/rust-lang/rust/pull/38920/files?w=1
2017-01-22Warn on unused `#[macro_use]` imports.Jeffrey Seyfried-8/+38
2017-01-21Resolve `Self` in impl headersVadim Petrochenkov-53/+61
2017-01-21Improve `unused_extern_crate` warnings.Jeffrey Seyfried-31/+36
2017-01-20Rollup merge of #39168 - estebank:multiline-candidate, r=petrochenkovAlex Crichton-16/+17
Use multiline Diagnostic for candidate in other module ``` error[E0574]: expected struct, variant or union type, found enum `Result` --> $DIR/issue-16058.rs:19:9 | 19 | Result { | ^^^^^^ not a struct, variant or union type | = help: possible better candidates are found in other modules, you can import them into scope: `use std::fmt::Result;` `use std::io::Result;` `use std::thread::Result;` error: aborting due to previous error ```
2017-01-20Rollup merge of #39077 - jseyfried:crate_var_imports, r=nrcAlex Crichton-1/+4
Improve the warning cycle for `use $crate;` Fixes #39049. r? @nrc
2017-01-18Use multiline Diagnostic for candidate in other moduleEsteban Küber-16/+17
2017-01-16Implement `#[proc_macro_attribute]`Austin Bonander-3/+86
* Add support for `#[proc_macro]` * Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it * Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`, error on legacy import of proc macros via `#[macro_use]`
2017-01-15Improve the warning cycle for `use $crate;`.Jeffrey Seyfried-1/+4
2017-01-13resolve: Levenshtein-based suggestions for non-import pathsVadim Petrochenkov-16/+65
2017-01-13Auto merge of #38890 - petrochenkov:noresolve, r=nrcbors-13/+24
resolve: Do not use "resolve"/"resolution" in error messages Use less jargon-y wording instead. `cannot find <struct> <S> in <this scope>` and `cannot find <struct> <S> in <module a::b>` are used for base messages (this also harmonizes nicely with "you can import it into scope" suggestions) and `not found in <this scope>` and `not found in <a::b>` are used for short labels in fall-back case. I tweaked some other diagnostics to avoid using "resolve" (see, e.g., `librustc_resolve/macros.rs`), but haven't touched messages for imports. Closes https://github.com/rust-lang/rust/issues/38750 r? @nrc
2017-01-12resolve: Do not use "resolve"/"resolution" in error messagesVadim Petrochenkov-13/+24
2017-01-11Auto merge of #38313 - jseyfried:self_imports, r=nrcbors-11/+45
resolve: clean up the semantics of `self` in an import list Change `self` in an import list `use foo::bar::{self, ...};` to import `bar` only in the type namespace. Today, `bar` is imported in every namespace in which `foo::bar` is defined. This is a [breaking-change], see https://github.com/rust-lang/rust/issues/38293#issue-194817974 for examples of code that would break. Fixes #38293. r? @nrc
2017-01-10Start warning cycle.Jeffrey Seyfried-1/+31
2017-01-10Change `self` in an import list `use foo::{self, ...}` to only import a ↵Jeffrey Seyfried-10/+14
module or enum `foo`.
2017-01-08Fix ICE when variant is used as a part of associated typeVadim Petrochenkov-3/+5
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-06Auto merge of #38793 - jseyfried:fix_macro_export_duplicates, r=nrcbors-1/+7
Fix regression with duplicate `#[macro_export] macro_rules!` Fixes #38715. r? @nrc
2017-01-04Fix regression with duplicate `#[macro_export] macro_rules!`.Jeffrey Seyfried-1/+7
2017-01-04Don't `unused_qualifications`-check global paths.Jeffrey Seyfried-13/+12
2016-12-31Auto merge of #38482 - est31:i128, r=eddybbors-2/+16
i128 and u128 support Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs. Rebased version of #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue... [plugin-breaking-change] cc #35118 (tracking issue)
2016-12-31Style fixesJosh Driver-2/+1
2016-12-31Stop macro calls in structs for proc_macro_derive from panicingJosh Driver-0/+5
2016-12-30Fix rebase falloutSimonas Kazlauskas-2/+2
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30Feature gate the 128 bit typesSimonas Kazlauskas-1/+14
Dangling a carrot in front of a donkey. This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-1/+2
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-28rustc: separate bodies for static/(associated)const and embedded constants.Eduard-Mihai Burtescu-0/+13
2016-12-28hir: lower `ImplicitSelf` to resolved `Self` TyQPath's.Eduard-Mihai Burtescu-0/+12
2016-12-26More systematic error reporting in path resolutionVadim Petrochenkov-777/+663
2016-12-25Auto merge of #38490 - jseyfried:def_id_vis, r=nrcbors-76/+70
Use `DefId`s instead of `NodeId`s for `pub(restricted)` visibilities This is groundwork for hygiene 2.0, specifically privacy checking hygienic intercrate name resolutions. r? @nrc
2016-12-25Auto merge of #38539 - jseyfried:fix_resolve_hang, r=eddybbors-1/+2
resolve: fix non-termination Fixes #34324. r? @eddyb
2016-12-25Auto merge of #38566 - jseyfried:fix_import_resolution_bug, r=eddybbors-2/+1
Fix bug in import resolution Fixes #38535 and fixes #38556. r? @nrc
2016-12-24Use `DefId`s instead of `NodeId`s for `pub(restricted)` visibilities.Jeffrey Seyfried-76/+70
2016-12-23Auto merge of #38533 - jseyfried:legacy_custom_derive_deprecation, r=nrcbors-0/+6
Allow legacy custom derive authors to disable warnings in downstream crates This PR allows legacy custom derive authors to use a pre-deprecated method `registry.register_custom_derive()` instead of `registry.register_syntax_extension()` to avoid downstream deprecation warnings. r? @nrc
2016-12-23Allow legacy custom derive authors to disable warnings in downstream crates.Jeffrey Seyfried-0/+6
2016-12-23Fix import resolution bug and fold all idents in the AST.Jeffrey Seyfried-2/+1
2016-12-22Fix non-termination in `resolve`.Jeffrey Seyfried-1/+2
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-92/+84
2016-12-20Fix compile errors and suchAlex Crichton-1/+1
2016-12-20Merge branch 'rfc_1560_warning_cycle' of https://github.com/jseyfried/rust ↵Alex Crichton-28/+70
into rollup Conflicts: src/librustc_resolve/lib.rs src/librustc_resolve/resolve_imports.rs
2016-12-19Clean up `get_traits_containing_item`.Jeffrey Seyfried-50/+42
2016-12-19Minor bugfix for macro invocation path resolution.Jeffrey Seyfried-1/+4
2016-12-19resolve: clean up diagnostics for name conflicts.Jeffrey Seyfried-29/+8
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-13/+5
2016-12-18Give extern crates' root modules a better name.Jeffrey Seyfried-1/+2
2016-12-18Remove scope placeholders, remove method `add_macro` of `ext::base::Resolver`.Jeffrey Seyfried-33/+52
2016-12-18Remove `MacroDef`'s fields `imported_from` and `allow_internal_unstable`,Jeffrey Seyfried-2/+3
remove `export` argument of `resolver.add_macro()`.
2016-12-18Canonicalize lifetime names.Jeffrey Seyfried-9/+9