about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2016-07-29 16:49:26 -0400
committerNiko Matsakis <niko@alum.mit.edu>2016-08-02 05:31:25 -0400
commitc56eb4b7f5206f157aa200e8424f697791990d27 (patch)
tree0969dd346e106fc0ac6d0807a886f44133c297ed /src/test
parent9294f8ed0a053af18be8247ef589bc16775bd038 (diff)
downloadrust-c56eb4b7f5206f157aa200e8424f697791990d27.tar.gz
rust-c56eb4b7f5206f157aa200e8424f697791990d27.zip
remap Hir(InlinedDefId) to MetaData(OriginalDefId)
The way we do HIR inlining introduces reads of the "Hir" into the graph,
but this Hir in fact belongs to other crates, so when we try to load
later, we ICE because the Hir nodes in question don't belond to the
crate (and we haven't done inlining yet). This pass rewrites those HIR
nodes to the metadata from which the inlined HIR was loaded.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/inlined_hir_34991/main.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/incremental/inlined_hir_34991/main.rs b/src/test/incremental/inlined_hir_34991/main.rs
new file mode 100644
index 00000000000..a150a8c4df7
--- /dev/null
+++ b/src/test/incremental/inlined_hir_34991/main.rs
@@ -0,0 +1,33 @@
+// 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.
+
+// Regression test for #34991: an ICE occurred here because we inline
+// some of the vector routines and give them a local def-id `X`. This
+// got hashed after trans (`Hir(X)`). When we load back up, we get an
+// error because the `X` is remapped to the original def-id (in
+// libstd), and we can't hash a HIR node from std.
+
+// revisions:rpass1 rpass2
+
+#![feature(rustc_attrs)]
+
+use std::vec::Vec;
+
+pub fn foo() -> Vec<i32> {
+    vec![1, 2, 3]
+}
+
+pub fn bar() {
+    foo();
+}
+
+pub fn main() {
+    bar();
+}