about summary refs log tree commit diff
path: root/src/librustc_middle/hir
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-2156/+0
2020-08-22Use smaller def span for functionsAaron Hill-3/+26
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-2/+2
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-11/+6
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-14Rework `rustc_serialize`Matthew Jasper-6/+6
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-11/+6
2020-07-16Move hir::Place to librustc_middle/hirAman Arora-0/+116
Needed to support https://github.com/rust-lang/project-rfc-2229/issues/7 Currently rustc_typeck depends on rustc_middle for definition TypeckTables, etc. For supporting project-rfc-2229#7, rustc_middle would've to depend on rustc_typeck for Place -- introducing a circular dependcy. This resembles the MIR equivalent of `Place` located in `lbrustc_middle/mir`. Co-authored-by: Aman Arora <me@aman-arora.com> Co-authored-by: Jennifer Wills <wills.jenniferg@gmail.com> Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-2/+2
2020-06-27Rollup merge of #73796 - lcnr:LocalDefId, r=matthewjasperManish Goregaokar-2/+2
replace more `DefId`s with `LocalDefId` part of https://github.com/rust-lang/rust/issues/70853
2020-06-27use LocalDefId in module checkingBastian Kauschke-2/+2
2020-06-26Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-5/+24
Also, implement this query for the local crate, not just foreign crates.
2020-06-23Rollup merge of #73488 - richkadel:llvm-coverage-map-gen, r=tmandryManish Goregaokar-1/+1
code coverage foundation for hash and num_counters This PR is the next iteration after PR #73011 (which is still waiting on bors to merge). @wesleywiser - PTAL r? @tmandry (FYI, I'm also working on injecting the coverage maps, in another branch, while waiting for these to merge.) Thanks!
2020-06-22Address remaining feedback itemsRich Kadel-1/+1
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-24/+5
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-20Remove `HirId` to `NodeId` conversion APIsmarmeladema-12/+4
2020-06-20Remove `NodeId` to `HirId` conversion APIsmarmeladema-1/+0
2020-06-20Move `trait_map` into `hir::Crate`marmeladema-0/+1
2020-06-15Auto merge of #73367 - RalfJung:rollup-4ewvk9b, r=RalfJungbors-5/+24
Rollup of 10 pull requests Successful merges: - #71824 (Check for live drops in constants after drop elaboration) - #72389 (Explain move errors that occur due to method calls involving `self`) - #72556 (Fix trait alias inherent impl resolution) - #72584 (Stabilize vec::Drain::as_slice) - #72598 (Display information about captured variable in `FnMut` error) - #73336 (Group `Pattern::strip_*` method together) - #73341 (_match.rs: fix module doc comment) - #73342 (Fix iterator copied() documentation example code) - #73351 (Update E0446.md) - #73353 (structural_match: non-structural-match ty closures) Failed merges: r? @ghost
2020-06-11Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-5/+24
Also, implement this query for the local crate, not just foreign crates.
2020-06-11Remove associated opaque typesMatthew Jasper-4/+0
They're unused now.
2020-06-11Stop special casing top level TAITMatthew Jasper-5/+3
2020-06-11Rollup merge of #72380 - lcnr:const_context, r=estebankDylan DPC-12/+12
Fix `is_const_context`, update `check_for_cast` A better version of #71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
2020-06-07Use `LocalDefId` directly in `Resolver::export_map` and `module_exports` querymarmeladema-2/+3
This is to avoid the final conversion from `NodeId` to `HirId` during call to `Resolver::(clone|into)_outputs`.
2020-06-04Remove unsused `NodeId` related APIs in hir mapmarmeladema-35/+2
2020-05-27Store `LocalDefId` directly in `rustc_resolve::Resolver` where possiblemarmeladema-6/+0
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-20`is_const_context` -> `is_inside_const_context`Bastian Kauschke-1/+1
2020-05-20fix is_const_contextBastian Kauschke-11/+11
2020-05-16Rollup merge of #71948 - csmoe:issue-61076, r=oli-obkDylan DPC-5/+1
Suggest to await future before ? operator Closes https://github.com/rust-lang/rust/issues/71811 cc #61076
2020-05-15implement type_implments_trait querycsmoe-1/+1
2020-05-11Fix clippy warningsMatthias Krüger-2/+1
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-11bless ui testscsmoe-5/+1
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-16/+17
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-16/+17
2020-05-07Add `hir::ConstContext`Dylan MacKenzie-0/+20
2020-04-24Remove `Option` from the return type of `def_kind`.Eduard-Mihai Burtescu-7/+6
2020-04-24Split out the `Generator` case from `DefKind::Closure`.Eduard-Mihai Burtescu-1/+2
2020-04-24add a few more DefKindsmark-20/+27
make Map::def_kind take LocalDefId Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> crates are DefKind::Mod
2020-04-23Address comments from reviewmarmeladema-9/+4
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-15/+7
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-8/+16
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-14/+11
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-10/+8
2020-04-14Remove `DUMMY_HIR_ID`marmeladema-8/+1
2020-04-14Do not use `DUMMY_HIR_ID` as placeholder value in node_id_to_hir_id tablemarmeladema-0/+10
Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.
2020-04-10librustc_middle: return LocalDefId instead of DefId in get_parent_didmarmeladema-3/+2
2020-04-10librustc_middle: return LocalDefId instead of DefId in local_def_id_from_node_idmarmeladema-12/+9
2020-04-10librustc_middle: return LocalDefId instead of DefId in body_owner_def_idmarmeladema-3/+2
2020-04-10librustc_middle: return LocalDefId instead of DefId in opt_local_def_idmarmeladema-10/+12
2020-04-10librustc_middle: return LocalDefId instead of DefId in ↵marmeladema-11/+13
opt_local_def_id_from_node_id
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-0/+2040