about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2020-08-23resolve: Add comments to `traits_in_scope`Joshua Nelson-0/+3
2020-08-22resolve: Add public entrypoint `traits_in_module`Joshua Nelson-0/+25
- Consider the implicit prelude as well
2020-08-22resolve: Split `ensure_traits` into a separate functionJoshua Nelson-16/+25
2020-08-22resolve: Move `get_traits_in_module_containing_item` to ResolverJoshua Nelson-81/+93
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-12/+12
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-12/+12
2020-08-16resolve: support `GenericBound::LangItemTrait`David Wood-0/+28
This commit modifies name resolution to ensure that new scopes are introduced from lang-item generic bounds. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-16hir: introduce `QPath::LangItem`David Wood-31/+0
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-10/+15
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-7/+8
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-14Rollup merge of #75509 - estebank:coming-merrily-from-java-land, r=lcnrTyler Mandry-4/+60
Tweak suggestion for `this` -> `self` * When referring to `this` in associated `fn`s always suggest `self`. * Point at ident for `fn` lacking `self` * Suggest adding `self` to assoc `fn`s when appropriate _Improvements based on the narrative in https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust_
2020-08-14review comment: suggestion message wordingEsteban Küber-1/+2
2020-08-13Suggest adding `&self` when accessing `self` in static assoc `fn`Esteban Küber-15/+46
2020-08-13Tweak suggestion for `this` -> `self`Esteban Küber-3/+27
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-7/+8
2020-08-13Rollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnrYuki Okushi-36/+172
Fix suggestion to use lifetime in type and in assoc const _Do not merge until #75363 has landed, as it has the test case for this._ * Account for associated types * Associated `const`s can't have generics (fix #74264) * Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix #72404)
2020-08-11Suggest using `'static` in assoc consts and suggest when multiple lts are neededEsteban Küber-6/+60
2020-08-11review comment: simplify code by using slice patEsteban Küber-9/+10
2020-08-11When suggesting `for` lts, consider existing lifetime namesEsteban Küber-20/+84
Fix #72404.
2020-08-11Assoc `const`s don't have genericsEsteban Küber-3/+14
Fix #74264.
2020-08-11Fix suggestion to use lifetime in typeEsteban Küber-1/+7
2020-08-11Detect tuple variants used as struct pattern and suggest correct patternEsteban Küber-1/+10
2020-08-11Rollup merge of #75353 - estebank:tiny, r=jyn514Yuki Okushi-3/+3
Tiny cleanup, remove unnecessary `unwrap` Remove unnecessary `unwrap`.
2020-08-10Add missing primary labelEsteban Küber-1/+5
2020-08-10Point at item definition in foreign cratesEsteban Küber-4/+16
2020-08-10Do not suggest similarly named enclosing itemEsteban Küber-13/+34
2020-08-10Tweak ordering of suggestionsEsteban Küber-6/+10
Modify logic to make it easier to follow and recover labels that would otherwise be lost.
2020-08-09Small cleanupEsteban Küber-3/+3
Remove unnecessary `unwrap`.
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-29/+24
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitorbors-1/+1
Rollup of 7 pull requests Successful merges: - #75224 (Don't call a function in function-arguments-naked.rs) - #75237 (Display elided lifetime for non-reference type in doc) - #75250 (make MaybeUninit::as_(mut_)ptr const) - #75253 (clean up const-hacks in int endianess conversion functions) - #75259 (Add missing backtick) - #75267 (Small cleanup) - #75270 (fix a couple of clippy findings) Failed merges: r? @ghost
2020-08-08Rollup merge of #75267 - estebank:cleanup, r=Dylan-DPCYuki Okushi-1/+1
Small cleanup * Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-29/+24
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-08Auto merge of #74877 - lcnr:min_const_generics, r=oli-obkbors-16/+73
Implement the `min_const_generics` feature gate Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332. Adds the new feature gate `#![feature(min_const_generics)]`. This feature gate adds the following limitations to using const generics: - generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`) - generic parameters must be either integers, `bool` or `char`. We do allow arbitrary expressions in associated consts though, meaning that the following is allowed, even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable. ```rust trait Foo { const ASSOC: usize; } impl<const N: usize> Foo for [u8; N] { const ASSOC: usize = 64 / N; } ``` r? @varkor cc @eddyb @withoutboats
2020-08-07Small cleanupEsteban Küber-1/+1
* Add docstring to `Parser` field * Remove unnecessary `unwrap` * Remove unnecessary borrow * Fix indentation of some `teach`text output
2020-08-06allow complex expressions in assoc constsBastian Kauschke-17/+17
2020-08-05forbid generic params in complex constsBastian Kauschke-18/+75
2020-08-05Handle fieldless tuple structs in diagnostic codeAaron Hill-4/+3
Fixes #75062
2020-08-02Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkovbors-19/+7
Fix ICEs with `@ ..` binding This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken. The diagnostics are verbose though, it fixes three related issues. cc #74954, #74539, and #74702
2020-08-02Auto merge of #74210 - estebank:type-ascriptomatic, r=petrochenkovbors-80/+126
Deduplicate `::` -> `:` typo errors Deduplicate errors caused by the same type ascription typo, including ones suggested during parsing that would get reported again during resolve. Fix #70382.
2020-08-02Auto merge of #74785 - euclio:deprecation-kinds, r=petrochenkovbors-1/+1
report kind of deprecated item in message This is important for fields, which are incorrectly referred to as "items".
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-31Reduce verbosity of some type ascription errorsEsteban Küber-80/+126
* Deduplicate type ascription LHS errors * Remove duplicated `:` -> `::` suggestion from parse error * Tweak wording to be more accurate * Modify `current_type_ascription` to reduce span wrangling * remove now unnecessary match arm * Add run-rustfix to appropriate tests
2020-07-31Fix ICEs with `@ ..` bindingYuki Okushi-3/+1
2020-07-31Revert "Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern"Yuki Okushi-19/+9
This reverts commit f5e5eb6f46ef2cf0dd45dba4f975305509334fc6.
2020-07-27forbid generic params inside of anon consts in ty defaultsBastian Kauschke-8/+76
2020-07-27name `ParamInTyOfConstArg`Bastian Kauschke-5/+5
2020-07-26Hygiene serialization implementationAaron Hill-7/+37
2020-07-26report kind of deprecated item in messageAndy Russell-1/+1
This is important for fields, which are incorrectly referred to as "items".
2020-07-24Rollup merge of #74692 - Mark-Simulacrum:delay-bug, r=pnkfelixManish Goregaokar-12/+18
delay_span_bug instead of silent ignore This is a follow-up to #74557. r? @pnkfelix
2020-07-24Auto merge of #74676 - lcnr:generics-no-sort, r=varkorbors-1/+4
correctly deal with unsorted generic parameters We now stop sorting generic params and instead correctly handle unsorted params in the rest of the compiler. We still restrict const params to come after type params though, so this PR does not change anything which is visible to users. This might slightly influence perf, so let's prevent any unintentional rollups. @bors rollup=never r? @varkor