diff options
Diffstat (limited to 'src/test')
6 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime.rs b/src/test/ui/pub/pub-ident-fn-with-lifetime.rs new file mode 100644 index 00000000000..973bb924684 --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime.rs @@ -0,0 +1,6 @@ +pub foo<'a>(_s: &'a usize) -> bool { true } +//~^ ERROR missing `fn` for method definition + +fn main() { + foo(2); +} diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr new file mode 100644 index 00000000000..aa609d2cbc6 --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr @@ -0,0 +1,12 @@ +error: missing `fn` for method definition + --> $DIR/pub-ident-fn-with-lifetime.rs:1:4 + | +LL | pub foo<'a>(_s: &'a usize) -> bool { true } + | ^^^ +help: add `fn` here to parse `foo` as a public method + | +LL | pub fn foo<'a>(_s: &'a usize) -> bool { true } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-ident-struct-with-lifetime.rs b/src/test/ui/pub/pub-ident-struct-with-lifetime.rs new file mode 100644 index 00000000000..2feb0266070 --- /dev/null +++ b/src/test/ui/pub/pub-ident-struct-with-lifetime.rs @@ -0,0 +1,4 @@ +pub S<'a> { +//~^ ERROR missing `struct` for struct definition +} +fn main() {} diff --git a/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr new file mode 100644 index 00000000000..2bbcf5dfff0 --- /dev/null +++ b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr @@ -0,0 +1,12 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct-with-lifetime.rs:1:4 + | +LL | pub S<'a> { + | ^ +help: add `struct` here to parse `S` as a public struct + | +LL | pub struct S<'a> { + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs new file mode 100644 index 00000000000..55b1b746bc8 --- /dev/null +++ b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs @@ -0,0 +1,5 @@ +fn main() { +} + +pub foo<'a> +//~^ ERROR missing `fn` or `struct` for method or struct definition diff --git a/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr new file mode 100644 index 00000000000..a55c06f72df --- /dev/null +++ b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr @@ -0,0 +1,8 @@ +error: missing `fn` or `struct` for method or struct definition + --> $DIR/pub-ident-with-lifetime-incomplete.rs:4:4 + | +LL | pub foo<'a> + | ^^^ + +error: aborting due to previous error + |
