toplevel
.insert_or_error_out (declared_name,
path.get_locus (), import_id, definition.second /* TODO: This isn't clear - it would be better if it was called .ns or something */);
+
+ // Map the import to the glob container if it exists - this is important
+ // for 2-stepped glob imports which refer to glob containers, e.g.
+ //
+ // enum Foo { ... }
+ // pub use Foo;
+ // use self::Foo::*;
+ auto &mappings = Analysis::Mappings::get ();
+ if (auto container
+ = mappings.lookup_glob_container (definition.first.get_node_id ()))
+ mappings.insert_glob_container (import_id, container.value ());
}
}
auto inserted = resolved_nodes.emplace (usage, definition).second;
// is that valid?
- rust_assert (inserted);
+ // rust_assert (inserted);
}
tl::optional<NodeId>
.lookup_glob_container (rib_lookup->get_node_id ())
.has_value ())
{
- child
- = stack.dfs_node (stack.root, rib_lookup->get_node_id ())
- .value ();
+ auto leaf_module
+ = find_leaf_definition (rib_lookup->get_node_id ())
+ .value ()
+ .id;
+
+ child = stack.dfs_node (stack.root, leaf_module).value ();
break;
}
else
insert_segment_resolution (Usage (seg.node_id),
Definition (
rib_lookup->get_node_id ()));
+
return tl::nullopt;
}
}
--- /dev/null
+#![feature(no_core)]
+#![no_core]
+
+mod inner {
+ mod intrinsics {
+ pub fn unchecked_shl() {}
+ pub fn unchecked_snl() {}
+ pub fn unchecked_adult_swim() {}
+ }
+}
+
+use inner::intrinsics::{self, unchecked_snl};
+
+fn foo() /* { dg-warning "never used" } */
+{
+ use intrinsics::{unchecked_adult_swim, unchecked_shl};
+}
--- /dev/null
+#![feature(no_core)]
+#![no_core]
+
+mod inner {
+ pub mod error {
+ pub enum IntErrorKind {
+ A,
+ B,
+ C,
+ }
+ }
+}
+
+pub use inner::error::IntErrorKind;
+
+fn foo() /* { dg-warning "never used" } */
+{
+ use self::IntErrorKind::*;
+
+ let _ = A;
+ let _ = IntErrorKind::B;
+}