Skip to content

Commit

Permalink
Fix rustdoc ICE.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Dec 23, 2016
1 parent c217ab6 commit 1187e21
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ impl<'a, 'tcx> CrateMetadata {
let filter = match filter.map(|def_id| self.reverse_translate_def_id(def_id)) {
Some(Some(def_id)) => Some((def_id.krate.as_u32(), def_id.index)),
Some(None) => return,
None if self.proc_macros.is_some() => return,
None => None,
};

Expand Down
5 changes: 5 additions & 0 deletions src/test/run-make/issue-38237/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-include ../tools.mk

all:
$(RUSTC) foo.rs; $(RUSTC) bar.rs
$(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR)
14 changes: 14 additions & 0 deletions src/test/run-make/issue-38237/bar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![crate_type = "lib"]

#[derive(Debug)]
pub struct S;
18 changes: 18 additions & 0 deletions src/test/run-make/issue-38237/baz.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

extern crate foo;
extern crate bar;

pub struct Bar;
impl ::std::ops::Deref for Bar {
type Target = bar::S;
fn deref(&self) -> &Self::Target { unimplemented!() }
}
20 changes: 20 additions & 0 deletions src/test/run-make/issue-38237/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![crate_type = "proc-macro"]
#![feature(proc_macro, proc_macro_lib)]

extern crate proc_macro;

#[proc_macro_derive(A)]
pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts }

#[derive(Debug)]
struct S;

0 comments on commit 1187e21

Please sign in to comment.