Skip to content
Permalink
Browse files

review comments: more tests

  • Loading branch information
estebank committed Jan 9, 2020
1 parent c751961 commit 6e04cf062f605fbd70d728dcd364ad3eac0f822c
@@ -1,3 +1,4 @@
#![feature(type_alias_impl_trait)] // Needed for single test `type Y = impl Trait<_>`
// This test checks that it is not possible to enable global type
// inference by using the `_` type placeholder.

@@ -42,6 +43,16 @@ impl Test9 {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
}

fn test11(x: &usize) -> &_ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
&x
}

unsafe fn test12(x: *const usize) -> *const *const _ {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
&x
}

impl Clone for Test9 {
fn clone(&self) -> _ { Test9 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
@@ -144,3 +155,24 @@ fn impl_trait() -> impl BadTrait<_> {
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
unimplemented!()
}

struct BadStruct1<_, _>(_);
//~^ ERROR expected identifier, found reserved identifier `_`
//~| ERROR expected identifier, found reserved identifier `_`
//~| ERROR the name `_` is already used
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
struct BadStruct2<_, T>(_, T);
//~^ ERROR expected identifier, found reserved identifier `_`
//~| ERROR the type placeholder `_` is not allowed within types on item signatures

type X = Box<_>;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures

struct Struct;
trait Trait<T> {}
impl Trait<usize> for Struct {}
type Y = impl Trait<_>;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
fn foo() -> Y {
Struct
}

0 comments on commit 6e04cf0

Please sign in to comment.
You can’t perform that action at this time.