Skip to content
Snippets Groups Projects
Commit f92f35e6 authored by Per Lindgren's avatar Per Lindgren
Browse files

traitor

parent 8f741042
Branches
No related tags found
No related merge requests found
//#![feature(const_size_of)]
#![feature(optin_builtin_traits)]
use std::mem::{transmute, size_of};
use std::marker::Sized;
......@@ -25,8 +26,30 @@ where
}
trait OkInState {}
impl OkInState for .. {}
impl !OkInState for Point {}
// You cannot implement it yourself
//impl OkInState for Point {}
struct Cont<T>
where
T: OkInState,
{
pub data: T,
}
// this is ok though
struct X {}
fn main() {
let mut p = Point { x: 0, y: 1 };
let _c = Cont { data: X {} };
let _c = Cont { data: p };
println!(" p {:?}", p);
let mut x = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment