• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Rust compiler plugin and support library to annotate overflow behavior

overflower

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.

Usage

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:

[dependencies]
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:

#![feature(plugin)]
#![plugin(overflower)]

extern crate overflower_support;

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

#[overflow(wrap)]
fn like_you_just_dont_care() { .. }

#[overflow(saturate)]
fn too_much_sunlight() {
    #[overflow(default)]
    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))]

#[cfg(feature="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

More Repositories

1

flame

An intrusive flamegraph profiling tool for rust.
Rust
672
star
2

mutagen

Breaking your Rust code for fun and profit
Rust
621
star
3

flamer

A compiler plugin to insert flame calls
Rust
364
star
4

momo

A Rust proc_macro_attribute to outline conversions from generic functions
Rust
239
star
5

bytecount

Counting occurrences of a given byte or UTF-8 characters in a slice of memory – fast
Rust
214
star
6

stdx-dev

Rust's missing development batteries
120
star
7

metacollect

A lint to collect some crate metadata
Rust
115
star
8

compact_arena

A crate with indexed arenas with small memory footprint
Rust
76
star
9

optional

A small crate to provide space-efficient Option<_> replacements
Rust
35
star
10

serdebench

Rust
30
star
11

newlinebench

Rust
21
star
12

partition

partition slices in-place by a predicate
Rust
14
star
13

compressbench

A benchmark of Rust compression libraries
Rust
9
star
14

smallvectune

Rust
9
star
15

llogiq.github.io

My github page
HTML
8
star
16

pathsep

A os agnostic way to get a path separator in macros
Rust
7
star
17

extra_lints

more lints for rust (now subsumed in rust-clippy)
Rust
7
star
18

arraymap

Adds a trait to map functions over arrays
Rust
6
star
19

bsdiff-rs

A Rust BSDiff port
Rust
4
star
20

arraymapbench

A benchmark of various map methods
Rust
2
star
21

twirer

A short program I use to collect and filter the core changes for This Week In Rust
Rust
2
star
22

picnic

Your Picnic Is On Fire!
Rust
1
star
23

openpgp

Rust
1
star
24

rangeset

(WIP) a RangeSet implementation
Rust
1
star
25

typetree

a data structure within Rust's type system
Rust
1
star
26

rust-stockfighter

Simple Rust Wrapper for stockfigher
Rust
1
star
27

ternary

Kleene logic in Rust's type system
Rust
1
star
28

lib_json

Allocationless Json Parsing
Rust
1
star
29

wom

Write-Only Memory for Rust
Rust
1
star