struct_span_err!(self.sess, data.span, E0214, "{}", msg)
.span_label(data.span, "only traits may use parentheses")
.emit();
- (hir::GenericArgs::none(), false)
+ (self.lower_angle_bracketed_parameter_data(
+ &data.as_angle_bracketed_args(),
+ param_mode,
+ itctx).0,
+ false)
}
},
}
pub output: Option<P<Ty>>,
}
+impl ParenthesisedArgs {
+ pub fn as_angle_bracketed_args(&self) -> AngleBracketedArgs {
+ AngleBracketedArgs {
+ span: self.span,
+ args: self.inputs.iter().cloned().map(|input| GenericArg::Type(input)).collect(),
+ bindings: vec![],
+ }
+ }
+}
+
// hack to ensure that we don't try to access the private parts of `NodeId` in this module
mod node_id_inner {
use rustc_data_structures::indexed_vec::Idx;
LL | let v: Vec(&str) = vec!["foo"];
| ^^^^^^ only traits may use parentheses
-error[E0107]: wrong number of type arguments: expected 1, found 0
- --> $DIR/E0214.rs:2:12
- |
-LL | let v: Vec(&str) = vec!["foo"];
- | ^^^^^^^^^ expected 1 type argument
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors occurred: E0107, E0214.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0214`.
fn main() {
let v: Vec(&str) = vec!['1', '2'];
//~^ ERROR parenthesized parameters may only be used with a trait
+ //~| ERROR mismatched types
}
LL | let v: Vec(&str) = vec!['1', '2'];
| ^^^^^^ only traits may use parentheses
-error[E0107]: wrong number of type arguments: expected 1, found 0
- --> $DIR/issue-23589.rs:2:12
+error[E0308]: mismatched types
+ --> $DIR/issue-23589.rs:2:29
|
LL | let v: Vec(&str) = vec!['1', '2'];
- | ^^^^^^^^^ expected 1 type argument
+ | ^^^ expected &str, found char
+ |
+ = note: expected type `&str`
+ found type `char`
error: aborting due to 2 previous errors
-Some errors occurred: E0107, E0214.
-For more information about an error, try `rustc --explain E0107`.
+Some errors occurred: E0214, E0308.
+For more information about an error, try `rustc --explain E0214`.
fn bar() {
let x: Box<Bar()> = panic!();
//~^ ERROR parenthesized parameters may only be used with a trait
+ //~| ERROR wrong number of type arguments: expected 1, found 0
}
fn main() { }
LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
| ^^^^^^^^^^^^^^^^ only traits may use parentheses
-error[E0107]: wrong number of type arguments: expected 2, found 0
- --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:13
- |
-LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
- | ^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 type arguments
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors occurred: E0107, E0214.
-For more information about an error, try `rustc --explain E0107`.
+For more information about this error, try `rustc --explain E0214`.
fn foo(b: Box<Bar()>) {
//~^ ERROR parenthesized parameters may only be used with a trait
- //~| ERROR the type placeholder `_` is not allowed within types on item signatures
+ //~| ERROR wrong number of type arguments: expected 1, found 0
}
fn main() { }