mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Add a comment warning against using associated type defaults <3
This commit is contained in:
parent
7e79c575e9
commit
452c745518
@ -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?
|
||||
|
Loading…
Reference in New Issue
Block a user