about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late.rs
AgeCommit message (Collapse)AuthorLines
2021-09-29Suggest similarly named assoc items in trait implsHirochika Matsumoto-8/+20
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
2021-09-24resolve: Refactor obtaining `Module` from its `DefId`Vadim Petrochenkov-1/+1
The `Option<Module>` version is supported for the case where we don't know whether the `DefId` refers to a module or not. Non-local traits and enums are also correctly found now.
2021-09-24resolve: Use a single common map for local and foreign modulesVadim Petrochenkov-3/+1
2021-09-24resolve: Do not cache nearest parent mod in `ModuleData`Vadim Petrochenkov-2/+2
2021-09-06Move `confused_type_with_std_module` to `ResolverOutputs`Aaron Hill-3/+2
This eliminates untracked global state from `Session`.
2021-09-04Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiserbors-0/+16
Detect bare blocks with type ascription that were meant to be a `struct` literal Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+16
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-01Compute all_traits_impls during resolution.Camille GILLOT-1/+8
2021-09-01Compute item_generics_num_lifetimes during resolution.Camille GILLOT-0/+15
2021-08-30Add let-else to ASTCameron Steffen-2/+9
2021-08-22Stop tracking namespce in used_imports.Mara Bos-2/+2
The information was tracked, but unused.
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-1/+1
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-5/+5
position.
2021-06-01Make trait_map an Option.Camille GILLOT-3/+3
2021-05-19Disallow shadowing const parametersFabian Wolff-5/+25
2021-05-13Add support for const operands and options to global_asm!Amanieu d'Antras-1/+5
On x86, the default syntax is also switched to Intel to match asm!
2021-04-21fix name resolution for param defaultslcnr-29/+40
2021-04-07Added additional comments and minor editsK-1/+1
2021-04-01Fixed diagnostic and added test for issue 81508Kevin Jiang-1/+1
2021-03-27lazily calls some fnsklensy-1/+1
2021-03-23Some refactoringvarkor-14/+14
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-0/+1
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-16ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`Vadim Petrochenkov-2/+2
2021-02-25Address review commentsAmanieu d'Antras-37/+3
2021-02-24Properly reject non-const argumentsAmanieu d'Antras-2/+50
2021-02-19Rollup merge of #82259 - osa1:issue82156, r=petrochenkovDylan DPC-6/+5
Fix popping singleton paths in when generating E0433 Fixes #82156 --- This was introduced with #72923, so pinging `@Patryk27` for reviews.
2021-02-18Fix popping singleton paths in when generating E0433Ömer Sinan Ağacan-6/+5
Fixes #82156
2021-02-18ast: Keep expansion status for out-of-line module itemsVadim Petrochenkov-1/+1
Also remove `ast::Mod` which is mostly redundant now
2021-02-06Rollup merge of #81680 - camsteffen:primty, r=oli-obkJonas Schievink-8/+4
Refactor `PrimitiveTypeTable` for Clippy I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.
2021-02-03Refactor out PrimitiveTypeTableCameron Steffen-8/+4
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-10/+16
2021-01-21Fix clippy and commentEsteban Küber-1/+1
2021-01-21Suggest `'a` when given `a` only when appropriateEsteban Küber-0/+6
When encountering a name `a` that isn't resolved, but a label `'a` is found in the current ribs, only suggest `'a` if this name is the value expression of a `break` statement. Solve FIXME.
2021-01-21Rollup merge of #81046 - rylev:unknown-external-crate, r=estebankYuki Okushi-0/+7
Improve unknown external crate error This improves error messages when unknown items in the crate root are encountered. Fixes #63799 r? ```@estebank```
2021-01-18Improve unknown external crate errorRyan Levick-0/+7
2021-01-17Rollup merge of #80765 - petrochenkov:traitsinscope, r=matthewjasperMara Bos-62/+10
resolve: Simplify collection of traits in scope "Traits in scope" for a given location are collected by walking all scopes in type namespace, collecting traits in them and pruning traits that don't have an associated item with the given name and namespace. Previously we tried to prune traits using some kind of hygienic resolution for associated items, but that was complex and likely incorrect, e.g. in #80762 correction to visibilites of trait items caused some traits to not be in scope anymore. I previously had some comments and concerns about this in https://github.com/rust-lang/rust/pull/65351. In this PR we are doing some much simpler pruning based on `Symbol` and `Namespace` comparisons, it should be enough to throw away 99.9% of unnecessary traits. It is not necessary for pruning to be precise because for trait aliases, for example, we don't do any pruning at all, and precise hygienic resolution for associated items needs to be done in typeck anyway. The somewhat unexpected effect is that trait imports introduced by macros 2.0 now bring traits into scope due to the removed hygienic check on associated item names. I'm not sure whether it is desirable or not, but I think it's acceptable for now. The old check was certainly incorrect because macros 2.0 did bring trait aliases into scope. If doing this is not desirable, then we should come up with some other way to avoid bringing traits from macros 2.0 into scope, that would accommodate for trait aliases as well. --- The PR also contains a couple of pure refactorings - Scope walk is done by using `visit_scopes` instead of a hand-rolled version. - Code is restructured to accomodate for rustdoc that also wants to query traits in scope, but doesn't want to filter them by associated items at all. r? ```@matthewjasper```
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-1/+1
2021-01-12Replace a simple `if let` with the `matches` macroLingMan-2/+1
2021-01-11resolve: Simplify collection of traits in scopeVadim Petrochenkov-62/+10
2021-01-10Auto merge of #80782 - petrochenkov:viscopes, r=matthewjasperbors-35/+47
resolve: Scope visiting doesn't need an `Ident` Resolution scope visitor (`fn visit_scopes`) currently takes an `Ident` parameter, but it doesn't need a full identifier, or even its span, it only needs the `SyntaxContext` part. The `SyntaxContext` part is necessary because scope visitor has to jump to macro definition sites, so it has to be directed by macro expansion information somehow. I think it's clearer to pass only the necessary part. Yes, usually visiting happens as a part of an identifier resolution, but in cases like collecting traits in scope (#80765) or collecting typo suggestions that's not the case. r? `@matthewjasper`
2021-01-08Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, ↵Yuki Okushi-10/+28
r=petrochenkov Add pointing const identifier when emitting E0435 Fix #79919
2021-01-07resolve: Scope visiting doesn't need an `Ident`Vadim Petrochenkov-35/+47
2021-01-07Add pointing const identifier when emitting E0435Daiki Ihara-10/+28
2021-01-06Rename to `nearest_parent_mod`Camelid-2/+2
* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod` `normal_ancestor_id` is a very confusing name if you don't already understand what it means. Adding docs helps, but using a clearer and more obvious name is also important. * Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod` * Add more docs
2021-01-01first pass at default values for const genericsJulian Knodt-1/+2
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-30Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkovMara Bos-1/+1
Rename kw::Invalid -> kw::Empty See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context. r? `@petrochenkov`
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-1/+1
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-30where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)Matthias Krüger-5/+3
2020-12-20Move std_path construction into conditionDániel Buga-5/+4
2020-12-20Inline a single-use closureDániel Buga-2/+2