Skip to content

Commit af12be2

Browse files
Rollup merge of #52930 - eddyb:issue-52489, r=cramertj
rustc_resolve: record single-segment extern crate import resolutions. Fixes #52489 by recording special-cased single-segment imports for later (e.g. stability) checks. cc @alexcrichton @Mark-Simulacrum @petrochenkov Does this need to be backported?
2 parents 25c59e5 + dbc0cd9 commit af12be2

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
@@ -691,6 +691,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
691691
expansion: directive.expansion,
692692
});
693693
let _ = self.try_define(directive.parent, target, TypeNS, binding);
694+
let import = self.import_map.entry(directive.id).or_default();
695+
import[TypeNS] = Some(PathResolution::new(binding.def()));
694696
return None;
695697
}
696698
}
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)