Skip to content

Commit ad11d4b

Browse files
committed
WIP Trying to investiate issue rust-lang#10031. Adding mucho debug instrumentation.
modmin.rs: #[crate_id = "min#0.1"]; #[cfg(not(nontuple))] pub struct Wrap<A>(A); #[cfg(nontuple)] pub struct Wrap<A>{ a: A } #[cfg(nontuple)] pub fn Wrap<A>(a: A) -> Wrap<A> { Wrap{ a: a } } test.rs: extern mod min; fn main() { let _x: min::Wrap<()> = min::Wrap(()); } Makefile: default: test RUSTC=rustc TEMP_FILE=$(mktmp -t deps) TEMP_FILE=/tmp/foo define DEPS_ON_RUSTC # $(1) rustc args # $(2) output variable $(2) = $(shell TMP=$(TEMP_FILE) $(RUSTC) --dep-info $TMP --no-analysis $(1) ; sed -e s'/^[^:]*://' $TMP ) endef define FILENAME_ON_RUSTC # $(1) rustc args # $(2) output variable $(2) := $(shell $(RUSTC) --crate-file-name $(1)) endef LIBMOD_FLAGS=--lib modmin.rs $(eval $(call FILENAME_ON_RUSTC, $(LIBMOD_FLAGS), LIBMOD)) $(eval $(call DEPS_ON_RUSTC, $(LIBMOD_FLAGS), LIBMOD_DEPS)) $(LIBMOD): $(LIBMOD_DEPS) $(RUSTC) $(LIBMOD_FLAGS) TEST_FLAGS=--test test.rs $(eval $(call FILENAME_ON_RUSTC, $(TEST_FLAGS), TEST)) $(eval $(call DEPS_ON_RUSTC, $(TEST_FLAGS), TEST_DEPS)) $(TEST): $(TEST_DEPS) $(LIBMOD) $(RUSTC) -L. $(TEST_FLAGS) clean: rm -f $(LIBMOD) $(TEST)
1 parent 6f3326f commit ad11d4b

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
13771377
let mut ty_param_defs = dcx.tcx
13781378
.ty_param_defs
13791379
.borrow_mut();
1380-
ty_param_defs.get().insert(id, bounds);
1380+
ty_param_defs.get().insert(id, bounds); // XXX
13811381
}
13821382
c::tag_table_method_map => {
13831383
let entry = val_dsr.read_method_map_entry(xcx);

src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3819,7 +3819,8 @@ pub fn instantiate_path(fcx: @FnCtxt,
38193819
ty_substs_len += segment.types.len()
38203820
}
38213821

3822-
debug!("tpt={} ty_param_count={:?} ty_substs_len={:?}",
3822+
debug!("pth={} tpt={} ty_param_count={:?} ty_substs_len={:?}",
3823+
pth.repr(fcx.tcx()),
38233824
tpt.repr(fcx.tcx()),
38243825
ty_param_count,
38253826
ty_substs_len);

src/librustc/middle/typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
966966
let mut ty_param_defs = ccx.tcx
967967
.ty_param_defs
968968
.borrow_mut();
969-
ty_param_defs.get().insert(param.id, def);
969+
ty_param_defs.get().insert(param.id, def); // XXX
970970
def
971971
}
972972
}

src/librustc/util/ppaux.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str {
478478
Some(def) => cx.sess.str_of(def.ident).to_owned(),
479479
None => {
480480
// This should not happen...
481-
format!("BUG[{:?}]", id)
481+
format!("BUG[{:?};({},{})]", id, did.crate, did.node)
482482
}
483483
};
484484
if !cx.sess.verbose() { ident } else { format!("{}:{:?}", ident, did) }
@@ -686,6 +686,23 @@ impl Repr for ast::Pat {
686686
}
687687
}
688688

689+
impl Repr for ast::Path {
690+
fn repr(&self, tcx: ctxt) -> ~str {
691+
format!("Path({}, {})",
692+
if self.global { "global" } else { "local" },
693+
self.segments.repr(tcx))
694+
}
695+
}
696+
697+
impl Repr for ast::PathSegment {
698+
fn repr(&self, tcx: ctxt) -> ~str {
699+
format!("PathSegment({}, {}, {})",
700+
self.identifier.repr(tcx),
701+
self.lifetimes.repr(tcx),
702+
self.types.repr(tcx))
703+
}
704+
}
705+
689706
impl Repr for ty::BoundRegion {
690707
fn repr(&self, tcx: ctxt) -> ~str {
691708
match *self {

0 commit comments

Comments
 (0)