mirror of
https://github.com/rust-lang/rust
synced 2024-10-06 16:51:35 +00:00
Fallout: tests. As tests frequently elide things, lots of changes
here. Some of this may have been poorly rebased, though I tried to be careful and preserve the spirit of the test.
This commit is contained in:
parent
ef42c2befd
commit
872ce47955
|
@ -92,7 +92,7 @@ fn test_transmute_copy() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_transmute() {
|
fn test_transmute() {
|
||||||
trait Foo {}
|
trait Foo { fn dummy(&self) { } }
|
||||||
impl Foo for int {}
|
impl Foo for int {}
|
||||||
|
|
||||||
let a = box 100 as Box<Foo>;
|
let a = box 100 as Box<Foo>;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub trait TheTrait<T> {
|
pub trait TheTrait<T> : ::std::marker::PhantomFn<T> {
|
||||||
fn the_fn(&self);
|
fn the_fn(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,5 @@
|
||||||
|
|
||||||
pub struct FakeHeap;
|
pub struct FakeHeap;
|
||||||
|
|
||||||
pub struct FakeVec<T, A = FakeHeap>;
|
pub struct FakeVec<T, A = FakeHeap> { pub f: Option<(T,A)> }
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub struct A<T>;
|
pub struct A<T> { pub v: T }
|
||||||
pub struct B<T>;
|
pub struct B<T> { pub v: T }
|
||||||
|
|
||||||
pub mod test {
|
pub mod test {
|
||||||
pub struct A<T>;
|
pub struct A<T> { pub v: T }
|
||||||
|
|
||||||
impl<T> A<T> {
|
impl<T> A<T> {
|
||||||
pub fn foo(&self) -> int {
|
pub fn foo(&self) -> int {
|
||||||
|
@ -52,9 +52,9 @@ pub fn bar(&self) -> int {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn foo() -> int {
|
pub fn foo() -> int {
|
||||||
let a = A::<()>;
|
let a = A { v: () };
|
||||||
let b = B::<()>;
|
let b = B { v: () };
|
||||||
let c = test::A::<()>;
|
let c = test::A { v: () };
|
||||||
return a.foo() + a.bar() +
|
return a.foo() + a.bar() +
|
||||||
b.foo() + b.bar() +
|
b.foo() + b.bar() +
|
||||||
c.foo() + c.bar();
|
c.foo() + c.bar();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
pub use src::aliases::B;
|
pub use src::aliases::B;
|
||||||
pub use src::hidden_core::make;
|
pub use src::hidden_core::make;
|
||||||
|
@ -23,9 +24,9 @@ pub mod aliases {
|
||||||
pub mod hidden_core {
|
pub mod hidden_core {
|
||||||
use super::aliases::B;
|
use super::aliases::B;
|
||||||
|
|
||||||
pub struct A<T>;
|
pub struct A<T> { t: T }
|
||||||
|
|
||||||
pub fn make() -> B { A }
|
pub fn make() -> B { A { t: 1.0 } }
|
||||||
|
|
||||||
impl<T> A<T> {
|
impl<T> A<T> {
|
||||||
pub fn foo(&mut self) { println!("called foo"); }
|
pub fn foo(&mut self) { println!("called foo"); }
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub struct TreeBuilder<H>;
|
pub struct TreeBuilder<H> { pub h: H }
|
||||||
|
|
||||||
impl<H> TreeBuilder<H> {
|
impl<H> TreeBuilder<H> {
|
||||||
pub fn process_token(&mut self) {
|
pub fn process_token(&mut self) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
pub trait Foo<'a, T> {
|
pub trait Foo<'a, T> {
|
||||||
fn foo(&self) -> T;
|
fn foo(&'a self) -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
|
pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
#![allow(unknown_features)]
|
#![allow(unknown_features)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
pub trait i<T> { }
|
pub trait i<T>
|
||||||
|
{
|
||||||
|
fn dummy(&self, t: T) -> T { panic!() }
|
||||||
|
}
|
||||||
|
|
||||||
pub fn f<T>() -> Box<i<T>+'static> {
|
pub fn f<T>() -> Box<i<T>+'static> {
|
||||||
impl<T> i<T> for () { }
|
impl<T> i<T> for () { }
|
||||||
|
|
|
@ -13,8 +13,11 @@
|
||||||
|
|
||||||
#![feature(unsafe_destructor)]
|
#![feature(unsafe_destructor)]
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct arc_destruct<T> {
|
struct arc_destruct<T> {
|
||||||
_data: int,
|
_data: int,
|
||||||
|
_marker: marker::PhantomData<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
@ -24,7 +27,8 @@ fn drop(&mut self) {}
|
||||||
|
|
||||||
fn arc_destruct<T: Sync>(data: int) -> arc_destruct<T> {
|
fn arc_destruct<T: Sync>(data: int) -> arc_destruct<T> {
|
||||||
arc_destruct {
|
arc_destruct {
|
||||||
_data: data
|
_data: data,
|
||||||
|
_marker: marker::PhantomData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
|
|
||||||
pub trait T {
|
pub trait T {
|
||||||
type C;
|
type C;
|
||||||
|
fn dummy(&self) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub trait Foo {
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
pub trait Foo : MarkerTrait {
|
||||||
fn bar();
|
fn bar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
trait A {}
|
trait A {
|
||||||
|
fn dummy(&self) { }
|
||||||
|
}
|
||||||
struct B;
|
struct B;
|
||||||
impl A for B {}
|
impl A for B {}
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,6 @@ fn x() {
|
||||||
fn f() { }
|
fn f() { }
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
fn dummy(&self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,12 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![feature(lang_items)]
|
#![feature(lang_items)]
|
||||||
|
|
||||||
|
#[lang="phantom_fn"]
|
||||||
|
pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
|
||||||
|
impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
|
||||||
|
|
||||||
#[lang="sized"]
|
#[lang="sized"]
|
||||||
pub trait Sized {}
|
pub trait Sized : PhantomFn<Self> {}
|
||||||
|
|
||||||
#[lang="panic"]
|
#[lang="panic"]
|
||||||
fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
|
fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
|
||||||
|
@ -25,6 +29,8 @@ fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
|
||||||
extern fn eh_personality() {}
|
extern fn eh_personality() {}
|
||||||
|
|
||||||
#[lang="copy"]
|
#[lang="copy"]
|
||||||
pub trait Copy {}
|
pub trait Copy : PhantomFn<Self> {
|
||||||
|
// Empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ fn trait_stable_text(&self) {}
|
||||||
impl Trait for MethodTester {}
|
impl Trait for MethodTester {}
|
||||||
|
|
||||||
#[unstable(feature = "test_feature")]
|
#[unstable(feature = "test_feature")]
|
||||||
pub trait UnstableTrait {}
|
pub trait UnstableTrait { fn dummy(&self) { } }
|
||||||
|
|
||||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
#[stable(feature = "test_feature", since = "1.0.0")]
|
||||||
#[deprecated(since = "1.0.0")]
|
#[deprecated(since = "1.0.0")]
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub fn foo<T>(&self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// issue 8134
|
// issue 8134
|
||||||
pub struct Parser<T>;
|
pub struct Parser<T>(T);
|
||||||
impl<T: std::iter::Iterator<Item=char>> Parser<T> {
|
impl<T: std::iter::Iterator<Item=char>> Parser<T> {
|
||||||
fn in_doctype(&mut self) {
|
fn in_doctype(&mut self) {
|
||||||
static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
|
static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
|
||||||
|
|
|
@ -8,4 +8,4 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub trait RemoteTrait {}
|
pub trait RemoteTrait { fn dummy(&self) { } }
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
struct DerefWithHelper<H, T> {
|
struct DerefWithHelper<H, T> {
|
||||||
pub helper: H
|
pub helper: H,
|
||||||
|
pub value: Option<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Helper<T> {
|
trait Helper<T> {
|
||||||
|
@ -34,6 +35,6 @@ fn deref(&self) -> &T {
|
||||||
|
|
||||||
// Test cross-crate autoderef + vtable.
|
// Test cross-crate autoderef + vtable.
|
||||||
pub fn check<T: PartialEq>(x: T, y: T) -> bool {
|
pub fn check<T: PartialEq>(x: T, y: T) -> bool {
|
||||||
let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x) };
|
let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x), value: None };
|
||||||
d.eq(&y)
|
d.eq(&y)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,4 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Foo {}
|
trait Foo : ::std::marker::MarkerTrait {}
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
|
|
||||||
#![crate_name = "a"]
|
#![crate_name = "a"]
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
macro_rules! three {
|
macro_rules! three {
|
||||||
() => { 3 }
|
() => { 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait U {}
|
pub trait U : MarkerTrait {}
|
||||||
pub trait V {}
|
pub trait V : MarkerTrait {}
|
||||||
impl U for () {}
|
impl U for () {}
|
||||||
impl V for () {}
|
impl V for () {}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub trait Trait {}
|
pub trait Trait {
|
||||||
|
fn dummy(&self) { }
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Foo<T:Trait> {
|
pub struct Foo<T:Trait> {
|
||||||
pub x: T,
|
pub x: T,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub trait Foo {
|
pub trait Foo : ::std::marker::MarkerTrait {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Foo for int {
|
impl Foo for int {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
pub use self::sub::{Bar, Baz};
|
pub use self::sub::{Bar, Baz};
|
||||||
|
|
||||||
pub trait Trait {
|
pub trait Trait {
|
||||||
fn foo();
|
fn foo(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -16,8 +16,12 @@
|
||||||
#![feature(no_std)]
|
#![feature(no_std)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
#[lang="phantom_fn"]
|
||||||
|
pub trait PhantomFn<A:?Sized,R:?Sized=()> { }
|
||||||
|
impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
|
||||||
|
|
||||||
#[lang="sized"]
|
#[lang="sized"]
|
||||||
pub trait Sized {
|
pub trait Sized : PhantomFn<Self> {
|
||||||
// Empty.
|
// Empty.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
// Test that coherence detects overlap when some of the types in the
|
// Test that coherence detects overlap when some of the types in the
|
||||||
// impls are projections of associated type. Issue #20624.
|
// impls are projections of associated type. Issue #20624.
|
||||||
|
|
||||||
|
use std::marker::PhantomData;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
pub struct Cow<'a, B: ?Sized>;
|
pub struct Cow<'a, B: ?Sized>(PhantomData<(&'a (),B)>);
|
||||||
|
|
||||||
/// Trait for moving into a `Cow`
|
/// Trait for moving into a `Cow`
|
||||||
pub trait IntoCow<'a, B: ?Sized> {
|
pub trait IntoCow<'a, B: ?Sized> {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// Check that an associated type cannot be bound in an expression path.
|
// Check that an associated type cannot be bound in an expression path.
|
||||||
|
|
||||||
trait Foo {
|
trait Foo : ::std::marker::MarkerTrait {
|
||||||
type A;
|
type A;
|
||||||
fn bar() -> isize;
|
fn bar() -> isize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Test that we do not ICE when an impl is missing an associated type (and that we report
|
// Test that we do not ICE when an impl is missing an associated type (and that we report
|
||||||
// a useful error, of course).
|
// a useful error, of course).
|
||||||
|
|
||||||
trait Trait {
|
trait Trait : ::std::marker::MarkerTrait {
|
||||||
type Type;
|
type Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Foo {
|
trait Foo : ::std::marker::MarkerTrait {
|
||||||
type X;
|
type X;
|
||||||
type Y;
|
type Y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// Check that we get an error when you use `<Self as Get>::Value` in
|
// Check that we get an error when you use `<Self as Get>::Value` in
|
||||||
// the trait definition but `Self` does not, in fact, implement `Get`.
|
// the trait definition but `Self` does not, in fact, implement `Get`.
|
||||||
|
|
||||||
trait Get {
|
trait Get : ::std::marker::MarkerTrait {
|
||||||
type Value;
|
type Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
pub trait Foo {
|
pub trait Foo {
|
||||||
type A;
|
type A;
|
||||||
|
|
||||||
|
fn dummy(&self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Foo for i32 {
|
impl Foo for i32 {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// Check that an associated type cannot be bound in an expression path.
|
// Check that an associated type cannot be bound in an expression path.
|
||||||
|
|
||||||
trait Foo {
|
trait Foo : ::std::marker::MarkerTrait {
|
||||||
type A;
|
type A;
|
||||||
fn bar() -> isize;
|
fn bar() -> isize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,6 @@
|
||||||
|
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
#![feature(no_std)]
|
|
||||||
#![no_std]
|
|
||||||
#![feature(lang_items)]
|
|
||||||
|
|
||||||
#[lang="sized"]
|
|
||||||
pub trait Sized {}
|
|
||||||
|
|
||||||
struct S<T> {
|
struct S<T> {
|
||||||
contents: T,
|
contents: T,
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
trait Trait {}
|
trait Trait : ::std::marker::MarkerTrait {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let x: Vec<Trait + Sized> = Vec::new();
|
let x: Vec<Trait + Sized> = Vec::new();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use std::fmt::Show;
|
use std::fmt::Show;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
// Test that two blanket impls conflict (at least without negative
|
// Test that two blanket impls conflict (at least without negative
|
||||||
// bounds). After all, some other crate could implement Even or Odd
|
// bounds). After all, some other crate could implement Even or Odd
|
||||||
|
@ -19,9 +20,9 @@ trait MyTrait {
|
||||||
fn get(&self) -> usize;
|
fn get(&self) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Even { }
|
trait Even : MarkerTrait { }
|
||||||
|
|
||||||
trait Odd { }
|
trait Odd : MarkerTrait { }
|
||||||
|
|
||||||
impl Even for isize { }
|
impl Even for isize { }
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ trait MyTrait {
|
||||||
fn get(&self) -> usize;
|
fn get(&self) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Even { }
|
trait Even : ::std::marker::MarkerTrait { }
|
||||||
|
|
||||||
trait Odd { }
|
trait Odd : ::std::marker::MarkerTrait { }
|
||||||
|
|
||||||
impl<T:Even> MyTrait for T { //~ ERROR E0119
|
impl<T:Even> MyTrait for T { //~ ERROR E0119
|
||||||
fn get(&self) -> usize { 0 }
|
fn get(&self) -> usize { 0 }
|
||||||
|
|
|
@ -10,18 +10,18 @@
|
||||||
|
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
|
|
||||||
trait MyTrait {}
|
trait MyTrait : ::std::marker::MarkerTrait {}
|
||||||
|
|
||||||
struct TestType<T>;
|
struct TestType<T>(::std::marker::PhantomData<T>);
|
||||||
|
|
||||||
unsafe impl<T: MyTrait> Send for TestType<T> {}
|
unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
|
||||||
//~^ ERROR conflicting implementations for trait `core::marker::Send`
|
//~^ ERROR conflicting implementations for trait `core::marker::Send`
|
||||||
//~^^ ERROR conflicting implementations for trait `core::marker::Send`
|
//~^^ ERROR conflicting implementations for trait `core::marker::Send`
|
||||||
|
|
||||||
impl<T: MyTrait> !Send for TestType<T> {}
|
impl<T: MyTrait> !Send for TestType<T> {}
|
||||||
//~^ ERROR conflicting implementations for trait `core::marker::Send`
|
//~^ ERROR conflicting implementations for trait `core::marker::Send`
|
||||||
|
|
||||||
unsafe impl<T> Send for TestType<T> {}
|
unsafe impl<T:'static> Send for TestType<T> {}
|
||||||
//~^ ERROR error: conflicting implementations for trait `core::marker::Send`
|
//~^ ERROR error: conflicting implementations for trait `core::marker::Send`
|
||||||
|
|
||||||
impl !Send for TestType<i32> {}
|
impl !Send for TestType<i32> {}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
trait Trait {}
|
trait Trait : ::std::marker::MarkerTrait {}
|
||||||
impl Trait for Foo {}
|
impl Trait for Foo {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait T {}
|
trait T : ::std::marker::MarkerTrait {}
|
||||||
impl T for isize {}
|
impl T for isize {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
trait Bar {}
|
trait Bar : ::std::marker::MarkerTrait {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
// With a vec of isize.
|
// With a vec of isize.
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
trait Bar {}
|
trait Bar : ::std::marker::MarkerTrait {}
|
||||||
impl Bar for Foo {}
|
impl Bar for Foo {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
trait Bar {}
|
trait Bar : ::std::marker::MarkerTrait {}
|
||||||
impl Bar for Foo {}
|
impl Bar for Foo {}
|
||||||
|
|
||||||
fn baz<'a>() {
|
fn baz<'a>() {
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
|
|
||||||
// Test implicit coercions involving DSTs and raw pointers.
|
// Test implicit coercions involving DSTs and raw pointers.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
trait T {}
|
trait T : MarkerTrait {}
|
||||||
impl T for S {}
|
impl T for S {}
|
||||||
|
|
||||||
struct Foo<T: ?Sized> {
|
struct Foo<T: ?Sized> {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// Test that we cannot create objects from unsized types.
|
// Test that we cannot create objects from unsized types.
|
||||||
|
|
||||||
trait Foo {}
|
trait Foo : ::std::marker::MarkerTrait {}
|
||||||
impl Foo for str {}
|
impl Foo for str {}
|
||||||
|
|
||||||
fn test1<T: ?Sized + Foo>(t: &T) {
|
fn test1<T: ?Sized + Foo>(t: &T) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy)] //~ ERROR the trait `Copy` may not be implemented
|
#[derive(Copy)] //~ ERROR the trait `Copy` may not be implemented
|
||||||
struct Bar<T>;
|
struct Bar<T>(::std::marker::PhantomData<T>);
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
impl<T> Drop for Bar<T> {
|
impl<T> Drop for Bar<T> {
|
||||||
|
|
|
@ -8,10 +8,13 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
struct Foo<A, B, C = (A, B)>;
|
use std::marker;
|
||||||
|
|
||||||
|
struct Foo<A, B, C = (A, B)>(
|
||||||
|
marker::PhantomData<(A,B,C)>);
|
||||||
|
|
||||||
impl<A, B, C = (A, B)> Foo<A, B, C> {
|
impl<A, B, C = (A, B)> Foo<A, B, C> {
|
||||||
fn new() -> Foo<A, B, C> {Foo}
|
fn new() -> Foo<A, B, C> {Foo(marker::PhantomData)}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -8,12 +8,15 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct Heap;
|
struct Heap;
|
||||||
|
|
||||||
struct Vec<T, A = Heap>;
|
struct Vec<T, A = Heap>(
|
||||||
|
marker::PhantomData<(T,A)>);
|
||||||
|
|
||||||
impl<T, A = Heap> Vec<T, A> {
|
impl<T, A = Heap> Vec<T, A> {
|
||||||
fn new() -> Vec<T, A> {Vec}
|
fn new() -> Vec<T, A> {Vec(marker::PhantomData)}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -16,9 +16,12 @@
|
||||||
//
|
//
|
||||||
// Regression test for issue #16218.
|
// Regression test for issue #16218.
|
||||||
|
|
||||||
trait Bar<'a> {}
|
trait Bar<'a> {
|
||||||
|
fn dummy(&'a self);
|
||||||
|
}
|
||||||
|
|
||||||
trait Foo<'a> {
|
trait Foo<'a> {
|
||||||
|
fn dummy(&'a self) { }
|
||||||
fn bar<'b, T: Bar<'b>>(self) -> &'b str;
|
fn bar<'b, T: Bar<'b>>(self) -> &'b str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct Heap;
|
struct Heap;
|
||||||
|
|
||||||
struct Vec<T, A = Heap>;
|
struct Vec<T, A = Heap>(
|
||||||
|
marker::PhantomData<(T,A)>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: Vec; //~ ERROR wrong number of type arguments: expected at least 1, found 0
|
let _: Vec; //~ ERROR wrong number of type arguments: expected at least 1, found 0
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct Heap;
|
struct Heap;
|
||||||
|
|
||||||
struct Vec<T, A = Heap>;
|
struct Vec<T, A = Heap>(
|
||||||
|
marker::PhantomData<(T,A)>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: Vec<isize, Heap, bool>;
|
let _: Vec<isize, Heap, bool>;
|
||||||
|
|
|
@ -8,13 +8,15 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct A;
|
struct A;
|
||||||
struct B;
|
struct B;
|
||||||
struct C;
|
struct C;
|
||||||
struct Foo<T = A, U = B, V = C>;
|
struct Foo<T = A, U = B, V = C>(marker::PhantomData<(T,U,V)>);
|
||||||
|
|
||||||
struct Hash<T>;
|
struct Hash<T>(marker::PhantomData<T>);
|
||||||
struct HashMap<K, V, H = Hash<K>>;
|
struct HashMap<K, V, H = Hash<K>>(marker::PhantomData<(K,V,H)>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Ensure that the printed type doesn't include the default type params...
|
// Ensure that the printed type doesn't include the default type params...
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
struct Test<'s> {
|
struct Test {
|
||||||
func: Box<FnMut()+'static>
|
func: Box<FnMut()+'static>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait FromStructReader<'a> { }
|
use std::marker::PhantomFn;
|
||||||
|
|
||||||
|
trait FromStructReader<'a> : PhantomFn<(Self,&'a ())> { }
|
||||||
trait ResponseHook {
|
trait ResponseHook {
|
||||||
fn get<'a, T: FromStructReader<'a>>(&'a self);
|
fn get<'a, T: FromStructReader<'a>>(&'a self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
enum NodeContents<'a> {
|
enum NodeContents<'a> {
|
||||||
Children(Vec<Node<'a>>),
|
Children(Vec<Node<'a>>),
|
||||||
}
|
}
|
||||||
|
@ -22,11 +24,12 @@ fn drop( &mut self ) {
|
||||||
|
|
||||||
struct Node<'a> {
|
struct Node<'a> {
|
||||||
contents: NodeContents<'a>,
|
contents: NodeContents<'a>,
|
||||||
|
marker: PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Node<'a> {
|
impl<'a> Node<'a> {
|
||||||
fn noName(contents: NodeContents<'a>) -> Node<'a> {
|
fn noName(contents: NodeContents<'a>) -> Node<'a> {
|
||||||
Node{ contents: contents,}
|
Node { contents: contents, marker: PhantomData }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Node {
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait Node : MarkerTrait {
|
||||||
fn zomg();
|
fn zomg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Foo {}
|
trait Foo {
|
||||||
|
fn dummy(&self) { }
|
||||||
|
}
|
||||||
|
|
||||||
struct A;
|
struct A;
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
trait Str {}
|
trait Str : MarkerTrait {}
|
||||||
|
|
||||||
trait Something {
|
trait Something {
|
||||||
fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
|
fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait ListItem<'a> {
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait ListItem<'a> : MarkerTrait {
|
||||||
fn list_name() -> &'a str;
|
fn list_name() -> &'a str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
struct Foo<T> { foo: Option<Option<Foo<T>>> }
|
use std::marker;
|
||||||
|
|
||||||
|
struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
|
||||||
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
|
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
|
||||||
|
|
||||||
impl<T> Foo<T> { fn bar(&self) {} }
|
impl<T> Foo<T> { fn bar(&self) {} }
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
struct Foo { foo: Bar<Foo> }
|
struct Foo { foo: Bar<Foo> }
|
||||||
struct Bar<T> { x: Bar<Foo> }
|
struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
|
||||||
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
|
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
|
||||||
|
|
||||||
impl Foo { fn foo(&self) {} }
|
impl Foo { fn foo(&self) {} }
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
|
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
|
|
||||||
struct B<T>;
|
use std::marker;
|
||||||
|
|
||||||
|
struct B<T>(marker::PhantomData<T>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = B; //~ ERROR: unable to infer enough type information
|
let foo = B(marker::PhantomData); //~ ERROR unable to infer enough type information
|
||||||
let closure = || foo;
|
let closure = || foo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
pub trait AbstractRenderer : MarkerTrait {}
|
||||||
pub trait AbstractRenderer {}
|
|
||||||
|
|
||||||
fn _create_render(_: &()) ->
|
fn _create_render(_: &()) ->
|
||||||
AbstractRenderer
|
AbstractRenderer
|
||||||
|
|
|
@ -8,11 +8,13 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
fn add_state(op: <isize as HasState>::State) {
|
fn add_state(op: <isize as HasState>::State) {
|
||||||
//~^ ERROR the trait `HasState` is not implemented for the type `isize`
|
//~^ ERROR the trait `HasState` is not implemented for the type `isize`
|
||||||
}
|
}
|
||||||
|
|
||||||
trait HasState {
|
trait HasState : MarkerTrait {
|
||||||
type State;
|
type State;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ fn ufcs() {
|
||||||
|
|
||||||
Push::push(&c, box || y = 0);
|
Push::push(&c, box || y = 0);
|
||||||
Push::push(&c, box || y = 0);
|
Push::push(&c, box || y = 0);
|
||||||
|
//~^ ERROR cannot borrow `y` as mutable more than once at a time
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Push<'c> {
|
trait Push<'c> {
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait Foo {
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait Foo : MarkerTrait {
|
||||||
type Item;
|
type Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,12 @@
|
||||||
#![feature(lang_items, start, no_std)]
|
#![feature(lang_items, start, no_std)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
#[lang="phantom_fn"]
|
||||||
|
trait PhantomFn<A:?Sized,R:?Sized=()> { }
|
||||||
|
impl<A:?Sized, R:?Sized, U:?Sized> PhantomFn<A,R> for U { }
|
||||||
|
|
||||||
#[lang = "sized"]
|
#[lang = "sized"]
|
||||||
trait Sized {}
|
trait Sized : PhantomFn<Self> {}
|
||||||
|
|
||||||
#[start]
|
#[start]
|
||||||
fn main(_: int, _: *const *const u8) -> int {
|
fn main(_: int, _: *const *const u8) -> int {
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
// cause compiler to loop. Note that no instances
|
// cause compiler to loop. Note that no instances
|
||||||
// of such a type could ever be constructed.
|
// of such a type could ever be constructed.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
struct t(Box<t>); //~ ERROR this type cannot be instantiated
|
struct t(Box<t>); //~ ERROR this type cannot be instantiated
|
||||||
|
|
||||||
trait to_str_2 {
|
trait to_str_2 : MarkerTrait {
|
||||||
fn my_to_string() -> String;
|
fn my_to_string() -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,11 @@
|
||||||
// below. Note that changing to a named lifetime made the problem go
|
// below. Note that changing to a named lifetime made the problem go
|
||||||
// away.
|
// away.
|
||||||
|
|
||||||
use std::ops::{Shl, Shr};
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
use std::ops::{Shl, Shr};
|
||||||
|
|
||||||
pub trait Subscriber {
|
pub trait Subscriber : MarkerTrait {
|
||||||
type Input;
|
type Input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// than the trait method it's implementing
|
// than the trait method it's implementing
|
||||||
|
|
||||||
trait A {
|
trait A {
|
||||||
fn b<C,D>(x: C) -> C;
|
fn b<C,D>(&self, x: C) -> C;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct E {
|
struct E {
|
||||||
|
@ -20,7 +20,7 @@ struct E {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl A for E {
|
impl A for E {
|
||||||
fn b<F: Sync, G>(_x: F) -> F { panic!() }
|
fn b<F: Sync, G>(&self, _x: F) -> F { panic!() }
|
||||||
//~^ ERROR `F : core::marker::Sync` appears on the impl method
|
//~^ ERROR `F : core::marker::Sync` appears on the impl method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::marker;
|
||||||
|
|
||||||
enum E1 { V1(E2<E1>), }
|
enum E1 { V1(E2<E1>), }
|
||||||
enum E2<T> { V2(E2<E1>), }
|
enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
|
||||||
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
|
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
|
||||||
|
|
||||||
impl E1 { fn foo(&self) {} }
|
impl E1 { fn foo(&self) {} }
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait MyTrait { }
|
trait MyTrait {
|
||||||
|
fn dummy(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
pub enum TraitWrapper {
|
pub enum TraitWrapper {
|
||||||
A(Box<MyTrait+'static>),
|
A(Box<MyTrait+'static>),
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait I {}
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait I : MarkerTrait {}
|
||||||
type K = I+'static;
|
type K = I+'static;
|
||||||
|
|
||||||
fn foo(_x: K) {} //~ ERROR: the trait `core::marker::Sized` is not implemented
|
fn foo(_x: K) {} //~ ERROR: the trait `core::marker::Sized` is not implemented
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait Foo {}
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait Foo : MarkerTrait {}
|
||||||
impl Foo for u8 {}
|
impl Foo for u8 {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
trait A {}
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait A : MarkerTrait {}
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
r: A+'static
|
r: A+'static
|
||||||
|
@ -20,6 +22,6 @@ fn new_struct(r: A+'static)
|
||||||
Struct { r: r }
|
Struct { r: r }
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Curve {}
|
trait Curve : MarkerTrait {}
|
||||||
enum E {X(Curve+'static)}
|
enum E {X(Curve+'static)}
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -8,13 +8,15 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
pub struct TypeWithState<State>;
|
use std::marker;
|
||||||
|
|
||||||
|
pub struct TypeWithState<State>(marker::PhantomData<State>);
|
||||||
pub struct MyState;
|
pub struct MyState;
|
||||||
|
|
||||||
pub fn foo<State>(_: TypeWithState<State>) {}
|
pub fn foo<State>(_: TypeWithState<State>) {}
|
||||||
|
|
||||||
pub fn bar() {
|
pub fn bar() {
|
||||||
foo(TypeWithState); //~ ERROR type annotations required
|
foo(TypeWithState(marker::PhantomData)); //~ ERROR type annotations required
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
// Test the mechanism for warning about possible missing `self` declarations.
|
// Test the mechanism for warning about possible missing `self` declarations.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
trait CtxtFn {
|
trait CtxtFn {
|
||||||
fn f8(self, usize) -> usize;
|
fn f8(self, usize) -> usize;
|
||||||
fn f9(usize) -> usize; //~ NOTE candidate
|
fn f9(usize) -> usize; //~ NOTE candidate
|
||||||
}
|
}
|
||||||
|
|
||||||
trait OtherTrait {
|
trait OtherTrait : MarkerTrait {
|
||||||
fn f9(usize) -> usize; //~ NOTE candidate
|
fn f9(usize) -> usize; //~ NOTE candidate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +26,7 @@ trait OtherTrait {
|
||||||
// declaration to match against, so we wind up prisizeing it as a
|
// declaration to match against, so we wind up prisizeing it as a
|
||||||
// candidate. This seems not unreasonable -- perhaps the user meant to
|
// candidate. This seems not unreasonable -- perhaps the user meant to
|
||||||
// implement it, after all.
|
// implement it, after all.
|
||||||
trait UnusedTrait {
|
trait UnusedTrait : MarkerTrait {
|
||||||
fn f9(usize) -> usize; //~ NOTE candidate
|
fn f9(usize) -> usize; //~ NOTE candidate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ fn fff(i: isize) -> isize { //~ NOTE candidate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ManyImplTrait {
|
trait ManyImplTrait : MarkerTrait {
|
||||||
fn is_str() -> bool { //~ NOTE candidate
|
fn is_str() -> bool { //~ NOTE candidate
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,16 +13,12 @@
|
||||||
// Verify the compiler fails with an error on infinite function
|
// Verify the compiler fails with an error on infinite function
|
||||||
// recursions.
|
// recursions.
|
||||||
|
|
||||||
struct Data(Box<Option<Data>>);
|
fn generic<T>() {
|
||||||
|
generic::<Option<T>>();
|
||||||
fn generic<T>( _ : Vec<(Data,T)> ) {
|
|
||||||
let rec : Vec<(Data,(bool,T))> = Vec::new();
|
|
||||||
generic( rec );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main () {
|
fn main () {
|
||||||
// Use generic<T> at least once to trigger instantiation.
|
// Use generic<T> at least once to trigger instantiation.
|
||||||
let input : Vec<(Data,())> = Vec::new();
|
generic::<i32>();
|
||||||
generic(input);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
// Test which of the builtin types are considered POD.
|
// Test which of the builtin types are considered POD.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
fn assert_copy<T:Copy>() { }
|
fn assert_copy<T:Copy>() { }
|
||||||
|
|
||||||
trait Dummy { }
|
trait Dummy : MarkerTrait { }
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
struct MyStruct {
|
struct MyStruct {
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
trait Foo {
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
|
trait Foo : MarkerTrait {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy> Foo for T {
|
impl<T:Copy> Foo for T {
|
||||||
|
|
|
@ -13,40 +13,44 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
struct S<T>;
|
use std::marker;
|
||||||
|
|
||||||
trait Gettable<T> {}
|
struct S<T>(marker::PhantomData<T>);
|
||||||
|
|
||||||
|
trait Gettable<T> {
|
||||||
|
fn get(&self) -> T { panic!() }
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||||
|
|
||||||
fn f<T>(val: T) {
|
fn f<T>(val: T) {
|
||||||
let t: S<T> = S;
|
let t: S<T> = S(marker::PhantomData);
|
||||||
let a = &t as &Gettable<T>;
|
let a = &t as &Gettable<T>;
|
||||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||||
//~^^ ERROR the trait `core::marker::Copy` is not implemented
|
//~^^ ERROR the trait `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
fn g<T>(val: T) {
|
fn g<T>(val: T) {
|
||||||
let t: S<T> = S;
|
let t: S<T> = S(marker::PhantomData);
|
||||||
let a: &Gettable<T> = &t;
|
let a: &Gettable<T> = &t;
|
||||||
//~^ ERROR the trait `core::marker::Send` is not implemented
|
//~^ ERROR the trait `core::marker::Send` is not implemented
|
||||||
//~^^ ERROR the trait `core::marker::Copy` is not implemented
|
//~^^ ERROR the trait `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<'a>() {
|
fn foo<'a>() {
|
||||||
let t: S<&'a isize> = S;
|
let t: S<&'a isize> = S(marker::PhantomData);
|
||||||
let a = &t as &Gettable<&'a isize>;
|
let a = &t as &Gettable<&'a isize>;
|
||||||
//~^ ERROR the type `&'a isize` does not fulfill the required lifetime
|
//~^ ERROR cannot infer
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo2<'a>() {
|
fn foo2<'a>() {
|
||||||
let t: Box<S<String>> = box S;
|
let t: Box<S<String>> = box S(marker::PhantomData);
|
||||||
let a = t as Box<Gettable<String>>;
|
let a = t as Box<Gettable<String>>;
|
||||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo3<'a>() {
|
fn foo3<'a>() {
|
||||||
let t: Box<S<String>> = box S;
|
let t: Box<S<String>> = box S(marker::PhantomData);
|
||||||
let a: Box<Gettable<String>> = t;
|
let a: Box<Gettable<String>> = t;
|
||||||
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
//~^ ERROR the trait `core::marker::Copy` is not implemented
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
// in this file all test the "kind" violates detected during kindck.
|
// in this file all test the "kind" violates detected during kindck.
|
||||||
// See all `regions-bounded-by-send.rs`
|
// See all `regions-bounded-by-send.rs`
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
fn assert_send<T:Send>() { }
|
fn assert_send<T:Send>() { }
|
||||||
trait Dummy { }
|
trait Dummy : MarkerTrait { }
|
||||||
trait Message : Send { }
|
trait Message : Send { }
|
||||||
|
|
||||||
// careful with object types, who knows what they close over...
|
// careful with object types, who knows what they close over...
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
// is broken into two parts because some errors occur in distinct
|
// is broken into two parts because some errors occur in distinct
|
||||||
// phases in the compiler. See kindck-send-object2.rs as well!
|
// phases in the compiler. See kindck-send-object2.rs as well!
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
fn assert_send<T:Send+'static>() { }
|
fn assert_send<T:Send+'static>() { }
|
||||||
trait Dummy { }
|
trait Dummy : MarkerTrait { }
|
||||||
|
|
||||||
// careful with object types, who knows what they close over...
|
// careful with object types, who knows what they close over...
|
||||||
fn test51<'a>() {
|
fn test51<'a>() {
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
|
|
||||||
// Continue kindck-send-object1.rs.
|
// Continue kindck-send-object1.rs.
|
||||||
|
|
||||||
|
use std::marker::MarkerTrait;
|
||||||
|
|
||||||
fn assert_send<T:Send>() { }
|
fn assert_send<T:Send>() { }
|
||||||
trait Dummy { }
|
trait Dummy : MarkerTrait { }
|
||||||
|
|
||||||
fn test50() {
|
fn test50() {
|
||||||
assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Sync` is not implemented
|
assert_send::<&'static Dummy>(); //~ ERROR the trait `core::marker::Sync` is not implemented
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32 }
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32, marker: PhantomData<(&'x(),&'y(),&'z())> }
|
||||||
fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) {
|
fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) {
|
||||||
//~^ HELP: consider using an explicit lifetime parameter as shown: fn bar1<'b, 'c, 'a>(x: &'a Bar<'b, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
|
//~^ HELP: consider using an explicit lifetime parameter as shown: fn bar1<'b, 'c, 'a>(x: &'a Bar<'b, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
|
||||||
(x.bar, &x.baz, &x.baz)
|
(x.bar, &x.baz, &x.baz)
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
struct Foo<'x> { bar: isize }
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
struct Foo<'x> { bar: isize, marker: PhantomData<&'x ()> }
|
||||||
fn foo1<'a>(x: &Foo) -> &'a isize {
|
fn foo1<'a>(x: &Foo) -> &'a isize {
|
||||||
//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a isize
|
//~^ HELP: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a isize
|
||||||
&x.bar //~ ERROR: cannot infer
|
&x.bar //~ ERROR: cannot infer
|
||||||
|
|
|
@ -47,20 +47,26 @@ fn foo3() {}
|
||||||
/// dox
|
/// dox
|
||||||
pub trait A {
|
pub trait A {
|
||||||
/// dox
|
/// dox
|
||||||
fn foo();
|
fn foo(&self);
|
||||||
/// dox
|
/// dox
|
||||||
fn foo_with_impl() {}
|
fn foo_with_impl(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
trait B {
|
trait B {
|
||||||
fn foo();
|
fn foo(&self);
|
||||||
fn foo_with_impl() {}
|
fn foo_with_impl(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait C { //~ ERROR: missing documentation
|
pub trait C { //~ ERROR: missing documentation
|
||||||
fn foo(); //~ ERROR: missing documentation
|
fn foo(&self); //~ ERROR: missing documentation
|
||||||
fn foo_with_impl() {} //~ ERROR: missing documentation
|
fn foo_with_impl(&self) {} //~ ERROR: missing documentation
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
pub trait D {
|
||||||
|
fn dummy(&self) { }
|
||||||
}
|
}
|
||||||
#[allow(missing_docs)] pub trait D {}
|
|
||||||
|
|
||||||
impl Foo {
|
impl Foo {
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum Foo5 {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
|
trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
|
||||||
|
fn dummy(&self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
|
fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
|
||||||
|
|
|
@ -341,7 +341,9 @@ fn fn_in_body() {}
|
||||||
|
|
||||||
#[unstable(feature = "test_feature")]
|
#[unstable(feature = "test_feature")]
|
||||||
#[deprecated(since = "1.0.0")]
|
#[deprecated(since = "1.0.0")]
|
||||||
pub trait DeprecatedTrait {}
|
pub trait DeprecatedTrait {
|
||||||
|
fn dummy(&self) { }
|
||||||
|
}
|
||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
|
|
||||||
struct Private<T>;
|
use std::marker;
|
||||||
pub struct Public<T>;
|
|
||||||
|
struct Private<T>(marker::PhantomData<T>);
|
||||||
|
pub struct Public<T>(marker::PhantomData<T>);
|
||||||
|
|
||||||
impl Private<Public<isize>> {
|
impl Private<Public<isize>> {
|
||||||
pub fn a(&self) -> Private<isize> { panic!() }
|
pub fn a(&self) -> Private<isize> { panic!() }
|
||||||
|
@ -103,7 +105,7 @@ impl PrivTrait for (Private<isize>,) {
|
||||||
fn bar(&self) -> Private<isize> { panic!() }
|
fn bar(&self) -> Private<isize> { panic!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ParamTrait<T> {
|
pub trait ParamTrait<T> : marker::MarkerTrait {
|
||||||
fn foo() -> T;
|
fn foo() -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue