File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed
test/incremental/remove-private-item-cross-crate Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change @@ -425,13 +425,21 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
425425 /// parent `DefId` as well as some idea of what kind of data the
426426 /// `DefId` refers to.
427427 fn def_key ( & self , def : DefId ) -> hir_map:: DefKey {
428- self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
428+ // Note: loading the def-key (or def-path) for a def-id is not
429+ // a *read* of its metadata. This is because the def-id is
430+ // really just an interned shorthand for a def-path, which is the
431+ // canonical name for an item.
432+ //
433+ // self.dep_graph.read(DepNode::MetaData(def));
429434 let cdata = self . get_crate_data ( def. krate ) ;
430435 decoder:: def_key ( & cdata, def. index )
431436 }
432437
433438 fn relative_def_path ( & self , def : DefId ) -> hir_map:: DefPath {
434- self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
439+ // See `Note` above in `def_key()` for why this read is
440+ // commented out:
441+ //
442+ // self.dep_graph.read(DepNode::MetaData(def));
435443 let cdata = self . get_crate_data ( def. krate ) ;
436444 decoder:: def_path ( & cdata, def. index )
437445 }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 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+ #![ allow( warnings) ]
12+ #![ crate_name = "a" ]
13+ #![ crate_type = "rlib" ]
14+
15+ pub fn foo ( b : u8 ) -> u32 { b as u32 }
16+
17+ #[ cfg( rpass1) ]
18+ fn bar ( ) { }
Original file line number Diff line number Diff line change 1+ // Copyright 2016 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+ // Test that we are able to reuse `main` even though a private
12+ // item was removed from the root module of crate`a`.
13+
14+ // revisions:rpass1 rpass2
15+ // aux-build:a.rs
16+
17+ #![ feature( rustc_attrs) ]
18+ #![ crate_type = "bin" ]
19+ #![ rustc_partition_reused( module="main" , cfg="rpass2" ) ]
20+
21+ extern crate a;
22+
23+ pub fn main ( ) {
24+ let vec: Vec < u8 > = vec ! [ 0 , 1 , 2 , 3 ] ;
25+ for & b in & vec {
26+ println ! ( "{}" , a:: foo( b) ) ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments