Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint unstable floating point computations #346

Open
llogiq opened this Issue Sep 23, 2015 · 10 comments

Comments

Projects
None yet
4 participants
@llogiq
Copy link
Collaborator

llogiq commented Sep 23, 2015

Something along the lines of Herbie for Haskell, but without the auto-fixing – perhaps we can port the transformations to give (very) good suggestions.

@mcarton

This comment has been minimized.

Copy link
Collaborator

mcarton commented Jan 11, 2016

Hi
I loved the idea and I've been working on this recently, it's not finished yet but I think it's ready to talk about it and it's usable.
I think it's much bigger than any lint in clippy, it also needs a database, an optional configuration file and can optionally use an external program (herbie-inout) too so I'm not just making a PR here, but if you think it could be integrated that'd be awesome.

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 11, 2016

I'm fine with this being a separate lint, really 😄 . I have a defunct project, rust-Wall, which is meant to reexport lints from basically all the lint crates, except so far there is only one with universally-useful lints (clippy), so it never got used. We could reexport there and revive it.

Why does it need a database?

@mcarton

This comment has been minimized.

Copy link
Collaborator

mcarton commented Jan 11, 2016

The database contains cached expression replacements eg. (a*a + b*b).sqrt()a.hypot(b). It's required because Herbie is too slow to re-analyze every expressions every time. Also Herbie is quite difficult to install and requires a specific, not up-to-date, version of some esoteric language I forgot the name of. I've had to install it in docker. But with a pre-filled database, the installation is not required. The database format is the same as for Haskell's plugin, so they can be shared.
Nice to hear about rust-Wall, it's a shame there are no more lints (or not, maybe every one is just collaborating here 😄).

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 11, 2016

We could probably use rust-phf to in-memory that database? figure out a hashable representation for it and go!

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 11, 2016

Everyone is just collaborating here 😄 When I created rust-Wall clippy was small and I didn't expect it to be the One True home for lints

@mcarton

This comment has been minimized.

Copy link
Collaborator

mcarton commented Jan 11, 2016

I think we should keep the database, using rust-phf we could not cache new expression replacements as they are discovered by Herbie as it's a compile time thing.

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 11, 2016

Isn't the discovery thing slow? Perhaps we could build up a good database by merging all the existing Haskell-Herbie stuff and running the slow rust-herbie on a ton of crates in the ecosystem?

@mcarton

This comment has been minimized.

Copy link
Collaborator

mcarton commented Jan 11, 2016

Currently I've only used the database from Haskell-Herbie but I plan to run it on “a ton of crates in the ecosystem” of course 😄
If you guys have ideas of crates I've opened an issue to list them: mcarton/rust-herbie-lint#2.

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 26, 2016

fyi you're getting some well-deserved publicity here 😄

@gnzlbg

This comment has been minimized.

Copy link
Contributor

gnzlbg commented Jan 14, 2018

I'd like this lint to be available in clippy; otherwise it just doesn't get used.

Are there any other lints that could benefit from a dependency onHerbie or Z3 ? Maybe having these as dependencies won't pay off initially, but as more lints use them the cost can be amortized over time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.