about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-09 11:50:28 -0700
committerGitHub <noreply@github.com>2020-07-09 11:50:28 -0700
commit65ac3948ae0699e4ae2fa9005e27c6a860536502 (patch)
treebc923be4024910773f7fad0c60e4d90f26dc174b /src/test/codegen/src-hash-algorithm
parentd163524cf46c5d17b5243d6fb0b0b91d2749857d (diff)
parentf07100afc8650101ac924d728521e1a5d0ce9080 (diff)
downloadrust-65ac3948ae0699e4ae2fa9005e27c6a860536502.tar.gz
rust-65ac3948ae0699e4ae2fa9005e27c6a860536502.zip
Rollup merge of #74070 - eddyb:forall-tcx-providers, r=nikomatsakis
 Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.

In order to work around normalization-under-HRTB (for `provide!` in `rustc_metadata`), we ended up with this:
```rust
struct Providers<'tcx> {
    type_of: fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>,
    // ...
}
```
But what I initially wanted to do, IIRC, was this:
```rust
struct Providers {
    type_of: for<'tcx> fn(TyCtxt<'tcx>, DefId) -> Ty<'tcx>,
    // ...
}
```

This PR moves to the latter, for the simple reason that only the latter allows keeping a `Providers` value, or a subset of its `fn` pointer fields, around in a `static` or `thread_local!`, which can be really useful for custom drivers that override queries.
(@jyn514 and I came across a concrete usecase of that in `rustdoc`)

The `provide!` macro in `rustc_metadata` is fixed by making the query key/value types available as type aliases under `ty::query::query_{keys,values}`, not just associated types (this is the first commit).

r? @nikomatsakis
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions