]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/inlined_hir_34991/main.rs
remap Hir(InlinedDefId) to MetaData(OriginalDefId)
[rust.git] / src / test / incremental / inlined_hir_34991 / main.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Regression test for #34991: an ICE occurred here because we inline
12 // some of the vector routines and give them a local def-id `X`. This
13 // got hashed after trans (`Hir(X)`). When we load back up, we get an
14 // error because the `X` is remapped to the original def-id (in
15 // libstd), and we can't hash a HIR node from std.
16
17 // revisions:rpass1 rpass2
18
19 #![feature(rustc_attrs)]
20
21 use std::vec::Vec;
22
23 pub fn foo() -> Vec<i32> {
24     vec![1, 2, 3]
25 }
26
27 pub fn bar() {
28     foo();
29 }
30
31 pub fn main() {
32     bar();
33 }