diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-03-25 10:42:38 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-03-26 17:52:38 -0400 |
| commit | c59fe8bde2be55c46f627277e2cc37515fb7165e (patch) | |
| tree | 440adc716ee92dbd5a24e1ce76f3e2305725d256 /src/test | |
| parent | 9c9bb9ce1d51e2a9ca4963bd418e365b6e17fbfa (diff) | |
| download | rust-c59fe8bde2be55c46f627277e2cc37515fb7165e.tar.gz rust-c59fe8bde2be55c46f627277e2cc37515fb7165e.zip | |
Drive-by fix for incorrect variance rule that I noticed.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/variance-region-bounds.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/compile-fail/variance-region-bounds.rs b/src/test/compile-fail/variance-region-bounds.rs new file mode 100644 index 00000000000..96ae201f6ae --- /dev/null +++ b/src/test/compile-fail/variance-region-bounds.rs @@ -0,0 +1,25 @@ +// Copyright 2014 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. + +// Check that `T:'a` is contravariant in T. + +#![feature(rustc_attrs)] + +#[rustc_variance] +trait Foo: 'static { //~ ERROR types=[[];[-];[]] +} + +#[rustc_variance] +trait Bar<T> { //~ ERROR types=[[+];[-];[]] + fn do_it(&self) + where T: 'static; +} + +fn main() { } |
