Change:
rustc crashes when compiling the following source code. I expect this to compile or report error. Instead the compiler crashed.
Reduced testcase:
This also causes an ICE with the latest nightly:
Any update on the issue. Please let me know if you need more information. Thanks

Discussion:
&base_segments[base_segments.len()-2], base_segments.last().unwrap()) } <del> Def::Mod(id) => { </del> <ins> Def::Mod(..) => { </ins> // Used as sentinel by callers to indicate the `<T>::A::B::C` form. // FIXME(#22519) This part of the resolution logic should be // avoided entirely for that form, once we stop needed a Def

// resolve Self::Foo, at the moment we can't resolve the former because // we don't have the trait information around, which is just sad. <del> if !base_segments.is_empty() { let id_node = tcx.map.as_local_node_id(id).unwrap(); span_err!(tcx.sess, span, E0247, "found module name used as a type: {}", tcx.map.node_to_user_string(id_node)); return this.tcx().types.err; } </del> <ins> assert!(base_segments.is_empty()); </ins> opt_self_ty.expect("missing T in <T>::a::b::c") }

return this.tcx().types.err; } _ => { <del> let id_node = tcx.map.as_local_node_id(def.def_id()).unwrap(); </del> span_err!(tcx.sess, span, E0248, "found value `{}` used as a type", <del> tcx.map.path_to_string(id_node)); </del> <ins> tcx.item_path_str(def.def_id())); </ins> return this.tcx().types.err; } }

``` "##, <del> //NB: not currently reachable E0247: r##" This error indicates an attempt to use a module name where a type is expected. For example: ``` mod MyMod { mod MySubMod { } } fn do_something(x: MyMod::MySubMod) { } ``` In this example, we're attempting to take a parameter of type `MyMod::MySubMod` in the do_something function. This is not legal: `MyMod::MySubMod` is a module name, not a type. "##, </del> E0248: r##" This error indicates an attempt to use a value where a type is expected. For example:

E0242, // internal error looking up a definition E0245, // not a trait //  E0246, // invalid recursive type <ins> //  E0247, </ins> //  E0319, // trait impls for defaulted traits allowed just for structs/enums E0320, // recursive overflow during dropck E0328, // cannot implement Unsize explicitly

<ins> // 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"] pub enum Foo { FooV { data: () } } </ins>

<ins> // 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. // aux-build:issue-30535.rs extern crate issue_30535 as foo; fn bar( _: foo::Foo::FooV //~ ERROR value `foo::Foo::FooV` used as a type ) {} fn main() {} </ins>