about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-10 19:52:04 +0000
committerbors <bors@rust-lang.org>2015-02-10 19:52:04 +0000
commitbc87efef2cceaec99d30e809cac2b8d22b9e25fc (patch)
tree1f59e50bc58a426615cc15594cade8b69f24bdbf /src/test
parent88d8ba5ab3b1d22288b021708c3d87464e43b880 (diff)
parent3e10785e21b731d536cf9ad9b911e8261862bde7 (diff)
downloadrust-bc87efef2cceaec99d30e809cac2b8d22b9e25fc.tar.gz
rust-bc87efef2cceaec99d30e809cac2b8d22b9e25fc.zip
Auto merge of #22153 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/cfg-attr-cfg-2.rs18
-rw-r--r--src/test/compile-fail/cfg-attr-crate-2.rs17
-rw-r--r--src/test/compile-fail/functional-struct-update-respects-privacy.rs42
-rw-r--r--src/test/compile-fail/issue-17551.rs4
-rw-r--r--src/test/compile-fail/issue-17999.rs1
-rw-r--r--src/test/compile-fail/issue-20801.rs47
-rw-r--r--src/test/compile-fail/issue-2150.rs1
-rw-r--r--src/test/compile-fail/liveness-unused.rs1
-rw-r--r--src/test/compile-fail/reserved-become.rs (renamed from src/test/parse-fail/reserved-be.rs)6
-rw-r--r--src/test/run-make/c-link-to-rust-staticlib/Makefile4
-rw-r--r--src/test/run-make/duplicate-output-flavors/Makefile1
-rw-r--r--src/test/run-make/empty-file/Makefile5
-rw-r--r--src/test/run-make/empty-file/empty.rs0
-rw-r--r--src/test/run-make/issue-22131/Makefile7
-rw-r--r--src/test/run-make/issue-22131/foo.rs17
-rw-r--r--src/test/run-make/no-stack-check/Makefile5
-rw-r--r--src/test/run-make/symbols-are-reasonable/Makefile6
-rw-r--r--src/test/run-make/target-specs/Makefile4
-rw-r--r--src/test/run-make/use-extern-for-plugins/Makefile5
-rw-r--r--src/test/run-pass/cfg-attr-cfg.rs15
-rw-r--r--src/test/run-pass/cfg-attr-crate.rs15
-rw-r--r--src/test/run-pass/infer-container-across-object-cast.rs59
-rw-r--r--src/test/run-pass/unboxed-closures-infer-upvar.rs22
23 files changed, 286 insertions, 16 deletions
diff --git a/src/test/compile-fail/cfg-attr-cfg-2.rs b/src/test/compile-fail/cfg-attr-cfg-2.rs
new file mode 100644
index 00000000000..b71a3be5dce
--- /dev/null
+++ b/src/test/compile-fail/cfg-attr-cfg-2.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 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.
+//
+// error-pattern: main function not found
+// compile-flags: --cfg foo
+
+// main is conditionally compiled, but the conditional compilation
+// is conditional too!
+
+#[cfg_attr(foo, cfg(bar))]
+fn main() { }
diff --git a/src/test/compile-fail/cfg-attr-crate-2.rs b/src/test/compile-fail/cfg-attr-crate-2.rs
new file mode 100644
index 00000000000..4867dd8d0b4
--- /dev/null
+++ b/src/test/compile-fail/cfg-attr-crate-2.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 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.
+//
+// compile-flags: --cfg broken
+
+// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
+
+#![cfg_attr(broken, no_std)] //~ ERROR no_std is experimental
+
+fn main() { }
diff --git a/src/test/compile-fail/functional-struct-update-respects-privacy.rs b/src/test/compile-fail/functional-struct-update-respects-privacy.rs
new file mode 100644
index 00000000000..51e23a689a1
--- /dev/null
+++ b/src/test/compile-fail/functional-struct-update-respects-privacy.rs
@@ -0,0 +1,42 @@
+// Copyright 2015 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.
+
+// RFC 736 (and Issue 21407): functional struct update should respect privacy.
+
+// The `foo` module attempts to maintains an invariant that each `S`
+// has a unique `u64` id.
+use self::foo::S;
+mod foo {
+    use std::cell::{UnsafeCell};
+
+    static mut count : UnsafeCell<u64> = UnsafeCell { value: 1 };
+
+    pub struct S { pub a: u8, pub b: String, secret_uid: u64 }
+
+    pub fn make_secrets(a: u8, b: String) -> S {
+        let val = unsafe { let p = count.get(); let val = *p; *p = val + 1; val };
+        println!("creating {}, uid {}", b, val);
+        S { a: a, b: b, secret_uid: val }
+    }
+
+    impl Drop for S {
+        fn drop(&mut self) {
+            println!("dropping {}, uid {}", self.b, self.secret_uid);
+        }
+    }
+}
+
+fn main() {
+    let s_1 = foo::make_secrets(3, format!("ess one"));
+    let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ...
+    //~^ ERROR field `secret_uid` of struct `foo::S` is private
+    println!("main forged an S named: {}", s_2.b);
+    // at end of scope, ... both s_1 *and* s_2 get dropped.  Boom!
+}
diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs
index b19a7703b85..e037ba92b4a 100644
--- a/src/test/compile-fail/issue-17551.rs
+++ b/src/test/compile-fail/issue-17551.rs
@@ -13,6 +13,6 @@
 struct B<T>;
 
 fn main() {
-    let foo = B;
-    let closure = || foo; //~ ERROR unable to infer enough type information
+    let foo = B; //~ ERROR: unable to infer enough type information
+    let closure = || foo;
 }
diff --git a/src/test/compile-fail/issue-17999.rs b/src/test/compile-fail/issue-17999.rs
index f4c0a9c38c3..88945f80eae 100644
--- a/src/test/compile-fail/issue-17999.rs
+++ b/src/test/compile-fail/issue-17999.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 #![deny(unused_variables)]
-#![feature(core)]
 
 fn main() {
     for _ in 1..101 {
diff --git a/src/test/compile-fail/issue-20801.rs b/src/test/compile-fail/issue-20801.rs
new file mode 100644
index 00000000000..929c8ec0fd6
--- /dev/null
+++ b/src/test/compile-fail/issue-20801.rs
@@ -0,0 +1,47 @@
+// Copyright 2015 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 used to ICE when moving out of a `*mut T` or `*const T`.
+
+struct T(u8);
+
+static mut GLOBAL_MUT_T: T = T(0);
+
+static GLOBAL_T: T = T(0);
+
+fn imm_ref() -> &'static T {
+    unsafe { &GLOBAL_T }
+}
+
+fn mut_ref() -> &'static mut T {
+    unsafe { &mut GLOBAL_MUT_T }
+}
+
+fn mut_ptr() -> *mut T {
+    unsafe { 0u8 as *mut T }
+}
+
+fn const_ptr() -> *const T {
+    unsafe { 0u8 as *const T }
+}
+
+pub fn main() {
+    let a = unsafe { *mut_ref() };
+    //~^ ERROR cannot move out of borrowed content
+
+    let b = unsafe { *imm_ref() };
+    //~^ ERROR cannot move out of borrowed content
+
+    let c = unsafe { *mut_ptr() };
+    //~^ ERROR cannot move out of dereference of unsafe pointer
+
+    let d = unsafe { *const_ptr() };
+    //~^ ERROR cannot move out of dereference of unsafe pointer
+}
diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs
index a2711d532d2..79df16c8979 100644
--- a/src/test/compile-fail/issue-2150.rs
+++ b/src/test/compile-fail/issue-2150.rs
@@ -11,7 +11,6 @@
 #![deny(unreachable_code)]
 #![allow(unused_variables)]
 #![allow(dead_code)]
-#![feature(core)]
 
 fn fail_len(v: Vec<isize> ) -> usize {
     let mut i = 3;
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index d4238120d06..ac4b8a5f309 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -11,7 +11,6 @@
 #![deny(unused_variables)]
 #![deny(unused_assignments)]
 #![allow(dead_code, non_camel_case_types)]
-#![feature(core)]
 
 fn f1(x: isize) {
     //~^ ERROR unused variable: `x`
diff --git a/src/test/parse-fail/reserved-be.rs b/src/test/compile-fail/reserved-become.rs
index 386d53cc16e..82e9ebc10d1 100644
--- a/src/test/parse-fail/reserved-be.rs
+++ b/src/test/compile-fail/reserved-become.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -9,6 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    let be = 0;
-    //~^ ERROR `be` is a reserved keyword
+    let become = 0;
+    //~^ ERROR `become` is a reserved keyword
 }
diff --git a/src/test/run-make/c-link-to-rust-staticlib/Makefile b/src/test/run-make/c-link-to-rust-staticlib/Makefile
index 8a6d6e4dd6d..477b85f362a 100644
--- a/src/test/run-make/c-link-to-rust-staticlib/Makefile
+++ b/src/test/run-make/c-link-to-rust-staticlib/Makefile
@@ -1,9 +1,7 @@
 -include ../tools.mk
 
 ifndef IS_WINDOWS
-ifneq ($(shell uname),Darwin)
-	EXTRAFLAGS := -lm -lrt -ldl -lpthread
-endif
+EXTRAFLAGS := $(EXTRACFLAGS)
 endif
 
 # FIXME: ignore freebsd
diff --git a/src/test/run-make/duplicate-output-flavors/Makefile b/src/test/run-make/duplicate-output-flavors/Makefile
index d40b6862a01..e33279966c9 100644
--- a/src/test/run-make/duplicate-output-flavors/Makefile
+++ b/src/test/run-make/duplicate-output-flavors/Makefile
@@ -2,3 +2,4 @@ include ../tools.mk
 
 all:
 	$(RUSTC) --crate-type=rlib foo.rs
+	$(RUSTC) --crate-type=rlib,rlib foo.rs
diff --git a/src/test/run-make/empty-file/Makefile b/src/test/run-make/empty-file/Makefile
new file mode 100644
index 00000000000..f55a2cc3bb1
--- /dev/null
+++ b/src/test/run-make/empty-file/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) --emit=asm,llvm-bc,llvm-ir,obj,dep-info empty.rs
+	$(RUSTC) --emit=link --crate-type=rlib,dylib,staticlib empty.rs
diff --git a/src/test/run-make/empty-file/empty.rs b/src/test/run-make/empty-file/empty.rs
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/src/test/run-make/empty-file/empty.rs
diff --git a/src/test/run-make/issue-22131/Makefile b/src/test/run-make/issue-22131/Makefile
new file mode 100644
index 00000000000..0f927320c4e
--- /dev/null
+++ b/src/test/run-make/issue-22131/Makefile
@@ -0,0 +1,7 @@
+-include ../tools.mk
+
+all: foo.rs
+	$(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
+	$(HOST_RPATH_ENV) $(RUSTDOC) --test --cfg 'feature="bar"' \
+		-L $(TMPDIR) foo.rs |\
+		grep --quiet 'test foo_0 ... ok'
diff --git a/src/test/run-make/issue-22131/foo.rs b/src/test/run-make/issue-22131/foo.rs
new file mode 100644
index 00000000000..0b1f1291df0
--- /dev/null
+++ b/src/test/run-make/issue-22131/foo.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#![crate_name="foo"]
+
+/// ```rust
+/// assert_eq!(foo::foo(), 1);
+/// ```
+#[cfg(feature = "bar")]
+pub fn foo() -> i32 { 1 }
diff --git a/src/test/run-make/no-stack-check/Makefile b/src/test/run-make/no-stack-check/Makefile
index 561056d719e..5fce35e2beb 100644
--- a/src/test/run-make/no-stack-check/Makefile
+++ b/src/test/run-make/no-stack-check/Makefile
@@ -1,6 +1,7 @@
 -include ../tools.mk
 
 ifndef IS_WINDOWS
+ifneq ($(UNAME),OpenBSD)
 all:
 	$(RUSTC) -O --emit asm attr.rs
 	! grep -q morestack $(TMPDIR)/attr.s
@@ -9,6 +10,10 @@ all:
 	$(RUSTC) -O --emit asm -C no-stack-check flag.rs
 	! grep -q morestack $(TMPDIR)/flag.s
 else
+# On OpenBSD, morestack isn't used as the segmented stacks are disabled
+all:
+endif
+else
 # On Windows we use __chkstk and it only appears in functions with large allocations,
 # so this test wouldn't be reliable.
 all:
diff --git a/src/test/run-make/symbols-are-reasonable/Makefile b/src/test/run-make/symbols-are-reasonable/Makefile
index 42a72f7ca39..89f610dee17 100644
--- a/src/test/run-make/symbols-are-reasonable/Makefile
+++ b/src/test/run-make/symbols-are-reasonable/Makefile
@@ -10,6 +10,6 @@ OUT=$(TMPDIR)/lib.s
 all:
 	$(RUSTC) lib.rs --emit=asm --crate-type=staticlib
 	# just check for symbol declarations with the names we're expecting.
-	grep 'str[0-9]\+:' $(OUT)
-	grep 'binary[0-9]\+:' $(OUT)
-	grep 'vtable[0-9]\+' $(OUT)
+	grep 'str[0-9][0-9]*:' $(OUT)
+	grep 'binary[0-9][0-9]*:' $(OUT)
+	grep 'vtable[0-9][0-9]*' $(OUT)
diff --git a/src/test/run-make/target-specs/Makefile b/src/test/run-make/target-specs/Makefile
index a352bc3a8cc..db2b253a6f1 100644
--- a/src/test/run-make/target-specs/Makefile
+++ b/src/test/run-make/target-specs/Makefile
@@ -1,11 +1,11 @@
 -include ../tools.mk
 all:
 	$(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm
-	grep --quiet --invert-match morestack < $(TMPDIR)/foo.s
+	grep -q -v morestack < $(TMPDIR)/foo.s
 	$(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | grep --quiet "Error loading target specification"
 	$(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | grep 'Field llvm-target'
 	RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm
 	RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=x86_64-unknown-linux-gnu --crate-type=lib --emit=asm
 	# The built-in target *should* override the one we have here, and thus we
 	# should have morestack
-	grep --quiet morestack < $(TMPDIR)/foo.s
+	grep -q morestack < $(TMPDIR)/foo.s
diff --git a/src/test/run-make/use-extern-for-plugins/Makefile b/src/test/run-make/use-extern-for-plugins/Makefile
index 84032b45159..bdce7b7810a 100644
--- a/src/test/run-make/use-extern-for-plugins/Makefile
+++ b/src/test/run-make/use-extern-for-plugins/Makefile
@@ -1,5 +1,6 @@
 -include ../tools.mk
 
+ifneq ($(UNAME),OpenBSD)
 HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //')
 ifeq ($(findstring i686,$(HOST)),i686)
 TARGET := $(subst i686,x86_64,$(HOST))
@@ -11,3 +12,7 @@ all:
 	$(RUSTC) foo.rs -C extra-filename=-host
 	$(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET)
 	$(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET)
+else
+# OpenBSD support only x86_64 architecture for now
+all:
+endif
diff --git a/src/test/run-pass/cfg-attr-cfg.rs b/src/test/run-pass/cfg-attr-cfg.rs
new file mode 100644
index 00000000000..09ab7019486
--- /dev/null
+++ b/src/test/run-pass/cfg-attr-cfg.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 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.
+
+// main is conditionally compiled, but the conditional compilation
+// is conditional too!
+
+#[cfg_attr(foo, cfg(bar))]
+fn main() { }
diff --git a/src/test/run-pass/cfg-attr-crate.rs b/src/test/run-pass/cfg-attr-crate.rs
new file mode 100644
index 00000000000..e6bd8afad28
--- /dev/null
+++ b/src/test/run-pass/cfg-attr-crate.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 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.
+
+// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
+
+#![cfg_attr(not_used, no_std)]
+
+fn main() { }
diff --git a/src/test/run-pass/infer-container-across-object-cast.rs b/src/test/run-pass/infer-container-across-object-cast.rs
new file mode 100644
index 00000000000..979e76b1ff9
--- /dev/null
+++ b/src/test/run-pass/infer-container-across-object-cast.rs
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+// Given `<expr> as Box<Trait>`, we should be able to infer that a
+// `Box<_>` is the expected type.
+
+trait Foo { fn foo(&self) -> u32; }
+impl Foo for u32 { fn foo(&self) -> u32 { *self } }
+
+// (another impl to ensure trait-matching cannot just choose from a singleton set)
+impl Foo for  () { fn foo(&self) -> u32 { -176 } }
+
+trait Boxed { fn make() -> Self; }
+impl Boxed for Box<u32> { fn make() -> Self { Box::new(7) } }
+
+// (another impl to ensure trait-matching cannot just choose from a singleton set)
+impl Boxed for () { fn make() -> Self { () } }
+
+fn boxed_foo() {
+    let b7 = Boxed::make() as Box<Foo>;
+    assert_eq!(b7.foo(), 7);
+}
+
+trait Refed<'a,T> { fn make(&'a T) -> Self; }
+impl<'a> Refed<'a, u32> for &'a u32 { fn make(x: &'a u32) -> Self { x } }
+
+// (another impl to ensure trait-matching cannot just choose from a singleton set)
+impl<'a,'b> Refed<'a, ()> for &'b () { fn make(_: &'a ()) -> Self { static U: () = (); &U } }
+
+fn refed_foo() {
+    let a = 8;
+    let b7 = Refed::make(&a) as &Foo;
+    assert_eq!(b7.foo(), 8);
+}
+
+fn check_subtyping_works() {
+    fn inner<'short, 'long:'short>(_s: &'short u32,
+                                   l: &'long u32) -> &'short (Foo+'short) {
+        Refed::make(l) as &Foo
+    }
+
+    let a = 9;
+    let b = 10;
+    let r = inner(&b, &a);
+    assert_eq!(r.foo(), 9);
+}
+
+pub fn main() {
+    boxed_foo();
+    refed_foo();
+    check_subtyping_works();
+}
diff --git a/src/test/run-pass/unboxed-closures-infer-upvar.rs b/src/test/run-pass/unboxed-closures-infer-upvar.rs
new file mode 100644
index 00000000000..087ef5dcf05
--- /dev/null
+++ b/src/test/run-pass/unboxed-closures-infer-upvar.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 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.
+
+// Test that the type variable in the type(`Vec<_>`) of a closed over
+// variable does not interfere with type inference.
+
+fn f<F: FnMut()>(mut f: F) {
+    f();
+}
+
+fn main() {
+    let mut v: Vec<_> = vec![];
+    f(|| v.push(0));
+    assert_eq!(v, vec![0]);
+}