diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-12-16 15:10:48 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-12-16 15:10:48 +0000 |
| commit | 452c745518246484807bd8c73a30400a10cd5057 (patch) | |
| tree | 90726bb81f59d5a14c0b93483fd4a7df9b255904 | |
| parent | 7e79c575e9676e27d2ccee3ef40b177a99a86cea (diff) | |
| download | rust-452c745518246484807bd8c73a30400a10cd5057.tar.gz rust-452c745518246484807bd8c73a30400a10cd5057.zip | |
Add a comment warning against using associated type defaults <3
| -rw-r--r-- | compiler/rustc_middle/src/query/keys.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs index a96bc115e3b..e4bb3ce3d5a 100644 --- a/compiler/rustc_middle/src/query/keys.rs +++ b/compiler/rustc_middle/src/query/keys.rs @@ -15,6 +15,14 @@ use rustc_span::{Span, DUMMY_SP}; /// The `Key` trait controls what types can legally be used as the key /// for a query. pub trait Key: Sized { + // N.B. Most of the keys down below have `type CacheSelector = DefaultCacheSelector<Self>;`, + // it would be reasonable to use associated type defaults, to remove the duplication... + // + // ...But r-a doesn't support them yet and using a default here causes r-a to not infer + // return types of queries which is very annoying. Thus, until r-a support associated + // type defaults, plese restrain from using them here <3 + // + // r-a issue: <https://github.com/rust-lang/rust-analyzer/issues/13693> type CacheSelector; /// Given an instance of this key, what crate is it referring to? |
