summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_save_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_save_analysis/src/lib.rs')
-rw-r--r--compiler/rustc_save_analysis/src/lib.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs
index d0155c908..7735c5713 100644
--- a/compiler/rustc_save_analysis/src/lib.rs
+++ b/compiler/rustc_save_analysis/src/lib.rs
@@ -94,8 +94,8 @@ impl<'tcx> SaveContext<'tcx> {
}
}
- // Returns path to the compilation output (e.g., libfoo-12345678.rmeta)
- pub fn compilation_output(&self, crate_name: &str) -> PathBuf {
+ /// Returns path to the compilation output (e.g., libfoo-12345678.rmeta)
+ pub fn compilation_output(&self, crate_name: Symbol) -> PathBuf {
let sess = &self.tcx.sess;
// Save-analysis is emitted per whole session, not per each crate type
let crate_type = sess.crate_types()[0];
@@ -112,7 +112,7 @@ impl<'tcx> SaveContext<'tcx> {
}
}
- // List external crates used by the current crate.
+ /// List external crates used by the current crate.
pub fn get_external_crates(&self) -> Vec<ExternalCrateData> {
let mut result = Vec::with_capacity(self.tcx.crates(()).len());
@@ -319,7 +319,7 @@ impl<'tcx> SaveContext<'tcx> {
qualname,
value,
parent: None,
- children: def.variants.iter().map(|v| id_from_hir_id(v.id, self)).collect(),
+ children: def.variants.iter().map(|v| id_from_hir_id(v.hir_id, self)).collect(),
decl_id: None,
docs: self.docs_for_attrs(attrs),
sig: sig::item_signature(item, self),
@@ -594,7 +594,9 @@ impl<'tcx> SaveContext<'tcx> {
match self.tcx.hir().get(hir_id) {
Node::TraitRef(tr) => tr.path.res,
- Node::Item(&hir::Item { kind: hir::ItemKind::Use(path, _), .. }) => path.res,
+ Node::Item(&hir::Item { kind: hir::ItemKind::Use(path, _), .. }) => {
+ path.res.get(0).copied().unwrap_or(Res::Err)
+ }
Node::PathSegment(seg) => {
if seg.res != Res::Err {
seg.res
@@ -892,8 +894,8 @@ pub struct DumpHandler<'a> {
}
impl<'a> DumpHandler<'a> {
- pub fn new(odir: Option<&'a Path>, cratename: &str) -> DumpHandler<'a> {
- DumpHandler { odir, cratename: cratename.to_owned() }
+ pub fn new(odir: Option<&'a Path>, cratename: Symbol) -> DumpHandler<'a> {
+ DumpHandler { odir, cratename: cratename.to_string() }
}
fn output_file(&self, ctx: &SaveContext<'_>) -> (BufWriter<File>, PathBuf) {
@@ -958,7 +960,7 @@ impl SaveHandler for CallbackHandler<'_> {
pub fn process_crate<'l, 'tcx, H: SaveHandler>(
tcx: TyCtxt<'tcx>,
- cratename: &str,
+ cratename: Symbol,
input: &'l Input,
config: Option<Config>,
mut handler: H,