2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-03-15 03:30:06 +00:00
|
|
|
// ignore-pretty `dyn ::foo` parses differently in the current edition
|
2018-02-25 02:02:33 +00:00
|
|
|
|
2017-10-10 14:33:19 +00:00
|
|
|
use std::fmt::Display;
|
|
|
|
|
|
|
|
static BYTE: u8 = 33;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: &(dyn 'static + Display) = &BYTE;
|
|
|
|
let y: Box<dyn Display + 'static> = Box::new(BYTE);
|
2018-02-23 20:45:10 +00:00
|
|
|
let _: &dyn (Display) = &BYTE;
|
|
|
|
let _: &dyn (::std::fmt::Display) = &BYTE;
|
2017-10-10 14:33:19 +00:00
|
|
|
let xstr = format!("{}", x);
|
|
|
|
let ystr = format!("{}", y);
|
|
|
|
assert_eq!(xstr, "33");
|
|
|
|
assert_eq!(ystr, "33");
|
|
|
|
}
|