about summary refs log tree commit diff
path: root/src/test/run-pass
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-04-07 09:20:06 -0400
committerGitHub <noreply@github.com>2017-04-07 09:20:06 -0400
commit996f06fe3597eeb2c671a34cf16d2b29aec961e7 (patch)
tree76779c17044b0b566c2073bf71989a05153ca538 /src/test/run-pass
parent88e97f05412e71cde26b1da0c1d33a4818d27286 (diff)
parent60381cd9c29c51615975894e898b47da65f0b124 (diff)
downloadrust-996f06fe3597eeb2c671a34cf16d2b29aec961e7.tar.gz
rust-996f06fe3597eeb2c671a34cf16d2b29aec961e7.zip
Rollup merge of #41061 - arielb1:parent-lock, r=eddyb
cstore: return an immutable borrow from `visible_parent_map`

This prevents an ICE when `visible_parent_map` is called multiple times, for example when an item referenced in an impl signature is imported from an  `extern crate` statement occurs within an impl.

Fixes #41053.

r? @eddyb
Diffstat (limited to 'src/test/run-pass')
-rw-r--r--src/test/run-pass/auxiliary/issue_41053.rs11
-rw-r--r--src/test/run-pass/issue-41053.rs30
2 files changed, 41 insertions, 0 deletions
diff --git a/src/test/run-pass/auxiliary/issue_41053.rs b/src/test/run-pass/auxiliary/issue_41053.rs
new file mode 100644
index 00000000000..68e92b10429
--- /dev/null
+++ b/src/test/run-pass/auxiliary/issue_41053.rs
@@ -0,0 +1,11 @@
+// Copyright 2017 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.
+
+pub struct Test;
diff --git a/src/test/run-pass/issue-41053.rs b/src/test/run-pass/issue-41053.rs
new file mode 100644
index 00000000000..769d841e364
--- /dev/null
+++ b/src/test/run-pass/issue-41053.rs
@@ -0,0 +1,30 @@
+// Copyright 2017 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.
+
+// aux-build:issue_41053.rs
+
+pub trait Trait { fn foo(&self) {} }
+
+pub struct Foo;
+
+impl Iterator for Foo {
+    type Item = Box<Trait>;
+    fn next(&mut self) -> Option<Box<Trait>> {
+        extern crate issue_41053;
+        impl ::Trait for issue_41053::Test {
+            fn foo(&self) {}
+        }
+        Some(Box::new(issue_41053::Test))
+    }
+}
+
+fn main() {
+    Foo.next().unwrap().foo();
+}