about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2019-11-24Auto merge of #66647 - petrochenkov:nosynt, r=Centrilbors-10/+5
rustc_plugin: Remove support for syntactic plugins This part of the plugin interface was successfully replaced by token-based procedural macros in theory and in practice. cc https://github.com/rust-lang/rust/issues/29597 cc https://github.com/rust-lang/rust/pull/64675 r? @Centril
2019-11-24Auto merge of #66592 - estebank:raw-raw-ah-ah-ah, r=cramertjbors-3/+4
Rework raw ident suggestions Use heuristics to determine whethersuggesting raw identifiers is appropriate. Account for raw identifiers when printing a path in a `use` suggestion. Fix #66126.
2019-11-24rustc_plugin: Remove support for syntactic pluginsVadim Petrochenkov-10/+5
2019-11-24expand: Fully preserve visibilities on unnamed fields with attributesVadim Petrochenkov-0/+3
2019-11-24def_collector: Do not forget to save indices of fields with multiple attributesVadim Petrochenkov-9/+7
2019-11-23review commentsEsteban Küber-1/+1
2019-11-23Rework raw ident suggestionsEsteban Küber-3/+4
Use heuristics to determine whethersuggesting raw identifiers is appropriate. Account for raw identifiers when printing a path in a `use` suggestion.
2019-11-23Move def collector from `rustc` to `rustc_resolve`Vadim Petrochenkov-3/+358
2019-11-22resolve: more declarative fresh_bindingMazdak Farrokhzad-15/+7
2019-11-20Auto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkovbors-0/+54
Generic arg disambiguation Using the tactic suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/60804#issuecomment-516769465 and on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation), this change checks type arguments to see if they are really incorrectly-parsed const arguments. it should be noted that `segments.len() == 1 && segments[0].arg.is_none()` was reduced to `segments.len() == 1` as suggested by @petrochenkov in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation/near/177848002). This change allowed a few more existing tests to have their braces removed. There are a couple of "problems" with these changes that I should note. First, there was a regression in the error messages found in "src/test/ui/privacy-ns1.rs" and "src/test/ui/privacy-ns1.rs". Second, some braces were unable to be removed from "src/test/ui/const-generics/fn-const-param-infer.rs". Those on line 24 caused the statement to stop equating when removed, and those on line 20 cause a statement that should not equate to produce no error when removed. I have not looked further into any of these issues yet, though I would be willing to look into them before landing this. I simply wanted to get some other eyes on this before going further. Fixes #60804 cc @varkor @jplatte
2019-11-18resolve: late: Check if type arg is really a const argGabriel Smith-0/+46
A path type argument could be a generic const argument due to limitations as to what we can determine at parsing. We double check just to be sure by trying to resolve in the type namespace first, and if that fails we try again in the value namespace. If resolution in the value namespace succeeds, we have a generic const argument on our hands.
2019-11-18resolve: Allow idents to resolve to primitives in the type namespaceGabriel Smith-0/+8
2019-11-19resolve: Give derive helpers highest priority during resolutionVadim Petrochenkov-9/+16
2019-11-17Rollup merge of #66344 - petrochenkov:noregattr, r=matthewjasperYuki Okushi-23/+1
rustc_plugin: Remove `Registry::register_attribute` Legacy plugins cannot register inert attributes anymore. The preferred replacement is to use `register_tool` ([tracking issue](https://github.com/rust-lang/rust/issues/66079)). ```rust #![register_tool(servo)] #[servo::must_root] struct S; ``` The more direct replacement is `register_attribute` ([tracking issue](https://github.com/rust-lang/rust/issues/66080)) ```rust #![register_attr(must_root)] #[must_root] struct S; ``` , but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.
2019-11-16rustc_plugin: Remove `Registry::register_attribute`Vadim Petrochenkov-23/+1
2019-11-16expand: Stop marking derive helper attributes as knownVadim Petrochenkov-0/+3
Pass them through name resolution instead
2019-11-16resolve: Introduce a new scope for derive helpersVadim Petrochenkov-7/+54
2019-11-16resolve: `Scope::DeriveHelpers` -> `Scope::DeriveHelpersCompat`Vadim Petrochenkov-6/+6
These helpers are resolved before their respective derives through a kind of look ahead into future expansions. Some of these will migrate to proper resolution, others will be deprecated. ``` #[trait_helper] // Deprecate #[derive(Trait)] #[trait_helper] // Migrate to proper resolution ```
2019-11-15Rollup merge of #66197 - Centril:transparent-ast, r=varkorTyler Mandry-20/+6
Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per https://github.com/rust-lang/rfcs/pull/2515, this needs to change to allow `impl Trait` in nested positions. This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported. r? @varkor
2019-11-15Don't warn labels beginning with `_`Yuki Okushi-1/+3
2019-11-14TAIT: adjust resolveMazdak Farrokhzad-20/+6
2019-11-14Clean some error codes diagnosticsGuillaume Gomez-5/+5
2019-11-14Remove unused error_codes.rs filesGuillaume Gomez-2048/+0
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-1/+13
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-81/+101
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: https://github.com/rust-lang/rust/pull/57921 cc https://github.com/rust-lang/rust/issues/44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes https://github.com/rust-lang/rust/issues/29642
2019-11-09Inline reserve_node_idsMark Rousskov-13/+5
This function was only ever called with 1 so there's little point in it; this isn't an expensive operation (essentially a checked add) so we're not really "reserving" anything either.
2019-11-09Move next_node_id to ResolverMark Rousskov-4/+27
This doesn't migrate the pretty-printing everybody loops, which will be done in the next few commits.
2019-11-09Address review commentsVadim Petrochenkov-4/+5
2019-11-09resolve: Factor out some common binding creation functionalityVadim Petrochenkov-29/+14
2019-11-09resolve: Remove some bits relevant only to legacy pluginsVadim Petrochenkov-22/+11
They are unstable and going to be removed anyway and the removed code would complicate the next commit
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-24/+2
2019-11-09Support registering attributes and attribute tools using crate-level attributesVadim Petrochenkov-20/+87
2019-11-08Rollup merge of #66188 - Centril:fnsig, r=davidtwcoMazdak Farrokhzad-1/+1
`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn` In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular. r? @davidtwco
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-30/+8
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-08ast::ItemKind::Fn: use ast::FnSigMazdak Farrokhzad-1/+1
2019-11-07syntax::parser::token -> syntax::tokenMazdak Farrokhzad-1/+1
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-3/+5
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06Remove unnecessary `Deref` impl for `Attribute`.Nicholas Nethercote-2/+5
This kind of thing just makes the code harder to read.
2019-11-06duplicate_macro_exports -> errorMazdak Farrokhzad-11/+7
2019-11-06legacy_ctor_visibility -> errorMazdak Farrokhzad-19/+1
2019-11-06Rollup merge of #66139 - euclio:pluralize, r=nagisaMazdak Farrokhzad-4/+4
use American spelling for `pluralize!`
2019-11-06Rollup merge of #66086 - RalfJung:smallvec, r=nagisaMazdak Farrokhzad-1/+1
bump smallvec to 1.0 This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec. See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement. Cc @mbrubeck @emilio
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-1/+1
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-05use American spelling for `pluralize!`Andy Russell-4/+4
2019-11-05Review feedback: alpha-rename field from `copy_derives` to ↵Felix S. Klock II-4/+4
`containers_derving_copy`.
2019-11-05Review feedback: Remove more stuff! Simplify simplify simplify!Felix S. Klock II-19/+7
2019-11-05Remove `PartialEq` and `Eq` from the `SpecialDerives`.Felix S. Klock II-2/+0
2019-11-04bump smallvec to 1.0Ralf Jung-1/+1
2019-11-03Delete lint buffer from SessionMark Rousskov-4/+7
2019-11-03Utilize Resolver lint buffer during HIR loweringMark Rousskov-0/+4