about summary refs log tree commit diff
path: root/src/librustc_save_analysis
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-3756/+0
2020-08-30Rollup merge of #76057 - matklad:remove-retokenize, r=petrochenkovDylan DPC-59/+33
Move retokenize hack to save_analysis closes #76046
2020-08-29Move retokenize hack to save_analysisAleksey Kladov-59/+33
2020-08-22Use smaller def span for functionsAaron Hill-1/+1
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-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-3/+3
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-3/+3
2020-08-16save_analysis: support `QPath::LangItem`David Wood-44/+32
This commit implements support for `QPath::LangItem` and `GenericBound::LangItemTrait` in save analysis. Signed-off-by: David Wood <david@davidtw.co>
2020-08-16hir: introduce `QPath::LangItem`David Wood-0/+8
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-3/+3
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-1/+1
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-1/+1
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-07fix clippy::unneeded_wildcard_pattern: remove redundant wildcard patternMatthias Krüger-1/+1
2020-08-06rustc_expand: Don not beautify doc comments before passing them to macrosVadim Petrochenkov-6/+3
Beautify all doc strings in rustdoc instead, including those in `#[doc]` attributes
2020-08-06rustc_ast: Stop using "string typing" for doc comment tokensVadim Petrochenkov-2/+2
Explicitly store their kind and style retrieved during lexing in the token
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-2/+2
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-26Hygiene serialization implementationAaron Hill-1/+1
2020-07-17Auto merge of #72983 - Lezzz:rename-typeck, r=nikomatsakisbors-32/+34
Rename TypeckTables to TypeckResults. Originally suggested by @eddyb.
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-32/+34
2020-07-16apply bootstrap cfgsMark Rousskov-1/+0
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-03Use 'tcx for references to AccessLevels wherever possible.Eduard-Mihai Burtescu-73/+34
2020-07-02rustc_save_analysis: avoid using TypeckTables::empty for SaveContext.Eduard-Mihai Burtescu-23/+31
2020-06-19save_analysis: improve handling of enum struct variantmarmeladema-19/+6
Fixes #61385
2020-06-15make all uses of ty::Error or ConstKind::Error delay a span bugmark-1/+1
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-4/+2
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-12Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnayDylan DPC-1/+1
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2020-06-11Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasperDylan DPC-1/+3
Track span of function in method calls, and use this in #[track_caller] Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-11Rename `TyKind::Def` to `OpaqueDef`Matthew Jasper-2/+2
2020-06-11Remove associated opaque typesMatthew Jasper-2/+0
They're unused now.
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-1/+3
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10Migrate to numeric associated constsLzu Tao-1/+1
2020-06-09save_analysis: fix enum reference to point to variant rather than constructormarmeladema-11/+7
Fixes #61302
2020-06-09save_analysis: improve pretty printing of enummarmeladema-5/+4
2020-06-09save_analysis: better handle functions signaturemarmeladema-35/+36
2020-06-09save_analysis: better handle pathsmarmeladema-27/+74
2020-06-06save_analysis: fix panic in `write_sub_paths_truncated`marmeladema-3/+5
2020-06-06save_analysis: fix ice in `get_expr_data`marmeladema-3/+7
2020-06-04save_analysis: work on HIR tree instead of ASTmarmeladema-986/+874
2020-05-29Split payload of FileName::Real to track both real and virutalized paths.Felix S. Klock II-2/+3
Such splits arise from metadata refs into libstd. This way, we can (in a follow on commit) continue to emit the virtual name into things like the like the StableSourceFileId that ends up in incremetnal build artifacts, while still using the devirtualized file path when we want to access the file. Note that this commit is intended to be a refactoring; the actual fix to the bug in question is in a follow-on commit.
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-3/+2
2020-05-18Fix ICE in -Zsave-analysisNathan Corbyn-1/+5
2020-05-15Rollup merge of #71809 - marmeladema:fix-issue-71104, r=eddybDylan DPC-29/+41
Use `LocalDefId` in `DumpVisitor::nest_tables` This is a partial fix for #71104
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-11/+14
2020-05-03Use `LocalDefId` in `DumpVisitor::nest_tables`marmeladema-29/+41
This is a partial fix for #71104
2020-04-27Accept `LocalDefId` as keyt for `names_imported_by_glob_use`marmeladema-1/+1
and `maybe_unused_trait_import` queries
2020-04-27Use `LocalDefId` in `typeck_tables_of` and `used_trait_imports` queriesmarmeladema-1/+1
2020-04-24Split out the `Generator` case from `DefKind::Closure`.Eduard-Mihai Burtescu-1/+2
2020-04-24add a few more DefKindsmark-2/+15
make Map::def_kind take LocalDefId Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> crates are DefKind::Mod
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-33/+41