diff options
| author | bors <bors@rust-lang.org> | 2014-07-03 21:46:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-03 21:46:47 +0000 |
| commit | 5d5c20647f45f2eb74f337e5434bbe63b0c43345 (patch) | |
| tree | 155aab01cbadfe647f739c31ce46b29b792ea7ae /src/test | |
| parent | dd812ccbb56193c36819993dea25912788b447f0 (diff) | |
| parent | 9bd6479912990046947913f160f69bc550dd3817 (diff) | |
| download | rust-5d5c20647f45f2eb74f337e5434bbe63b0c43345.tar.gz rust-5d5c20647f45f2eb74f337e5434bbe63b0c43345.zip | |
auto merge of #15377 : alexcrichton/rust/rollup, r=alexcrichton
Closes #15276 (Guide: if) Closes #15280 (std::os - Add join_paths, make setenv non-utf8 capable) Closes #15314 (Guide: functions) Closes #15327 (Simplify PatIdent to contain an Ident rather than a Path) Closes #15340 (Guide: add mutable binding section) Closes #15342 (Fix ICE with nested macro_rules!-style macros) Closes #15350 (Remove duplicated slash in install script path) Closes #15351 (correct a few spelling mistakes in the tutorial) Closes #15352 (librustc: Have the kind checker check sub-bounds in trait casts.) Closes #15359 (Fix spelling errors.) Closes #15361 (Rename set_broadast() to set_broadcast().) Closes #15366 (Simplify creating a parser from a token tree) Closes #15367 (Add examples for StrVector methods) Closes #15372 (Vec::grow should use reserve_additional, Vec::reserve should check against capacity) Closes #15373 (Fix minor issues in the documentation of libtime.)
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/issue-10536.rs | 34 | ||||
| -rw-r--r-- | src/test/compile-fail/kindck-impl-type-params.rs | 39 |
2 files changed, 73 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-10536.rs b/src/test/compile-fail/issue-10536.rs new file mode 100644 index 00000000000..36afc729de9 --- /dev/null +++ b/src/test/compile-fail/issue-10536.rs @@ -0,0 +1,34 @@ +// 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. + +// We only want to assert that this doesn't ICE, we don't particularly care +// about whether it nor it fails to compile. + +// error-pattern: + +#![feature(macro_rules)] + +macro_rules! foo{ + () => {{ + macro_rules! bar{() => (())} + 1 + }} +} + +pub fn main() { + foo!(); + + assert!({one! two()}); + + // regardless of whether nested macro_rules works, the following should at + // least throw a conventional error. + assert!({one! two}); +} + diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/compile-fail/kindck-impl-type-params.rs new file mode 100644 index 00000000000..48e1bdd671a --- /dev/null +++ b/src/test/compile-fail/kindck-impl-type-params.rs @@ -0,0 +1,39 @@ +// Copyright 2012 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. + +// Issue #14061: tests the interaction between generic implementation +// parameter bounds and trait objects. + +struct S<T>; + +trait Gettable<T> {} + +impl<T: Send + Copy> Gettable<T> for S<T> {} + +fn f<T>(val: T) { + let t: S<T> = S; + let a = &t as &Gettable<T>; + //~^ ERROR instantiating a type parameter with an incompatible type `T` + let a: &Gettable<T> = &t; + //~^ ERROR instantiating a type parameter with an incompatible type `T` +} + +fn main() { + let t: S<&int> = S; + let a = &t as &Gettable<&int>; + //~^ ERROR instantiating a type parameter with an incompatible type `&int` + let t: Box<S<String>> = box S; + let a = t as Box<Gettable<String>>; + //~^ ERROR instantiating a type parameter with an incompatible type + let t: Box<S<String>> = box S; + let a: Box<Gettable<String>> = t; + //~^ ERROR instantiating a type parameter with an incompatible type +} + |
