rollup merge of #23945: pnkfelix/gate-u-negate
Feature-gate unsigned unary negate. Discussed in weekly meeting here: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-03-31.md#feature-gate--expr and also in the internals thread here: http://internals.rust-lang.org/t/forbid-unsigned-integer/752
This commit is contained in:
commit
9edbf42a34
32 changed files with 146 additions and 48 deletions
|
|
@ -8,7 +8,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
|
||||
#![allow(unused_imports)]
|
||||
#![feature(negate_unsigned)]
|
||||
|
||||
// Note: the relevant lint pass here runs before some of the constant
|
||||
// evaluation below (e.g. that performed by trans and llvm), so if you
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
|
||||
#[repr(u8)] //~ NOTE discriminant type specified here
|
||||
enum Eu8 {
|
||||
Au8 = 23,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
#![deny(exceeding_bitshifts)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(core)]
|
||||
#![feature(core, negate_unsigned)]
|
||||
|
||||
fn main() {
|
||||
let n = 1u8 << 7;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(negate_unsigned)]
|
||||
|
||||
// compile-flags: -D unused-comparisons
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
#![deny(overflowing_literals)]
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(0xffffffff, (-1 as u32));
|
||||
assert_eq!(4294967295, (-1 as u32));
|
||||
assert_eq!(0xffffffffffffffff, (-1 as u64));
|
||||
assert_eq!(18446744073709551615, (-1 as u64));
|
||||
assert_eq!(0xffffffff, (!0 as u32));
|
||||
assert_eq!(4294967295, (!0 as u32));
|
||||
assert_eq!(0xffffffffffffffff, (!0 as u64));
|
||||
assert_eq!(18446744073709551615, (!0 as u64));
|
||||
|
||||
assert_eq!((-2147483648i32).wrapping_sub(1), 2147483647);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "arm"))]
|
||||
fn target() {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
#![feature(negate_unsigned)]
|
||||
#![feature(intrinsics)]
|
||||
|
||||
mod rusti {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
// pretty-expanded FIXME #23616
|
||||
|
||||
static X2: u64 = -1 as u16 as u64;
|
||||
static Y2: u64 = -1 as u32 as u64;
|
||||
const X: u64 = -1 as u16 as u64;
|
||||
const Y: u64 = -1 as u32 as u64;
|
||||
static X2: u64 = !0 as u16 as u64;
|
||||
static Y2: u64 = !0 as u32 as u64;
|
||||
const X: u64 = !0 as u16 as u64;
|
||||
const Y: u64 = !0 as u32 as u64;
|
||||
|
||||
fn main() {
|
||||
assert_eq!(match 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue