From 03652157f9da55ea58debabe22bb7105ef8ebdf7 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Sun, 31 Jul 2016 00:58:30 +0900 Subject: Suppress unused type parameter error when type has error field --- src/test/compile-fail/issue-35075.rs | 19 +++++++++++++++++++ .../resolve-type-param-in-item-in-trait.rs | 11 ++++------- 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 src/test/compile-fail/issue-35075.rs (limited to 'src/test') diff --git a/src/test/compile-fail/issue-35075.rs b/src/test/compile-fail/issue-35075.rs new file mode 100644 index 00000000000..a70452dcbd0 --- /dev/null +++ b/src/test/compile-fail/issue-35075.rs @@ -0,0 +1,19 @@ +// Copyright 2016 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Bar { + inner: Foo //~ ERROR type name `Foo` is undefined or not in scope +} + +enum Baz { + Foo(Foo) //~ ERROR type name `Foo` is undefined or not in scope +} + +fn main() {} diff --git a/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs b/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs index 30ff1ed0e26..a1572b85666 100644 --- a/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs +++ b/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs @@ -13,9 +13,8 @@ // scope (in this case, the enum). trait TraitA { - fn outer(self) { + fn outer(&self) { enum Foo { - //~^ ERROR parameter `B` is never used Variance(A) //~^ ERROR can't use type parameters from outer function } @@ -23,23 +22,21 @@ trait TraitA { } trait TraitB { - fn outer(self) { + fn outer(&self) { struct Foo(A); //~^ ERROR can't use type parameters from outer function - //~^^ ERROR parameter `B` is never used } } trait TraitC { - fn outer(self) { + fn outer(&self) { struct Foo { a: A } //~^ ERROR can't use type parameters from outer function - //~^^ ERROR parameter `B` is never used } } trait TraitD { - fn outer(self) { + fn outer(&self) { fn foo(a: A) { } //~^ ERROR can't use type parameters from outer function } -- cgit 1.4.1-3-g733a5