about summary refs log tree commit diff
path: root/src/test/incremental/thinlto
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-03 23:11:17 +0000
committerbors <bors@rust-lang.org>2019-05-03 23:11:17 +0000
commit13fde05b12c28e1ed66bd13fdf1ea392f166b811 (patch)
treefb8d9b9657887be7e011edf90cd0d1c739a88cbc /src/test/incremental/thinlto
parenta3404557c54ea48fb8efc805d93c450beb3364d4 (diff)
parentff174fe09e2e0a8f959b970e6ec410b3aafbc58a (diff)
downloadrust-13fde05b12c28e1ed66bd13fdf1ea392f166b811.tar.gz
rust-13fde05b12c28e1ed66bd13fdf1ea392f166b811.zip
Auto merge of #60462 - eddyb:def-1-a-mere-resolution, r=petrochenkov
rustc: factor out most of hir::def::Def's variants into DefKind, and rename to Res.

The first two commits are about introducing `DefKind`, both to simplify/orthogonalize `hir::def::Def`, and to allow reasoning about the kind of a definition without dealing with the redundant `DefId`.
(There are likely more changes to be made, such as adding enough `DefKind` variants for `tcx.def_kind(def_id)` to return just `DefKind`, not `Option<DefKind>`, but this is pretty big as-is)

The third commit frees up the `Def` name (which we may want to use in the future for "definitions", in the sense of "entities with a `DefId`") by renaming `hir::def::Def` to `Res` ("resolution").
IMO this fits, as it represents all the possible name resolution results, not just "definitions (with a `DefId`)".

Quick examples:
```rust
// Before:
if tcx.describe_def(def_id) == Some(Def::Struct(def_id)) {...}
if let Def::Struct(def_id) = path.def {...}
```
```rust
// After:
if tcx.def_kind(def_id) == Some(DefKind::Struct) {...}
if let Res::Def(DefKind::Struct, def_id) = path.res {...}
```

r? @petrochenkov cc @rust-lang/compiler
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions