Adjust run pass test to stricter existential type rules
This commit is contained in:
parent
f3b4492985
commit
442d5d83e2
|
@ -75,10 +75,10 @@ fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
|
|||
}
|
||||
|
||||
trait Trait {}
|
||||
existential type GenericBound<T: Trait>: 'static;
|
||||
existential type GenericBound<'a, T: Trait>: 'a;
|
||||
|
||||
fn generic_bound<T: Trait>(_: T) -> GenericBound<T> {
|
||||
unimplemented!()
|
||||
fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
|
||||
t
|
||||
}
|
||||
|
||||
mod pass_through {
|
||||
|
@ -92,22 +92,3 @@ mod pass_through {
|
|||
fn use_passthrough(x: pass_through::Passthrough<u32>) -> pass_through::Passthrough<u32> {
|
||||
x
|
||||
}
|
||||
|
||||
existential type PartiallyDefined<T>: 'static;
|
||||
|
||||
// doesn't declare all PartiallyDefined for all possible `T`, but since it's the only
|
||||
// function producing the value, noone can ever get a value that is problematic
|
||||
fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
|
||||
4u32
|
||||
}
|
||||
|
||||
existential type PartiallyDefined2<T>: 'static;
|
||||
|
||||
fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
|
||||
4u32
|
||||
}
|
||||
|
||||
// fully defines PartiallyDefine2
|
||||
fn partially_defined22<T>(_: T) -> PartiallyDefined2<T> {
|
||||
4u32
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// 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.
|
||||
|
||||
#![feature(existential_type)]
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
||||
existential type PartiallyDefined<T>: 'static; //~ `T` is unused
|
||||
|
||||
fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
|
||||
4u32
|
||||
}
|
||||
|
||||
existential type PartiallyDefined2<T>: 'static; //~ `T` is unused
|
||||
|
||||
fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
|
||||
4u32
|
||||
}
|
||||
|
||||
fn partially_defined22<T>(_: T) -> PartiallyDefined2<T> {
|
||||
4u32
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
error[E0091]: type parameter `T` is unused
|
||||
--> $DIR/unused_generic_param.rs:16:35
|
||||
|
|
||||
LL | existential type PartiallyDefined<T>: 'static; //~ `T` is unused
|
||||
| ^ unused type parameter
|
||||
|
||||
error[E0091]: type parameter `T` is unused
|
||||
--> $DIR/unused_generic_param.rs:22:36
|
||||
|
|
||||
LL | existential type PartiallyDefined2<T>: 'static; //~ `T` is unused
|
||||
| ^ unused type parameter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0091`.
|
Loading…
Reference in New Issue