Skip to content

Commit 2bce9d0

Browse files
author
Ariel Ben-Yehuda
committed
Fix #23589
1 parent 7a13b93 commit 2bce9d0

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/librustc_typeck/astconv.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,13 @@ pub fn ast_path_substs_for_ty<'tcx>(
291291
ast::AngleBracketedParameters(ref data) => {
292292
convert_angle_bracketed_parameters(this, rscope, span, decl_generics, data)
293293
}
294-
ast::ParenthesizedParameters(ref data) => {
294+
ast::ParenthesizedParameters(..) => {
295295
span_err!(tcx.sess, span, E0214,
296-
"parenthesized parameters may only be used with a trait");
297-
convert_parenthesized_parameters(this, rscope, span, decl_generics, data)
296+
"parenthesized parameters may only be used with a trait");
297+
let ty_param_defs = decl_generics.types.get_slice(TypeSpace);
298+
(Substs::empty(),
299+
ty_param_defs.iter().map(|_| tcx.types.err).collect(),
300+
vec![])
298301
}
299302
};
300303

src/test/compile-fail/issue-23589.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let v: Vec(&str) = vec!['1', '2'];
13+
//~^ ERROR parenthesized parameters may only be used with a trait
14+
}

src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ struct Bar<A> {
1818
fn bar() {
1919
let x: Box<Bar()> = panic!();
2020
//~^ ERROR parenthesized parameters may only be used with a trait
21-
//~^^ ERROR associated type bindings are not allowed here
2221
}
2322

2423
fn main() { }

src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct Bar<A> {
1616

1717
fn foo(b: Box<Bar()>) {
1818
//~^ ERROR parenthesized parameters may only be used with a trait
19-
//~^^ ERROR associated type bindings are not allowed here
2019
}
2120

2221
fn main() { }

0 commit comments

Comments
 (0)