3
Suggest replacing `typeof(...)` with an actual type by WaffleLapkin · Pull Reque...
source link: https://github.com/rust-lang/rust/pull/95784
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This PR adds suggestion to replace typeof(...)
with an actual type of ...
, for example in case of typeof(1)
we suggest replacing it with i32
.
If the expression
- Is not const (
{ let a = 1; let _: typeof(a); }
) - Can't be found (
let _: typeof(this_variable_does_not_exist)
) - Or has non-suggestable type (closure, generator, error, etc)
we don't suggest anything.
The 1 one is sad, but it's not clear how to support non-consts expressions for typeof
.
This PR is inspired by this tweet.
compiler-errors, fbstj, fee1-dead, and ChayimFriedman2 reacted with heart emoji
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK