Suppress unused type parameter error when type has error field
This commit is contained in:
parent
7580534c3a
commit
03652157f9
4 changed files with 43 additions and 7 deletions
19
src/test/compile-fail/issue-35075.rs
Normal file
19
src/test/compile-fail/issue-35075.rs
Normal file
|
|
@ -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 <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 Bar<T> {
|
||||
inner: Foo<T> //~ ERROR type name `Foo` is undefined or not in scope
|
||||
}
|
||||
|
||||
enum Baz<T> {
|
||||
Foo(Foo<T>) //~ ERROR type name `Foo` is undefined or not in scope
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -13,9 +13,8 @@
|
|||
// scope (in this case, the enum).
|
||||
|
||||
trait TraitA<A> {
|
||||
fn outer(self) {
|
||||
fn outer(&self) {
|
||||
enum Foo<B> {
|
||||
//~^ ERROR parameter `B` is never used
|
||||
Variance(A)
|
||||
//~^ ERROR can't use type parameters from outer function
|
||||
}
|
||||
|
|
@ -23,23 +22,21 @@ trait TraitA<A> {
|
|||
}
|
||||
|
||||
trait TraitB<A> {
|
||||
fn outer(self) {
|
||||
fn outer(&self) {
|
||||
struct Foo<B>(A);
|
||||
//~^ ERROR can't use type parameters from outer function
|
||||
//~^^ ERROR parameter `B` is never used
|
||||
}
|
||||
}
|
||||
|
||||
trait TraitC<A> {
|
||||
fn outer(self) {
|
||||
fn outer(&self) {
|
||||
struct Foo<B> { a: A }
|
||||
//~^ ERROR can't use type parameters from outer function
|
||||
//~^^ ERROR parameter `B` is never used
|
||||
}
|
||||
}
|
||||
|
||||
trait TraitD<A> {
|
||||
fn outer(self) {
|
||||
fn outer(&self) {
|
||||
fn foo<B>(a: A) { }
|
||||
//~^ ERROR can't use type parameters from outer function
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue