about summary refs log tree commit diff
path: root/src/librustc_middle/query
AgeCommit message (Collapse)AuthorLines
2020-06-15typeck: Use `LocalDefId`s for the unused trait import setVadim Petrochenkov-1/+1
2020-06-15Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, r=nikomatsakisRalf Jung-1/+1
Explain move errors that occur due to method calls involving `self` When calling a method that takes `self` (e.g. `vec.into_iter()`), the method receiver is moved out of. If the method receiver is used again, a move error will be emitted:: ```rust fn main() { let a = vec![true]; a.into_iter(); a; } ``` emits ``` error[E0382]: use of moved value: `a` --> src/main.rs:4:5 | 2 | let a = vec![true]; | - move occurs because `a` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait 3 | a.into_iter(); | - value moved here 4 | a; | ^ value used here after move ``` However, the error message doesn't make it clear that the move is caused by the call to `into_iter`. This PR adds additional messages to move errors when the move is caused by using a value as the receiver of a `self` method:: ``` error[E0382]: use of moved value: `a` --> vec.rs:4:5 | 2 | let a = vec![true]; | - move occurs because `a` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait 3 | a.into_iter(); | ------------- value moved due to this method call 4 | a; | ^ value used here after move | note: this function takes `self`, which moves the receiver --> /home/aaron/repos/rust/src/libcore/iter/traits/collect.rs:239:5 | 239 | fn into_iter(self) -> Self::IntoIter; ``` TODO: - [x] Add special handling for `FnOnce/FnMut/Fn` - we probably don't want to point at the unstable trait methods - [x] Consider adding additional context for operations (e.g. `Shr::shr`) when the call was generated using the operator syntax (e.g. `a >> b`) - [x] Consider pointing to the method parent (impl or trait block) in addition to the method itself.
2020-06-15Rollup merge of #71824 - ecstatic-morse:const-check-post-drop-elab, r=oli-obkRalf Jung-0/+6
Check for live drops in constants after drop elaboration Resolves #66753. This PR splits the MIR "optimization" pass series in two and introduces a query–`mir_drops_elaborated_and_const_checked`–that holds the result of the `post_borrowck_cleanup` analyses and checks for live drops. This query is invoked in `rustc_interface` for all items requiring const-checking, which means we now do `post_borrowck_cleanup` for items even if they are unused in the crate. As a result, we are now more precise about when drops are live. This is because drop elaboration can e.g. eliminate drops of a local when all its fields are moved from. This does not mean we are doing value-based analysis on move paths, however; Storing a `Some(CustomDropImpl)` into a field of a local will still set the qualifs for that entire local. r? @oli-obk
2020-06-13Add MIR phase and query for drop elaborationDylan MacKenzie-0/+6
2020-06-12Helper method for whether type has structural equalityDylan MacKenzie-0/+11
This helper method works for all types, falling back to a query for `TyKind::Adt`s to determine whether the implement the `{Partial,}StructuralEq` traits.
2020-06-11Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-1/+1
Also, implement this query for the local crate, not just foreign crates.
2020-06-09Auto merge of #72114 - anyska:vtable-rename, r=nikomatsakisbors-1/+1
Rename traits::Vtable to ImplSource. Originally suggested by @eddyb. r? @nikomatsakis
2020-06-07Use `LocalDefId` directly in `Resolver::export_map` and `module_exports` querymarmeladema-2/+2
This is to avoid the final conversion from `NodeId` to `HirId` during call to `Resolver::(clone|into)_outputs`.
2020-06-05Rename traits::Vtable to ImplSource.Ana-Maria Mihalache-1/+1
2020-05-31Add descriptions for all queriesMatthew Jasper-66/+168
2020-05-30more `LocalDefId`sBastian Kauschke-2/+8
2020-05-27Store `LocalDefId` directly in `rustc_resolve::Resolver` where possiblemarmeladema-2/+4
This commit also include the following changes: * Remove unused `hir::Map::as_local_node_id` method * Remove outdated comment about `hir::Map::local_def_id` method * Remove confusing `GlobMap` type alias * Use `LocalDefId` instead of `DefId` in `extern_crate_map` * Use `LocalDefId` instead of `DefId` in `maybe_unused_extern_crates` * Modify `extern_mod_stmt_cnum` query to accept a `LocalDefId` instead of a `DefId`
2020-05-25Rollup merge of #72538 - rakshith-ravi:refactor/remove-const-query, r=oli-obkDylan DPC-8/+0
Removed all instances of const_field. Fixes #72264 r? @oli-obk
2020-05-24librustc_middle: Rename upvars query to upvars_mentionedAman Arora-1/+1
As part of supporting RFC 2229, we will be capturing all the Places that were mentioned in the closure. This commit modifies the name of the upvars query to upvars_mentioned. Co-authored-by: Aman Arora <me@aman-arora.com> Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
2020-05-24Removed all instances of const_field.Rakshith Ravi-8/+0
2020-05-20Rename some types describing native librariesVadim Petrochenkov-2/+2
NativeLibrary(Kind) -> NativeLib(Kind) NativeStatic -> StaticBundle NativeStaticNobundle -> StaticNoBundle NativeFramework -> Framework NativeRawDylib -> RawDylib NativeUnknown -> Unspecified
2020-05-15implement type_implments_trait querycsmoe-0/+6
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-2/+2
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-2/+2
2020-05-07Reintegrate chalk using chalk-solveJack Huey-0/+10
2020-05-01Remove leftover chalk typesJack Huey-14/+0
2020-04-28Move a few queries to using an arena.Camille GILLOT-2/+6
2020-04-28Fix incremental compilation.Camille GILLOT-2/+1
2020-04-28Use the query system to allocate.Camille GILLOT-45/+63
2020-04-28Introduce ArenaStorage.Camille GILLOT-1/+2
2020-04-27Accept `LocalDefId` as key for `check_impl_item_well_formed` querymarmeladema-1/+3
2020-04-27Accept `LocalDefId` as key for `check_trait_item_well_formed` querymarmeladema-1/+3
2020-04-27Accept `LocalDefId` as key for `check_item_well_formed` querymarmeladema-1/+3
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-1/+1
2020-04-27Accept `LocalDefId` as key for `check_mod_privacy` querymarmeladema-2/+2
2020-04-27Accept `LocalDefId` as key for `lint_mod` querymarmeladema-2/+2
2020-04-27Accept `LocalDefId` as key for `mir_validated` querymarmeladema-1/+2
2020-04-27Accept `LocalDefId` as key for `mir_borrowck` querymarmeladema-5/+4
2020-04-27Return a `FxHashSet<LocalDefId>` from `mir_keys` querymarmeladema-1/+1
2020-04-27Accept `LocalDefId` as keyt for `names_imported_by_glob_use`marmeladema-2/+4
and `maybe_unused_trait_import` queries
2020-04-27Use `LocalDefId` for `type_param_predicates` querymarmeladema-2/+2
2020-04-27Use `LocalDefId` in `mir_built` querymarmeladema-1/+1
2020-04-27Use `LocalDefId` in `unsafety_check_result` querymarmeladema-3/+3
2020-04-27Use `LocalDefId` in `typeck_tables_of` and `used_trait_imports` queriesmarmeladema-7/+9
2020-04-24Remove `Option` from the return type of `def_kind`.Eduard-Mihai Burtescu-1/+1
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-1/+1
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-1/+1
2020-04-22Use `Body` everywhereDylan MacKenzie-21/+11
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-3/+14
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-2/+11
2020-04-18ty/instance: use `ParamEnvAnd` in the `resolve_instance` query.Eduard-Mihai Burtescu-2/+4
2020-04-17ty/print: pretty-print constant aggregates (arrays, tuples and ADTs).Eduard-Mihai Burtescu-1/+1
2020-04-11Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakisbors-8/+8
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
2020-04-05Remove unneeded Lrc in query results.Camille GILLOT-3/+3
2020-04-05Remove Arcs in queries.Camille GILLOT-3/+3