Move def id collection and extern crate handling to before AST->HIR lowering r? @jseyfried, @eddyb, or @nikomatsakis