3

Suggest replacing `typeof(...)` with an actual type by WaffleLapkin · Pull Reque...

 2 years ago
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.
neoserver,ios ssh client

Copy link

Contributor

@WaffleLapkin WaffleLapkin commented 10 days ago

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

  1. Is not const ({ let a = 1; let _: typeof(a); })
  2. Can't be found (let _: typeof(this_variable_does_not_exist))
  3. 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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK