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