Skip to content

ICE when trying to use associated type's Self::Output as default (nightly/beta) #25339

Closed
@Nercury

Description

@Nercury

This kind of code:

use std::marker::PhantomData;

pub trait Routing<I> {
    type Output;

    fn resolve(&self, input: I);
}

pub trait ToRouting {
    type Input;
    type Routing = Routing<Self::Input>;

    fn to_routing(self) -> Self::Routing;
}

pub struct Mount<I, R: Routing<I>> {
    action: R,
    _marker: PhantomData<I>,
}

impl<I, R: Routing<I>> Mount<I, R> {
    pub fn create<T: ToRouting<Routing=R>>(mount: &str, input: T) {
        input.to_routing();
    }
}

fn main() {

}

Produces this output:

thread 'rustc' panicked at 'path not fully resolved: PathResolution { base_def: DefSelfTy(Some(DefId { krate: 0, node: 17 }), None), last_private: LastMod(AllPublic), depth: 1 }', /home/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-linux/build/src/librustc/middle/def.rs:80

stack backtrace:
   1:     0x7fd5f5c01029 - sys::backtrace::write::hf53a0a0304290fee0Yr
   2:     0x7fd5f5c08cf6 - panicking::on_panic::h60c28f18db36901f8lw
   3:     0x7fd5f5bcc132 - rt::unwind::begin_unwind_inner::h5d1eccd17bdb1225i1v
   4:     0x7fd5f5bccddc - rt::unwind::begin_unwind_fmt::hb401ae9bbc90d7afWZv
   5:     0x7fd5f3a45c76 - middle::def::PathResolution::full_def::h1064d7767cb70c52vZl
   6:     0x7fd5f5075e1e - PrivacyVisitor<'a, 'tcx>::check_path::hc1d907c1eeb131a2X4a
   7:     0x7fd5f5076ea7 - PrivacyVisitor<'a, 'tcx>.Visitor<'v>::visit_path::h6d61d703c953fd3cctb
   8:     0x7fd5f5076fbf - visit::walk_path::h11482984534192114005
   9:     0x7fd5f5076d4f - PrivacyVisitor<'a, 'tcx>.Visitor<'v>::visit_item::h869cd287456a54ebxdb
  10:     0x7fd5f507d7cb - check_crate::h8a5c09d7eb2db25cEVb
  11:     0x7fd5f6141d63 - driver::phase_3_run_analysis_passes::h28f3c6bab4d32090nGa
  12:     0x7fd5f6122e05 - driver::compile_input::h5b445b50b3e18d59Qba
  13:     0x7fd5f61e34e1 - run_compiler::h96f97d4eb21ecd2cz4b
  14:     0x7fd5f61e1132 - boxed::F.FnBox<A>::call_box::h9787258653706413210
  15:     0x7fd5f61e0669 - rt::unwind::try::try_fn::h11878141054803929988
  16:     0x7fd5f5c7b518 - rust_try_inner
  17:     0x7fd5f5c7b505 - rust_try
  18:     0x7fd5f61e0918 - boxed::F.FnBox<A>::call_box::h8845320335913257549
  19:     0x7fd5f5c07be1 - sys::thread::create::thread_start::ha7b08762db72e408Zkv
  20:     0x7fd5f04a1181 - start_thread
  21:     0x7fd5f585247c - __clone
  22:                0x0 - <unknown>
rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)

Also reproducible on beta.4, nightly, windows/linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions