Skip to content
A Rust compiler plugin and support library to annotate overflow behavior
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
overflower-plugin Overflower 0.9 Oct 23, 2019
overflower Overflower 0.9 Oct 23, 2019
.gitignore initial commit support library May 22, 2016
.travis.yml Remove travis cache Jan 22, 2020
Cargo.toml Overflower 0.9 Oct 23, 2019
LICENSE Initial commit May 22, 2016 Overflower 0.9 Oct 23, 2019


Build Status Current Version

This project contains a compiler plugin and supporting library to allow the programmer to annotate their code to declare how integer overflows should be dealt with.


Note: This needs a nightly compiler both for the compiler plugin and the supporting library, as the latter makes use of specialization, which is unstable for now.

To use it, you need the following in your Cargo.toml:

overflower = "0.9"

You may also make it an optional dependency (overflower = { version = "0.4.6", optional = true }).

Next, in your crate root, you need to add:


extern crate overflower_support;

// Now you can annotate items (up to and including the whole crate)
fn panic_on_overflow() { .. }

fn like_you_just_dont_care() { .. }

fn too_much_sunlight() {
    fn but_use_standard_ops_here() { .. }

In case of an optional dependency, you'd add the following instead:

#![cfg_attr(feature="overflower", feature(plugin))]
#![cfg_attr(feature="overflower", plugin(overflower))]

extern crate overflower_support;

// as well as the following instead of e.g. `#[overflow(wrap)]`
#[cfg_attr(feature="overflower", overflow(wrap))];

This is a bit of a work in progress, but most things should already be usable.

License: Apache 2.0

You can’t perform that action at this time.