summary refs log tree commit diff
path: root/src/librustc_resolve/lib.rs
AgeCommit message (Collapse)AuthorLines
2019-12-11Rollup merge of #67074 - ehuss:extern-options, r=petrochenkovMazdak Farrokhzad-2/+4
Add options to --extern flag. This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude. ```text --extern priv:mylib=/path/to/libmylib.rlib --extern noprelude:alloc=/path/to/liballoc.rlib ``` `noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates. This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
2019-12-09resolve: Make visibility resolution more speculativeVadim Petrochenkov-0/+9
To avoid potential duplicate diagnostics and separate the error reporting logic
2019-12-09Add options to --extern flag.Eric Huss-2/+4
2019-12-06Use `to_option` in various placesvarkor-0/+1
2019-11-28rustc_metadata: Merge `cstore.rs` into `creader.rs`Vadim Petrochenkov-2/+1
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-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-0/+1
2019-11-18resolve: Allow idents to resolve to primitives in the type namespaceGabriel Smith-0/+8
2019-11-17Rollup merge of #66344 - petrochenkov:noregattr, r=matthewjasperYuki Okushi-7/+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-7/+1
2019-11-16resolve: Introduce a new scope for derive helpersVadim Petrochenkov-6/+24
2019-11-16resolve: `Scope::DeriveHelpers` -> `Scope::DeriveHelpersCompat`Vadim Petrochenkov-4/+4
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-14Update to use new librustc_error_codes libraryGuillaume Gomez-1/+2
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-11/+16
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-2/+25
This doesn't migrate the pretty-printing everybody loops, which will be done in the next few commits.
2019-11-09Address review commentsVadim Petrochenkov-1/+1
2019-11-09resolve: Remove some bits relevant only to legacy pluginsVadim Petrochenkov-3/+0
They are unstable and going to be removed anyway and the removed code would complicate the next commit
2019-11-09Support registering attributes and attribute tools using crate-level attributesVadim Petrochenkov-8/+16
2019-11-05Review feedback: alpha-rename field from `copy_derives` to ↵Felix S. Klock II-2/+2
`containers_derving_copy`.
2019-11-05Review feedback: Remove more stuff! Simplify simplify simplify!Felix S. Klock II-14/+3
2019-11-05Remove `PartialEq` and `Eq` from the `SpecialDerives`.Felix S. Klock II-2/+0
2019-11-03Delete lint buffer from SessionMark Rousskov-4/+7
2019-11-03Utilize Resolver lint buffer during HIR loweringMark Rousskov-0/+4
2019-11-03Migrate resolver over to internal lint bufferMark Rousskov-6/+10
2019-10-27rustc, rustc_passes: don't depend on syntax_expand.Mazdak Farrokhzad-5/+6
This is done by moving some data definitions to syntax::expand.
2019-10-24Rollup merge of #65627 - varkor:const-generics-forbid-non-structural_match, ↵Mazdak Farrokhzad-13/+2
r=petrochenkov Forbid non-`structural_match` types in const generics Fixes https://github.com/rust-lang/rust/issues/60286.
2019-10-24Turn crate store into a resolver outputVadim Petrochenkov-9/+15
2019-10-24rustc: Combine resolver outputs into a single structVadim Petrochenkov-33/+29
2019-10-24resolve: Privatize all resolver fieldsVadim Petrochenkov-10/+54
2019-10-22Remove "type parameter depends on const parameter" error from resolutionvarkor-13/+2
2019-10-16move syntax::ext to new crate syntax_expandMazdak Farrokhzad-8/+6
2019-10-15Rollup merge of #64623 - matthewjasper:underscore-imports, r=petrochenkovTyler Mandry-5/+33
Remove last uses of gensyms Underscore bindings now use unique `SyntaxContext`s to avoid collisions. This was the last use of gensyms in the compiler, so this PR also removes them. closes #49300 cc #60869 r? @petrochenkov
2019-10-15Don't use `gensym_if_underscore` to resolve `_` bindingsMatthew Jasper-5/+33
Instead add a disambiguator to the keys used for distinguishing resolutions.
2019-10-14rustc_metadata: Remove resolutions for extern crate items from `CStore`Vadim Petrochenkov-1/+4
Use a more traditional scheme with providing them as a resolver output
2019-10-14rustc_metadata: Crate loader is immutableVadim Petrochenkov-2/+2
2019-10-14rustc_metadata: Privatize private code and remove dead codeVadim Petrochenkov-1/+1
2019-10-14Rollup merge of #65363 - Centril:less-pprust, r=Mark-SimulacrumMazdak Farrokhzad-2/+3
Remove implicit dependencies on syntax::pprust Part of https://github.com/rust-lang/rust/pull/65324. The main goal here is to facilitate the eventual move of pprust out from libsyntax and because an AST definition typically should not depend on its pretty printer. r? @estebank
2019-10-13Rollup merge of #65250 - da-x:ctor-in-error-msgs, r=petrochenkovMazdak Farrokhzad-11/+23
resolve: fix error title regarding private constructors One reason is that constructors can be private while their types can be public. Idea credit to @petrochenkov, discussed at #65153
2019-10-13ast: remove implicit pprust dependency via Display.Mazdak Farrokhzad-2/+3
Instead just use `pprust::path_to_string(..)` where needed. This has two benefits: a) The AST definition is now independent of printing it. (Therefore we get closer to extracting a data-crate.) b) Debugging should be easier as program flow is clearer.
2019-10-11resolve: shorten wording on private constructor errorDan Aloni-1/+1
2019-10-11resolve: fix error title regarding private constructorsDan Aloni-10/+22
The constructor is private, not the type. Idea credit to @petrochenkov, discussed at #65153
2019-10-11Auto merge of #64716 - jonhoo:stabilize-mem-take, r=SimonSapinbors-1/+0
Stabilize mem::take (mem_take) Tracking issue: https://github.com/rust-lang/rust/issues/61129 r? @matklad
2019-10-10Auto merge of #65153 - da-x:issue-58017, r=petrochenkovbors-19/+14
Improve message when attempting to instantiate tuple structs with private fields Fixes #58017, fixes #39703. ``` error[E0603]: tuple struct `Error` is private --> main.rs:22:16 | 2 | pub struct Error(usize, pub usize, usize); | ----- ----- field is private | | | field is private ... 22 | let x = a::Error(3, 1, 2); | ^^^^^ | = note: a tuple struct constructor is private if any of its fields is private ```
2019-10-09resolve: Use field spans for reporting the private constructor errorVadim Petrochenkov-18/+12
2019-10-09resolve: Keep field spans for diagnosticsVadim Petrochenkov-1/+2
2019-10-09self-profiling: Add events for everything except trait selection.Michael Woerister-0/+3
2019-10-08Stabilize mem::take (mem_take)Jon Gjengset-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/61129