diff options
| author | varkor <github@varkor.com> | 2018-08-20 16:32:59 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-08-20 16:36:45 +0100 |
| commit | ee9bd0fd99ef5049f53b5d8233369187637cb71c (patch) | |
| tree | 7c37b0cd72a988708bab0a4722b441ac9a932209 | |
| parent | aa3b5c58e44beca0e96b46deb24f1bcb8d8c98a1 (diff) | |
| download | rust-ee9bd0fd99ef5049f53b5d8233369187637cb71c.tar.gz rust-ee9bd0fd99ef5049f53b5d8233369187637cb71c.zip | |
Add a test for skipping all arguments versus just one
| -rw-r--r-- | src/test/ui/generic/generic-arg-mismatch-recover.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/generic/generic-arg-mismatch-recover.stderr | 31 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.rs b/src/test/ui/generic/generic-arg-mismatch-recover.rs new file mode 100644 index 00000000000..b8883ff9c83 --- /dev/null +++ b/src/test/ui/generic/generic-arg-mismatch-recover.rs @@ -0,0 +1,21 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo<'a, T: 'a>(&'a T); + +struct Bar<'a>(&'a ()); + +fn main() { + Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments + //~^ ERROR mismatched types + + Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments + //~^ ERROR wrong number of type arguments +} diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.stderr b/src/test/ui/generic/generic-arg-mismatch-recover.stderr new file mode 100644 index 00000000000..81869ad0d08 --- /dev/null +++ b/src/test/ui/generic/generic-arg-mismatch-recover.stderr @@ -0,0 +1,31 @@ +error[E0088]: wrong number of lifetime arguments: expected 1, found 2 + --> $DIR/generic-arg-mismatch-recover.rs:16:20 + | +LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments + | ^^^^^^^ unexpected lifetime argument + +error[E0308]: mismatched types + --> $DIR/generic-arg-mismatch-recover.rs:16:33 + | +LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments + | ^^ expected (), found integral variable + | + = note: expected type `&'static ()` + found type `&{integer}` + +error[E0088]: wrong number of lifetime arguments: expected 1, found 2 + --> $DIR/generic-arg-mismatch-recover.rs:19:20 + | +LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments + | ^^^^^^^ unexpected lifetime argument + +error[E0087]: wrong number of type arguments: expected 0, found 1 + --> $DIR/generic-arg-mismatch-recover.rs:19:29 + | +LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments + | ^^ unexpected type argument + +error: aborting due to 4 previous errors + +Some errors occurred: E0087, E0088, E0308. +For more information about an error, try `rustc --explain E0087`. |
