This commit is contained in:
Ariel Ben-Yehuda 2015-06-18 23:18:15 +03:00
parent 7a13b93b00
commit 2bce9d0ff5
4 changed files with 20 additions and 5 deletions

View File

@ -291,10 +291,13 @@ pub fn ast_path_substs_for_ty<'tcx>(
ast::AngleBracketedParameters(ref data) => {
convert_angle_bracketed_parameters(this, rscope, span, decl_generics, data)
}
ast::ParenthesizedParameters(ref data) => {
ast::ParenthesizedParameters(..) => {
span_err!(tcx.sess, span, E0214,
"parenthesized parameters may only be used with a trait");
convert_parenthesized_parameters(this, rscope, span, decl_generics, data)
"parenthesized parameters may only be used with a trait");
let ty_param_defs = decl_generics.types.get_slice(TypeSpace);
(Substs::empty(),
ty_param_defs.iter().map(|_| tcx.types.err).collect(),
vec![])
}
};

View File

@ -0,0 +1,14 @@
// Copyright 2015 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.
fn main() {
let v: Vec(&str) = vec!['1', '2'];
//~^ ERROR parenthesized parameters may only be used with a trait
}

View File

@ -18,7 +18,6 @@ struct Bar<A> {
fn bar() {
let x: Box<Bar()> = panic!();
//~^ ERROR parenthesized parameters may only be used with a trait
//~^^ ERROR associated type bindings are not allowed here
}
fn main() { }

View File

@ -16,7 +16,6 @@ struct Bar<A> {
fn foo(b: Box<Bar()>) {
//~^ ERROR parenthesized parameters may only be used with a trait
//~^^ ERROR associated type bindings are not allowed here
}
fn main() { }