diff options
| author | bors <bors@rust-lang.org> | 2016-01-23 05:54:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-23 05:54:38 +0000 |
| commit | 8ff48fea131c951d2054634dc0d77fb741999891 (patch) | |
| tree | b4d9c9313ebeebe8f9e8d643674696689efa281d | |
| parent | 93d03edcb83d025ef40bd169ebf99214548d987f (diff) | |
| parent | f78ce412ef7b5137f91976dd93fb18865118ebae (diff) | |
| download | rust-8ff48fea131c951d2054634dc0d77fb741999891.tar.gz rust-8ff48fea131c951d2054634dc0d77fb741999891.zip | |
Auto merge of #31126 - arielb1:remote-errors, r=eddyb
Also removed an unused and similarly buggy error path. Fixes #30535 r? @eddyb
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 15 | ||||
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 19 | ||||
| -rw-r--r-- | src/test/auxiliary/issue-30535.rs | 15 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-30535.rs | 19 |
4 files changed, 38 insertions, 30 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index da4265dda54..d67f5f9db5e 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1513,7 +1513,7 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>, &base_segments[base_segments.len()-2], base_segments.last().unwrap()) } - Def::Mod(id) => { + Def::Mod(..) => { // 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 @@ -1522,15 +1522,7 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>, // 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. - 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; - } + assert!(base_segments.is_empty()); opt_self_ty.expect("missing T in <T>::a::b::c") } @@ -1541,10 +1533,9 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>, return this.tcx().types.err; } _ => { - let id_node = tcx.map.as_local_node_id(def.def_id()).unwrap(); span_err!(tcx.sess, span, E0248, "found value `{}` used as a type", - tcx.map.path_to_string(id_node)); + tcx.item_path_str(def.def_id())); return this.tcx().types.err; } } diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 55a1021f0fb..fdc23f89de2 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -2565,24 +2565,6 @@ struct Bar<S, T> { x: Foo<S, T> } ``` "##, -//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. -"##, - E0248: r##" This error indicates an attempt to use a value where a type is expected. For example: @@ -3438,6 +3420,7 @@ register_diagnostics! { E0242, // internal error looking up a definition E0245, // not a trait // E0246, // invalid recursive type +// E0247, // E0319, // trait impls for defaulted traits allowed just for structs/enums E0320, // recursive overflow during dropck E0328, // cannot implement Unsize explicitly diff --git a/src/test/auxiliary/issue-30535.rs b/src/test/auxiliary/issue-30535.rs new file mode 100644 index 00000000000..8d44e8d1016 --- /dev/null +++ b/src/test/auxiliary/issue-30535.rs @@ -0,0 +1,15 @@ +// 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: () } +} diff --git a/src/test/compile-fail/issue-30535.rs b/src/test/compile-fail/issue-30535.rs new file mode 100644 index 00000000000..93f3086d057 --- /dev/null +++ b/src/test/compile-fail/issue-30535.rs @@ -0,0 +1,19 @@ +// 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() {} |
