Remove effect of #[no_link]
attribute on name resolution
Previously it hid all non-macro names from other crates. This has no relation to linking and can change name resolution behavior in some cases (e.g. glob conflicts), in addition to just producing the "unresolved name" errors
This commit is contained in:
parent
16d8a91d51
commit
54cd824819
@ -1099,10 +1099,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
};
|
||||
|
||||
// Iterate over all children.
|
||||
let macros_only = self.dep_kind.lock().macros_only();
|
||||
if !macros_only {
|
||||
let children = self.root.tables.children.get(self, id).unwrap_or_else(Lazy::empty);
|
||||
|
||||
if let Some(children) = self.root.tables.children.get(self, id) {
|
||||
for child_index in children.decode((self, sess)) {
|
||||
// Get the item.
|
||||
let child_kind = match self.maybe_kind(child_index) {
|
||||
@ -1200,11 +1197,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
|
||||
if let EntryKind::Mod(exports) = kind {
|
||||
for exp in exports.decode((self, sess)) {
|
||||
match exp.res {
|
||||
Res::Def(DefKind::Macro(..), _) => {}
|
||||
_ if macros_only => continue,
|
||||
_ => {}
|
||||
}
|
||||
callback(exp);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
// check-pass
|
||||
// aux-build:empty-struct.rs
|
||||
|
||||
#[no_link]
|
||||
extern crate empty_struct;
|
||||
|
||||
fn main() {
|
||||
empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in crate `empty_struct`
|
||||
empty_struct::XEmpty1 {};
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
error[E0425]: cannot find value `XEmpty1` in crate `empty_struct`
|
||||
--> $DIR/no-link.rs:7:19
|
||||
|
|
||||
LL | empty_struct::XEmpty1;
|
||||
| ^^^^^^^ not found in `empty_struct`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
Loading…
x
Reference in New Issue
Block a user