Skip to content

Commit dbc0cd9

Browse files
committed
rustc_resolve: record single-segment extern crate import resolutions.
1 parent f898179 commit dbc0cd9

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/librustc_resolve/resolve_imports.rs

+2
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
677677
expansion: directive.expansion,
678678
});
679679
let _ = self.try_define(directive.parent, target, TypeNS, binding);
680+
let import = self.import_map.entry(directive.id).or_default();
681+
import[TypeNS] = Some(PathResolution::new(binding.def()));
680682
return None;
681683
}
682684
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018 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+
#![crate_type = "lib"]
12+
#![unstable(feature = "issue_52489_unstable", issue = "0")]
13+
#![feature(staged_api)]

src/test/compile-fail/issue-52489.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2018 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+
// edition:2018
12+
// aux-build:issue-52489.rs
13+
14+
use issue_52489;
15+
//~^ ERROR use of unstable library feature 'issue_52489_unstable'
16+
17+
fn main() {}

0 commit comments

Comments
 (0)