Auto merge of #22909 - Manishearth:rollup, r=Manishearth
r? @Manishearth
This commit is contained in:
commit
0905c8a5ec
8 changed files with 38 additions and 7 deletions
16
src/test/compile-fail/nonbool_static_assert.rs
Normal file
16
src/test/compile-fail/nonbool_static_assert.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[static_assert]
|
||||
static E: i32 = 1; //~ ERROR can only have static_assert on a static with type `bool`
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
#![feature(box_syntax)]
|
||||
|
||||
use std::fmt;
|
||||
use std::usize;
|
||||
|
||||
struct A;
|
||||
struct B;
|
||||
|
|
@ -137,6 +138,13 @@ pub fn main() {
|
|||
t!(format!("{:+10.3e}", 1.2345e6f64), " +1.234e6");
|
||||
t!(format!("{:+10.3e}", -1.2345e6f64), " -1.234e6");
|
||||
|
||||
// Test that pointers don't get truncated.
|
||||
{
|
||||
let val = usize::MAX;
|
||||
let exp = format!("{:#x}", val);
|
||||
t!(format!("{:p}", val as *const isize), exp);
|
||||
}
|
||||
|
||||
// Escaping
|
||||
t!(format!("{{"), "{");
|
||||
t!(format!("}}"), "}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue