diff options
| author | bors <bors@rust-lang.org> | 2018-12-29 21:03:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-12-29 21:03:11 +0000 |
| commit | 59183180f718fc2212828e180f2f856f0db1bb9c (patch) | |
| tree | 23910eebcb2479fd05771ffaa6a447d9b73371e2 /src/test | |
| parent | 007115746c6d0234742719dd67efba054abe97ce (diff) | |
| parent | a4fa7ef2b90880623499e86324b7b40626a02f9d (diff) | |
| download | rust-59183180f718fc2212828e180f2f856f0db1bb9c.tar.gz rust-59183180f718fc2212828e180f2f856f0db1bb9c.zip | |
Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov
Implement RFC 2338, "Type alias enum variants"
This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.
```rust
#![feature(type_alias_enum_variants)]
enum Foo {
Bar(i32),
Baz { i: i32 },
}
type Alias = Foo;
fn main() {
let t = Alias::Bar(0);
let t = Alias::Baz { i: 0 };
match t {
Alias::Bar(_i) => {}
Alias::Baz { i: _i } => {}
}
}
```
Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.
Fixes issues #56199 and #56611.
N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.
```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```
I do not know if this will need an FCP, but let's start one if so.
Diffstat (limited to 'src/test')
71 files changed, 946 insertions, 315 deletions
diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs new file mode 100644 index 00000000000..efef4ab00ae --- /dev/null +++ b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -0,0 +1,51 @@ +// Copyright 2014 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. + +// force-host + +#![feature(plugin_registrar)] +#![feature(box_syntax, rustc_private)] + +// Load rustc as a plugin to get macros. +#[macro_use] +extern crate rustc; +extern crate rustc_plugin; + +use rustc::hir; +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; + +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); + +struct Pass; + +impl LintPass for Pass { + fn get_lints(&self) -> LintArray { + lint_array!(TEST_LINT, PLEASE_LINT) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { + match &*it.ident.as_str() { + "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), + "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), + _ => {} + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box Pass); + reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]); +} diff --git a/src/test/run-pass/enum-variant-generic-args.rs b/src/test/run-pass/enum-variant-generic-args.rs new file mode 100644 index 00000000000..0743f998979 --- /dev/null +++ b/src/test/run-pass/enum-variant-generic-args.rs @@ -0,0 +1,42 @@ +#![feature(irrefutable_let_patterns)] +#![feature(type_alias_enum_variants)] + +#![allow(irrefutable_let_patterns)] + +#[allow(dead_code)] +enum Enum<T> { TSVariant(T), SVariant { v: T } } +type Alias<T> = Enum<T>; +type AliasFixed = Enum<()>; + +macro_rules! is_variant { + (TSVariant, $expr:expr) => (is_variant!(@check TSVariant, (_), $expr)); + (SVariant, $expr:expr) => (is_variant!(@check SVariant, { v: _ }, $expr)); + (@check $variant:ident, $matcher:tt, $expr:expr) => ( + assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false }, + "expr does not have correct type"); + ); +} + +fn main() { + // Tuple struct variant + + is_variant!(TSVariant, Enum::TSVariant(())); + is_variant!(TSVariant, Enum::TSVariant::<()>(())); + is_variant!(TSVariant, Enum::<()>::TSVariant(())); + + is_variant!(TSVariant, Alias::TSVariant(())); + is_variant!(TSVariant, Alias::<()>::TSVariant(())); + + is_variant!(TSVariant, AliasFixed::TSVariant(())); + + // Struct variant + + is_variant!(SVariant, Enum::SVariant { v: () }); + is_variant!(SVariant, Enum::SVariant::<()> { v: () }); + is_variant!(SVariant, Enum::<()>::SVariant { v: () }); + + is_variant!(SVariant, Alias::SVariant { v: () }); + is_variant!(SVariant, Alias::<()>::SVariant { v: () }); + + is_variant!(SVariant, AliasFixed::SVariant { v: () }); +} diff --git a/src/test/run-pass/type-alias-enum-variants-2.rs b/src/test/run-pass/type-alias-enum-variants-2.rs new file mode 100644 index 00000000000..0cf413babcb --- /dev/null +++ b/src/test/run-pass/type-alias-enum-variants-2.rs @@ -0,0 +1,30 @@ +#![feature(type_alias_enum_variants)] + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type FooAlias = Foo; +type OptionAlias = Option<i32>; + +impl Foo { + fn foo() -> Self { + Self::Bar(3) + } +} + +fn main() { + let t = FooAlias::Bar(1); + assert_eq!(t, Foo::Bar(1)); + let t = FooAlias::Baz { i: 2 }; + assert_eq!(t, Foo::Baz { i: 2 }); + match t { + FooAlias::Bar(_i) => {} + FooAlias::Baz { i } => { assert_eq!(i, 2); } + } + assert_eq!(Foo::foo(), Foo::Bar(3)); + + assert_eq!(OptionAlias::Some(4), Option::Some(4)); +} diff --git a/src/test/run-pass/type-alias-enum-variants.rs b/src/test/run-pass/type-alias-enum-variants.rs new file mode 100644 index 00000000000..0cf413babcb --- /dev/null +++ b/src/test/run-pass/type-alias-enum-variants.rs @@ -0,0 +1,30 @@ +#![feature(type_alias_enum_variants)] + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type FooAlias = Foo; +type OptionAlias = Option<i32>; + +impl Foo { + fn foo() -> Self { + Self::Bar(3) + } +} + +fn main() { + let t = FooAlias::Bar(1); + assert_eq!(t, Foo::Bar(1)); + let t = FooAlias::Baz { i: 2 }; + assert_eq!(t, Foo::Baz { i: 2 }); + match t { + FooAlias::Bar(_i) => {} + FooAlias::Baz { i } => { assert_eq!(i, 2); } + } + assert_eq!(Foo::foo(), Foo::Bar(3)); + + assert_eq!(OptionAlias::Some(4), Option::Some(4)); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs index 91d03d98a10..bca1d7a72b4 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -3,7 +3,7 @@ #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -// Load rustc as a plugin to get macros +// Load rustc as a plugin to get macros. #[macro_use] extern crate rustc; extern crate rustc_plugin; @@ -26,7 +26,7 @@ impl LintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - match &*it.name.as_str() { + match &*it.ident.as_str() { "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), _ => {} diff --git a/src/test/ui-fulldeps/lint-group-plugin.rs b/src/test/ui-fulldeps/lint-group-plugin.rs index 00c5a56a482..7a650afe5f8 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.rs +++ b/src/test/ui-fulldeps/lint-group-plugin.rs @@ -1,6 +1,7 @@ // run-pass // aux-build:lint_group_plugin_test.rs // ignore-stage1 + #![feature(plugin)] #![plugin(lint_group_plugin_test)] #![allow(dead_code)] diff --git a/src/test/ui-fulldeps/lint-group-plugin.stderr b/src/test/ui-fulldeps/lint-group-plugin.stderr index 15cffedcc5d..b566048c75e 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin.stderr @@ -1,5 +1,5 @@ warning: item is named 'lintme' - --> $DIR/lint-group-plugin.rs:8:1 + --> $DIR/lint-group-plugin.rs:9:1 | LL | fn lintme() { } //~ WARNING item is named 'lintme' | ^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn lintme() { } //~ WARNING item is named 'lintme' = note: #[warn(test_lint)] on by default warning: item is named 'pleaselintme' - --> $DIR/lint-group-plugin.rs:9:1 + --> $DIR/lint-group-plugin.rs:10:1 | LL | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-no-item.stderr b/src/test/ui/associated-const/associated-const-no-item.stderr index cd60132efdd..de172049872 100644 --- a/src/test/ui/associated-const/associated-const-no-item.stderr +++ b/src/test/ui/associated-const/associated-const-no-item.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `ID` found for type `i32` in the current scope - --> $DIR/associated-const-no-item.rs:5:16 + --> $DIR/associated-const-no-item.rs:5:23 | LL | const X: i32 = <i32>::ID; - | ^^^^^^^^^ associated item not found in `i32` + | -------^^ + | | + | associated item not found in `i32` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `ID`, perhaps you need to implement it: diff --git a/src/test/ui/bogus-tag.rs b/src/test/ui/bogus-tag.rs index ca8db9b502b..c594385eec2 100644 --- a/src/test/ui/bogus-tag.rs +++ b/src/test/ui/bogus-tag.rs @@ -3,8 +3,8 @@ enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } fn main() { let red: Color = Color::Rgb(255, 0, 0); match red { - Color::Rgb(r, g, b) => { println!("rgb"); } - Color::Hsl(h, s, l) => { println!("hsl"); } - //~^ ERROR no variant + Color::Rgb(r, g, b) => { println!("rgb"); } + Color::Hsl(h, s, l) => { println!("hsl"); } + //~^ ERROR no variant } } diff --git a/src/test/ui/bogus-tag.stderr b/src/test/ui/bogus-tag.stderr index 1225abd2c8a..3750df84172 100644 --- a/src/test/ui/bogus-tag.stderr +++ b/src/test/ui/bogus-tag.stderr @@ -1,11 +1,11 @@ error[E0599]: no variant named `Hsl` found for type `Color` in the current scope - --> $DIR/bogus-tag.rs:7:7 + --> $DIR/bogus-tag.rs:7:16 | LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } | ---------- variant `Hsl` not found here ... -LL | Color::Hsl(h, s, l) => { println!("hsl"); } - | ^^^^^^^^^^^^^^^^^^^ variant not found in `Color` +LL | Color::Hsl(h, s, l) => { println!("hsl"); } + | -------^^^--------- variant not found in `Color` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.stderr b/src/test/ui/did_you_mean/bad-assoc-pat.stderr index 86beb0f33f6..92fd9f26777 100644 --- a/src/test/ui/did_you_mean/bad-assoc-pat.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-pat.stderr @@ -23,28 +23,36 @@ LL | &(u8,)::AssocItem => {} | ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem` error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope - --> $DIR/bad-assoc-pat.rs:3:9 + --> $DIR/bad-assoc-pat.rs:3:15 | LL | [u8]::AssocItem => {} - | ^^^^^^^^^^^^^^^ associated item not found in `[u8]` + | ------^^^^^^^^^ + | | + | associated item not found in `[u8]` error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope - --> $DIR/bad-assoc-pat.rs:6:9 + --> $DIR/bad-assoc-pat.rs:6:19 | LL | (u8, u8)::AssocItem => {} - | ^^^^^^^^^^^^^^^^^^^ associated item not found in `(u8, u8)` + | ----------^^^^^^^^^ + | | + | associated item not found in `(u8, u8)` error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope - --> $DIR/bad-assoc-pat.rs:9:9 + --> $DIR/bad-assoc-pat.rs:9:12 | LL | _::AssocItem => {} - | ^^^^^^^^^^^^ associated item not found in `_` + | ---^^^^^^^^^ + | | + | associated item not found in `_` error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope - --> $DIR/bad-assoc-pat.rs:14:10 + --> $DIR/bad-assoc-pat.rs:14:17 | LL | &(u8,)::AssocItem => {} - | ^^^^^^^^^^^^^^^^ associated item not found in `(u8,)` + | -------^^^^^^^^^ + | | + | associated item not found in `(u8,)` error: aborting due to 8 previous errors diff --git a/src/test/ui/dont-suggest-private-trait-method.stderr b/src/test/ui/dont-suggest-private-trait-method.stderr index 483192149b8..af4253779a4 100644 --- a/src/test/ui/dont-suggest-private-trait-method.stderr +++ b/src/test/ui/dont-suggest-private-trait-method.stderr @@ -1,11 +1,13 @@ error[E0599]: no function or associated item named `new` found for type `T` in the current scope - --> $DIR/dont-suggest-private-trait-method.rs:4:5 + --> $DIR/dont-suggest-private-trait-method.rs:4:8 | LL | struct T; | --------- function or associated item `new` not found for this ... LL | T::new(); - | ^^^^^^ function or associated item not found in `T` + | ---^^^ + | | + | function or associated item not found in `T` error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index be613121fe8..d3e1cebd26f 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -47,20 +47,24 @@ LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1 | did you mean `XEmpty1 { /* fields */ }`? error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:22:15 + --> $DIR/empty-struct-braces-expr.rs:22:19 | LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type - | ^^^^^^^^^^ variant not found in `empty_struct::XE` + | ----^^^^^^ + | | + | variant not found in `empty_struct::XE` | - = note: did you mean `empty_struct::XE::XEmpty3`? + = help: did you mean `XEmpty3`? error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:23:15 + --> $DIR/empty-struct-braces-expr.rs:23:19 | LL | let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type - | ^^^^^^^^^^ variant not found in `empty_struct::XE` + | ----^^^^^^ + | | + | variant not found in `empty_struct::XE` | - = note: did you mean `empty_struct::XE::XEmpty3`? + = help: did you mean `XEmpty3`? error: aborting due to 8 previous errors diff --git a/src/test/ui/enum-variant-generic-args.rs b/src/test/ui/enum-variant-generic-args.rs new file mode 100644 index 00000000000..6eddd709645 --- /dev/null +++ b/src/test/ui/enum-variant-generic-args.rs @@ -0,0 +1,73 @@ +#![feature(type_alias_enum_variants)] + +enum Enum<T> { TSVariant(T), SVariant { v: T } } +type Alias<T> = Enum<T>; +type AliasFixed = Enum<()>; + +impl<T> Enum<T> { + fn ts_variant() { + Self::TSVariant(()); + //~^ ERROR mismatched types [E0308] + Self::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + Self::<()>::TSVariant(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR type arguments are not allowed on this entity [E0109] + } + + fn s_variant() { + Self::SVariant { v: () }; + //~^ ERROR mismatched types [E0308] + Self::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::SVariant { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR type arguments are not allowed on this entity [E0109] + //~^^^ ERROR mismatched types [E0308] + } +} + +fn main() { + // Tuple struct variant + + Enum::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + + Alias::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + Alias::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + + AliasFixed::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + AliasFixed::<()>::TSVariant(()); + //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + AliasFixed::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + + // Struct variant + + Enum::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + + Alias::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + Alias::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + + AliasFixed::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + AliasFixed::<()>::SVariant { v: () }; + //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + AliasFixed::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] +} diff --git a/src/test/ui/enum-variant-generic-args.stderr b/src/test/ui/enum-variant-generic-args.stderr new file mode 100644 index 00000000000..4d3b5767346 --- /dev/null +++ b/src/test/ui/enum-variant-generic-args.stderr @@ -0,0 +1,190 @@ +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:9:25 + | +LL | Self::TSVariant(()); + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:11:27 + | +LL | Self::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:13:16 + | +LL | Self::<()>::TSVariant(()); + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:13:31 + | +LL | Self::<()>::TSVariant(()); + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:16:16 + | +LL | Self::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:16:33 + | +LL | Self::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:22:29 + | +LL | Self::SVariant { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:24:26 + | +LL | Self::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:24:35 + | +LL | Self::SVariant::<()> { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:27:16 + | +LL | Self::<()>::SVariant { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:27:35 + | +LL | Self::<()>::SVariant { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:30:16 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:30:32 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:30:41 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:40:29 + | +LL | Enum::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:43:24 + | +LL | Alias::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:45:30 + | +LL | Alias::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:48:29 + | +LL | AliasFixed::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:50:18 + | +LL | AliasFixed::<()>::TSVariant(()); + | ^^ unexpected type argument + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:52:18 + | +LL | AliasFixed::<()>::TSVariant::<()>(()); + | ^^ unexpected type argument + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:52:35 + | +LL | AliasFixed::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:58:28 + | +LL | Enum::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:61:23 + | +LL | Alias::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:63:29 + | +LL | Alias::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:66:28 + | +LL | AliasFixed::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:68:18 + | +LL | AliasFixed::<()>::SVariant { v: () }; + | ^^ unexpected type argument + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:70:18 + | +LL | AliasFixed::<()>::SVariant::<()> { v: () }; + | ^^ unexpected type argument + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:70:34 + | +LL | AliasFixed::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error: aborting due to 28 previous errors + +Some errors occurred: E0107, E0109, E0308. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index 447b106c629..a5508f98085 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -1,8 +1,8 @@ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/E0109.rs:1:14 | LL | type X = u32<i32>; //~ ERROR E0109 - | ^^^ type parameter not allowed + | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.rs b/src/test/ui/error-codes/E0110.rs index 2de5da16ad7..764b62b8dfe 100644 --- a/src/test/ui/error-codes/E0110.rs +++ b/src/test/ui/error-codes/E0110.rs @@ -1,4 +1,3 @@ type X = u32<'static>; //~ ERROR E0110 -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index 609b8b58276..a644ac92cef 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -1,8 +1,8 @@ -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/E0110.rs:1:14 | LL | type X = u32<'static>; //~ ERROR E0110 - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0599.stderr b/src/test/ui/error-codes/E0599.stderr index 5a7cddbf382..85110889e9a 100644 --- a/src/test/ui/error-codes/E0599.stderr +++ b/src/test/ui/error-codes/E0599.stderr @@ -1,11 +1,11 @@ error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the current scope - --> $DIR/E0599.rs:4:15 + --> $DIR/E0599.rs:4:20 | LL | struct Foo; | ----------- associated item `NotEvenReal` not found for this ... LL | || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 - | ^^^^^^^^^^^^^^^^^^ associated item not found in `Foo` + | -----^^^^^^^^^^^-- associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs new file mode 100644 index 00000000000..8997c1824ca --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs @@ -0,0 +1,29 @@ +// Copyright 2018 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. + +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type Alias = Foo; + +fn main() { + let t = Alias::Bar(0); + //~^ ERROR enum variants on type aliases are experimental + let t = Alias::Baz { i: 0 }; + //~^ ERROR enum variants on type aliases are experimental + match t { + Alias::Bar(_i) => {} + //~^ ERROR enum variants on type aliases are experimental + Alias::Baz { i: _i } => {} + //~^ ERROR enum variants on type aliases are experimental + } +} diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr new file mode 100644 index 00000000000..cba643e18ca --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr @@ -0,0 +1,34 @@ +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:19:13 + | +LL | let t = Alias::Bar(0); + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:21:13 + | +LL | let t = Alias::Baz { i: 0 }; + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:24:9 + | +LL | Alias::Bar(_i) => {} + | ^^^^^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:26:9 + | +LL | Alias::Baz { i: _i } => {} + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/invalid/invalid-path-in-const.stderr b/src/test/ui/invalid/invalid-path-in-const.stderr index 6541c92c691..13176b8b8fb 100644 --- a/src/test/ui/invalid/invalid-path-in-const.stderr +++ b/src/test/ui/invalid/invalid-path-in-const.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope - --> $DIR/invalid-path-in-const.rs:2:18 + --> $DIR/invalid-path-in-const.rs:2:23 | LL | fn f(a: [u8; u32::DOESNOTEXIST]) {} - | ^^^^^^^^^^^^^^^^^ associated item not found in `u32` + | -----^^^^^^^^^^^^ + | | + | associated item not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22706.rs b/src/test/ui/issues/issue-22706.rs index c19c2a4c705..413a0d9a494 100644 --- a/src/test/ui/issues/issue-22706.rs +++ b/src/test/ui/issues/issue-22706.rs @@ -1,3 +1,3 @@ fn is_copy<T: ::std::marker<i32>::Copy>() {} -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] fn main() {} diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr index 57e62599b19..a3cf716903d 100644 --- a/src/test/ui/issues/issue-22706.stderr +++ b/src/test/ui/issues/issue-22706.stderr @@ -1,8 +1,8 @@ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/issue-22706.rs:1:29 | LL | fn is_copy<T: ::std::marker<i32>::Copy>() {} - | ^^^ type parameter not allowed + | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22933-2.stderr b/src/test/ui/issues/issue-22933-2.stderr index 58145a38026..97962adc2d2 100644 --- a/src/test/ui/issues/issue-22933-2.stderr +++ b/src/test/ui/issues/issue-22933-2.stderr @@ -1,11 +1,13 @@ error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope - --> $DIR/issue-22933-2.rs:4:44 + --> $DIR/issue-22933-2.rs:4:55 | LL | enum Delicious { | -------------- variant `PIE` not found here ... LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - | ^^^^^^^^^^^^^^ variant not found in `Delicious` + | -----------^^^ + | | + | variant not found in `Delicious` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr index 2ca1bd7401a..aa0052f9701 100644 --- a/src/test/ui/issues/issue-22933-3.stderr +++ b/src/test/ui/issues/issue-22933-3.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current scope - --> $DIR/issue-22933-3.rs:1:18 + --> $DIR/issue-22933-3.rs:1:22 | LL | const FOO: [u32; u8::MIN as usize] = []; - | ^^^^^^^ associated item not found in `u8` + | ----^^^ + | | + | associated item not found in `u8` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23173.stderr b/src/test/ui/issues/issue-23173.stderr index de4c8422b9c..98c4f867ad6 100644 --- a/src/test/ui/issues/issue-23173.stderr +++ b/src/test/ui/issues/issue-23173.stderr @@ -1,38 +1,46 @@ error[E0599]: no variant named `Homura` found for type `Token` in the current scope - --> $DIR/issue-23173.rs:9:16 + --> $DIR/issue-23173.rs:9:23 | LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } | ---------- variant `Homura` not found here ... LL | use_token(&Token::Homura); - | ^^^^^^^^^^^^^ variant not found in `Token` + | -------^^^^^^ + | | + | variant not found in `Token` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:11:5 + --> $DIR/issue-23173.rs:11:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this ... LL | Struct::method(); - | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + | --------^^^^^^ + | | + | function or associated item not found in `Struct` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:13:5 + --> $DIR/issue-23173.rs:13:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this ... LL | Struct::method; - | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + | --------^^^^^^ + | | + | function or associated item not found in `Struct` error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:15:5 + --> $DIR/issue-23173.rs:15:13 | LL | struct Struct { | ------------- associated item `Assoc` not found for this ... LL | Struct::Assoc; - | ^^^^^^^^^^^^^ associated item not found in `Struct` + | --------^^^^^ + | | + | associated item not found in `Struct` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-23217.stderr b/src/test/ui/issues/issue-23217.stderr index a058caf81bb..208d0cc499a 100644 --- a/src/test/ui/issues/issue-23217.stderr +++ b/src/test/ui/issues/issue-23217.stderr @@ -1,12 +1,14 @@ error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope - --> $DIR/issue-23217.rs:2:9 + --> $DIR/issue-23217.rs:2:19 | LL | pub enum SomeEnum { | ----------------- variant `A` not found here LL | B = SomeEnum::A, - | ^^^^^^^^^^^ variant not found in `SomeEnum` + | ----------^ + | | + | variant not found in `SomeEnum` | - = note: did you mean `SomeEnum::B`? + = help: did you mean `B`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28344.stderr b/src/test/ui/issues/issue-28344.stderr index f7d8d2af862..146ebad6ce1 100644 --- a/src/test/ui/issues/issue-28344.stderr +++ b/src/test/ui/issues/issue-28344.stderr @@ -5,10 +5,12 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); | ^^^^^^^^^^^^^ associated type `Output` must be specified error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope - --> $DIR/issue-28344.rs:4:17 + --> $DIR/issue-28344.rs:4:25 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>` + | --------^^^^^ + | | + | function or associated item not found in `dyn std::ops::BitXor<_>` | = help: did you mean `bitxor`? @@ -19,10 +21,12 @@ LL | let g = BitXor::bitor; | ^^^^^^^^^^^^^ associated type `Output` must be specified error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope - --> $DIR/issue-28344.rs:8:13 + --> $DIR/issue-28344.rs:8:21 | LL | let g = BitXor::bitor; - | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>` + | --------^^^^^ + | | + | function or associated item not found in `dyn std::ops::BitXor<_>` | = help: did you mean `bitxor`? diff --git a/src/test/ui/issues/issue-28586.stderr b/src/test/ui/issues/issue-28586.stderr index 52af2f54653..eccb474c15e 100644 --- a/src/test/ui/issues/issue-28586.stderr +++ b/src/test/ui/issues/issue-28586.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope - --> $DIR/issue-28586.rs:4:19 + --> $DIR/issue-28586.rs:4:26 | LL | impl Foo for [u8; usize::BYTES] {} - | ^^^^^^^^^^^^ associated item not found in `usize` + | -------^^^^^ + | | + | associated item not found in `usize` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28971.stderr b/src/test/ui/issues/issue-28971.stderr index f6362faab12..d5dbd5f6488 100644 --- a/src/test/ui/issues/issue-28971.stderr +++ b/src/test/ui/issues/issue-28971.stderr @@ -1,13 +1,13 @@ error[E0599]: no variant named `Baz` found for type `Foo` in the current scope - --> $DIR/issue-28971.rs:9:13 + --> $DIR/issue-28971.rs:9:18 | LL | enum Foo { | -------- variant `Baz` not found here ... LL | Foo::Baz(..) => (), - | ^^^^^^^^^^^^ variant not found in `Foo` + | -----^^^---- variant not found in `Foo` | - = note: did you mean `Foo::Bar`? + = help: did you mean `Bar`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30123.stderr b/src/test/ui/issues/issue-30123.stderr index 9729b13d57f..555bdb1236f 100644 --- a/src/test/ui/issues/issue-30123.stderr +++ b/src/test/ui/issues/issue-30123.stderr @@ -1,8 +1,10 @@ error[E0599]: no function or associated item named `new_undirected` found for type `issue_30123_aux::Graph<i32, i32>` in the current scope - --> $DIR/issue-30123.rs:7:14 + --> $DIR/issue-30123.rs:7:33 | LL | let ug = Graph::<i32, i32>::new_undirected(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph<i32, i32>` + | -------------------^^^^^^^^^^^^^^ + | | + | function or associated item not found in `issue_30123_aux::Graph<i32, i32>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38919.stderr b/src/test/ui/issues/issue-38919.stderr index 41da422c1b9..8c094364795 100644 --- a/src/test/ui/issues/issue-38919.stderr +++ b/src/test/ui/issues/issue-38919.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `Item` found for type `T` in the current scope - --> $DIR/issue-38919.rs:2:5 + --> $DIR/issue-38919.rs:2:8 | LL | T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope - | ^^^^^^^ associated item not found in `T` + | ---^^^^ + | | + | associated item not found in `T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39559.stderr b/src/test/ui/issues/issue-39559.stderr index 7653cadc6a7..e851e79faee 100644 --- a/src/test/ui/issues/issue-39559.stderr +++ b/src/test/ui/issues/issue-39559.stderr @@ -1,8 +1,10 @@ error[E0599]: no function or associated item named `dim` found for type `D` in the current scope - --> $DIR/issue-39559.rs:14:18 + --> $DIR/issue-39559.rs:14:21 | LL | entries: [T; D::dim()], - | ^^^^^^ function or associated item not found in `D` + | ---^^^ + | | + | function or associated item not found in `D` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `dim`, perhaps you need to implement it: diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr index 0f9c1564749..8e46d880181 100644 --- a/src/test/ui/issues/issue-3973.stderr +++ b/src/test/ui/issues/issue-3973.stderr @@ -8,13 +8,15 @@ LL | | } | |_____^ not a member of trait `ToString_` error[E0599]: no function or associated item named `new` found for type `Point` in the current scope - --> $DIR/issue-3973.rs:22:13 + --> $DIR/issue-3973.rs:22:20 | LL | struct Point { | ------------ function or associated item `new` not found for this ... LL | let p = Point::new(0.0, 0.0); - | ^^^^^^^^^^ function or associated item not found in `Point` + | -------^^^ + | | + | function or associated item not found in `Point` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-42880.stderr b/src/test/ui/issues/issue-42880.stderr index 7d8bae9cafc..36b9e8a1e8a 100644 --- a/src/test/ui/issues/issue-42880.stderr +++ b/src/test/ui/issues/issue-42880.stderr @@ -1,8 +1,8 @@ error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope - --> $DIR/issue-42880.rs:4:15 + --> $DIR/issue-42880.rs:4:22 | LL | let f = |&Value::String(_)| (); //~ ERROR no associated item named - | ^^^^^^^^^^^^^^^^ associated item not found in `std::string::String` + | -------^^^^^^--- associated item not found in `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7950.stderr b/src/test/ui/issues/issue-7950.stderr index 169ce5429f5..e30f0475376 100644 --- a/src/test/ui/issues/issue-7950.stderr +++ b/src/test/ui/issues/issue-7950.stderr @@ -1,11 +1,13 @@ error[E0599]: no function or associated item named `bar` found for type `Foo` in the current scope - --> $DIR/issue-7950.rs:6:5 + --> $DIR/issue-7950.rs:6:10 | LL | struct Foo; | ----------- function or associated item `bar` not found for this ... LL | Foo::bar(); - | ^^^^^^^^ function or associated item not found in `Foo` + | -----^^^ + | | + | function or associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 7ac629b5dea..51313033a02 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -9,10 +9,12 @@ LL | use T; | error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope - --> $DIR/lexical-scopes.rs:10:5 + --> $DIR/lexical-scopes.rs:10:10 | LL | Foo::f(); //~ ERROR no function or associated item named `f` - | ^^^^^^ function or associated item not found in `Foo` + | -----^ + | | + | function or associated item not found in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/mod-subitem-as-enum-variant.rs b/src/test/ui/mod-subitem-as-enum-variant.rs new file mode 100644 index 00000000000..ec809d44e94 --- /dev/null +++ b/src/test/ui/mod-subitem-as-enum-variant.rs @@ -0,0 +1,10 @@ + +mod Mod { + pub struct FakeVariant<T>(pub T); +} + +fn main() { + Mod::FakeVariant::<i32>(0); + Mod::<i32>::FakeVariant(0); + //~^ ERROR type arguments are not allowed on this entity [E0109] +} diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr new file mode 100644 index 00000000000..d62bad81c3d --- /dev/null +++ b/src/test/ui/mod-subitem-as-enum-variant.stderr @@ -0,0 +1,9 @@ +error[E0109]: type arguments are not allowed on this entity + --> $DIR/mod-subitem-as-enum-variant.rs:8:11 + | +LL | Mod::<i32>::FakeVariant(0); + | ^^^ type argument not allowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/prim-with-args.rs b/src/test/ui/prim-with-args.rs index 52443a729e5..b5df0fb76ca 100644 --- a/src/test/ui/prim-with-args.rs +++ b/src/test/ui/prim-with-args.rs @@ -1,27 +1,27 @@ fn main() { -let x: isize<isize>; //~ ERROR type parameters are not allowed on this type -let x: i8<isize>; //~ ERROR type parameters are not allowed on this type -let x: i16<isize>; //~ ERROR type parameters are not allowed on this type -let x: i32<isize>; //~ ERROR type parameters are not allowed on this type -let x: i64<isize>; //~ ERROR type parameters are not allowed on this type -let x: usize<isize>; //~ ERROR type parameters are not allowed on this type -let x: u8<isize>; //~ ERROR type parameters are not allowed on this type -let x: u16<isize>; //~ ERROR type parameters are not allowed on this type -let x: u32<isize>; //~ ERROR type parameters are not allowed on this type -let x: u64<isize>; //~ ERROR type parameters are not allowed on this type -let x: char<isize>; //~ ERROR type parameters are not allowed on this type +let x: isize<isize>; //~ ERROR type arguments are not allowed on this entity +let x: i8<isize>; //~ ERROR type arguments are not allowed on this entity +let x: i16<isize>; //~ ERROR type arguments are not allowed on this entity +let x: i32<isize>; //~ ERROR type arguments are not allowed on this entity +let x: i64<isize>; //~ ERROR type arguments are not allowed on this entity +let x: usize<isize>; //~ ERROR type arguments are not allowed on this entity +let x: u8<isize>; //~ ERROR type arguments are not allowed on this entity +let x: u16<isize>; //~ ERROR type arguments are not allowed on this entity +let x: u32<isize>; //~ ERROR type arguments are not allowed on this entity +let x: u64<isize>; //~ ERROR type arguments are not allowed on this entity +let x: char<isize>; //~ ERROR type arguments are not allowed on this entity -let x: isize<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i8<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i16<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i32<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i64<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: usize<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u8<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u16<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u32<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u64<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: char<'static>; //~ ERROR lifetime parameters are not allowed on this type +let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity } diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr index 190c45a1624..91259e87efc 100644 --- a/src/test/ui/prim-with-args.stderr +++ b/src/test/ui/prim-with-args.stderr @@ -1,134 +1,134 @@ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:3:14 | -LL | let x: isize<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: isize<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:4:11 | -LL | let x: i8<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i8<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:5:12 | -LL | let x: i16<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i16<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:6:12 | -LL | let x: i32<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i32<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:7:12 | -LL | let x: i64<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i64<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:8:14 | -LL | let x: usize<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: usize<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:9:11 | -LL | let x: u8<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u8<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:10:12 | -LL | let x: u16<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u16<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:11:12 | -LL | let x: u32<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u32<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:12:12 | -LL | let x: u64<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u64<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:13:13 | -LL | let x: char<isize>; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: char<isize>; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:15:14 | -LL | let x: isize<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:16:11 | -LL | let x: i8<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:17:12 | -LL | let x: i16<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:18:12 | -LL | let x: i32<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:19:12 | -LL | let x: i64<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:20:14 | -LL | let x: usize<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:21:11 | -LL | let x: u8<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:22:12 | -LL | let x: u16<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:23:12 | -LL | let x: u32<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:24:12 | -LL | let x: u64<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:25:13 | -LL | let x: char<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed error: aborting due to 22 previous errors diff --git a/src/test/ui/qualified/qualified-path-params-2.rs b/src/test/ui/qualified/qualified-path-params-2.rs index 6ee55f54bdb..8412983fda5 100644 --- a/src/test/ui/qualified/qualified-path-params-2.rs +++ b/src/test/ui/qualified/qualified-path-params-2.rs @@ -16,7 +16,7 @@ impl S { } type A = <S as Tr>::A::f<u8>; -//~^ ERROR type parameters are not allowed on this type +//~^ ERROR type arguments are not allowed on this entity //~| ERROR ambiguous associated type fn main() {} diff --git a/src/test/ui/qualified/qualified-path-params-2.stderr b/src/test/ui/qualified/qualified-path-params-2.stderr index 91c3d704cb9..4e073841b97 100644 --- a/src/test/ui/qualified/qualified-path-params-2.stderr +++ b/src/test/ui/qualified/qualified-path-params-2.stderr @@ -1,8 +1,8 @@ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/qualified-path-params-2.rs:18:26 | LL | type A = <S as Tr>::A::f<u8>; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/qualified-path-params-2.rs:18:10 diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr index dee32024e47..9d35e167075 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `XXX` found for type `u32` in the current scope - --> $DIR/no-double-error.rs:8:9 + --> $DIR/no-double-error.rs:8:14 | LL | u32::XXX => { } //~ ERROR no associated item named - | ^^^^^^^^ associated item not found in `u32` + | -----^^^ + | | + | associated item not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/rfc1598-generic-associated-types/collections.rs index e1a65c28803..5414bb4a6d2 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.rs +++ b/src/test/ui/rfc1598-generic-associated-types/collections.rs @@ -2,7 +2,7 @@ //~^ WARNING the feature `generic_associated_types` is incomplete #![feature(associated_type_defaults)] -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. // A Collection trait and collection families. Based on @@ -15,14 +15,14 @@ trait Collection<T> { // Test associated type defaults with parameters type Sibling<U>: Collection<U> = <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] fn empty() -> Self; fn add(&mut self, value: T); fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } trait CollectionFamily { @@ -48,13 +48,13 @@ impl<T> Collection<T> for Vec<T> { } fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32> -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] where C: Collection<i32>, { @@ -66,7 +66,7 @@ where } fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32> -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] where C: Collection<i32>, { diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.stderr b/src/test/ui/rfc1598-generic-associated-types/collections.stderr index e90a6b8ad13..eeed04bd892 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/collections.stderr @@ -4,35 +4,35 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/collections.rs:56:90 | LL | fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32> - | ^^^ type parameter not allowed + | ^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/collections.rs:68:69 | LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32> - | ^^^ type parameter not allowed + | ^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/collections.rs:17:71 | LL | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/collections.rs:24:50 | LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - | ^^^^^ lifetime parameter not allowed + | ^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/collections.rs:50:50 | LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - | ^^^^^ lifetime parameter not allowed + | ^^^^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs index 85935d1cca6..d9c482e23e4 100644 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs @@ -3,7 +3,7 @@ use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Foo { @@ -15,15 +15,15 @@ trait Baz { // This weird type tests that we can use universal function call syntax to access the Item on type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } impl<T> Baz for T where T: Foo { type Quux<'a> = T; type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr index 100809f62a5..fd6116d2da2 100644 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr @@ -4,23 +4,23 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/construct_with_other_type.rs:17:46 | LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/construct_with_other_type.rs:17:63 | LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/construct_with_other_type.rs:25:40 | LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs index bfdd1200388..2e6d7470b49 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs @@ -3,20 +3,20 @@ use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Iterable { type Item<'a>; type Iter<'a>: Iterator<Item = Self::Item<'a>> - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] + Deref<Target = Self::Item<'b>>; //~^ ERROR undeclared lifetime - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; //~^ ERROR undeclared lifetime - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr index f5b42866dc6..3cebab63895 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -16,23 +16,23 @@ error[E0261]: use of undeclared lifetime name `'undeclared` LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ^^^^^^^^^^^ undeclared lifetime -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:47 | LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37 | LL | + Deref<Target = Self::Item<'b>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; - | ^^^^^^^^^^^ lifetime parameter not allowed + | ^^^^^^^^^^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs index 16ed4a7546c..69258506651 100644 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.rs +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.rs @@ -3,16 +3,16 @@ use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Iterable { type Item<'a>; type Iter<'a>: Iterator<Item = Self::Item<'a>>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] fn iter<'a>(&'a self) -> Self::Iter<'a>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } // Impl for struct type @@ -21,7 +21,7 @@ impl<T> Iterable for Vec<T> { type Iter<'a> = std::slice::Iter<'a, T>; fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } @@ -32,18 +32,18 @@ impl<T> Iterable for [T] { type Iter<'a> = std::slice::Iter<'a, T>; fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] it.iter() } fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] it.iter().next() } diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr index 41943d7d325..cc3ade6f39d 100644 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr @@ -4,41 +4,41 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:11:47 | LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:40:53 | LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:45:60 | LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:14:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:23:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/iterable.rs:34:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs index 098d52b20fa..851e331a0e9 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs +++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs @@ -2,7 +2,7 @@ //~^ WARNING the feature `generic_associated_types` is incomplete #![feature(associated_type_defaults)] -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. // FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`. @@ -15,13 +15,13 @@ trait Foo { type E<'a, T>; // Test parameters in default values type FOk<T> = Self::E<'static, T>; - //~^ ERROR type parameters are not allowed on this type [E0109] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] type FErr1 = Self::E<'static, 'static>; // Error - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] type FErr2<T> = Self::E<'static, T, u32>; // Error - //~^ ERROR type parameters are not allowed on this type [E0109] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } struct Fooy; diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr index dfd1648e5c0..265b0fab770 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr @@ -4,35 +4,35 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/parameter_number_and_kind.rs:17:27 | LL | type FOk<T> = Self::E<'static, T>; - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/parameter_number_and_kind.rs:17:36 | LL | type FOk<T> = Self::E<'static, T>; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/parameter_number_and_kind.rs:20:26 | LL | type FErr1 = Self::E<'static, 'static>; // Error - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/parameter_number_and_kind.rs:22:29 | LL | type FErr2<T> = Self::E<'static, T, u32>; // Error - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/parameter_number_and_kind.rs:22:38 | LL | type FErr2<T> = Self::E<'static, T, u32>; // Error - | ^ type parameter not allowed + | ^ type argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs index e11670ce1b3..2d188aed427 100644 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs @@ -1,7 +1,7 @@ #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete -// FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR. +// FIXME(#44265): "type argument not allowed" errors will be addressed in a follow-up PR. use std::rc::Rc; use std::sync::Arc; @@ -10,7 +10,7 @@ use std::ops::Deref; trait PointerFamily { type Pointer<T>: Deref<Target = T>; fn new<T>(value: T) -> Self::Pointer<T>; - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] } struct ArcFamily; @@ -18,7 +18,7 @@ struct ArcFamily; impl PointerFamily for ArcFamily { type Pointer<T> = Arc<T>; fn new<T>(value: T) -> Self::Pointer<T> { - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] Arc::new(value) } } @@ -28,14 +28,14 @@ struct RcFamily; impl PointerFamily for RcFamily { type Pointer<T> = Rc<T>; fn new<T>(value: T) -> Self::Pointer<T> { - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] Rc::new(value) } } struct Foo<P: PointerFamily> { bar: P::Pointer<String>, - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr index 29c442a79e6..2b9eed2a688 100644 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr @@ -4,29 +4,29 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/pointer_family.rs:37:21 | LL | bar: P::Pointer<String>, - | ^^^^^^ type parameter not allowed + | ^^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/pointer_family.rs:12:42 | LL | fn new<T>(value: T) -> Self::Pointer<T>; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/pointer_family.rs:20:42 | LL | fn new<T>(value: T) -> Self::Pointer<T> { - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/pointer_family.rs:30:42 | LL | fn new<T>(value: T) -> Self::Pointer<T> { - | ^ type parameter not allowed + | ^ type argument not allowed error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs index cb6e5768049..1ef15444790 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs @@ -1,7 +1,7 @@ #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete -// FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime argument not allowed on this type" errors will be addressed in a // follow-up PR use std::fmt::Display; @@ -10,13 +10,13 @@ trait StreamingIterator { type Item<'a>; // Applying the lifetime parameter `'a` to `Self::Item` inside the trait. fn next<'a>(&'a self) -> Option<Self::Item<'a>>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } struct Foo<T: StreamingIterator> { // Applying a concrete lifetime to the constructor outside the trait. bar: <T as StreamingIterator>::Item<'static>, - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } // Users can bound parameters by the type constructed by that trait's associated type constructor @@ -24,7 +24,7 @@ struct Foo<T: StreamingIterator> { //FIXME(sunjay): This next line should parse and be valid //fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ } fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } -//~^ ERROR lifetime parameters are not allowed on this type [E0110] +//~^ ERROR lifetime arguments are not allowed on this entity [E0110] // Full example of enumerate iterator @@ -36,9 +36,9 @@ struct StreamEnumerate<I> { impl<I: StreamingIterator> StreamingIterator for StreamEnumerate<I> { type Item<'a> = (usize, I::Item<'a>); - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] fn next<'a>(&'a self) -> Option<Self::Item<'a>> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] match self.iter.next() { None => None, Some(val) => { diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr index af5d1b872cc..5afbba5d2d7 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr @@ -4,35 +4,35 @@ warning: the feature `generic_associated_types` is incomplete and may cause the LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/streaming_iterator.rs:18:41 | LL | bar: <T as StreamingIterator>::Item<'static>, - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/streaming_iterator.rs:26:64 | LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/streaming_iterator.rs:12:48 | LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/streaming_iterator.rs:38:37 | LL | type Item<'a> = (usize, I::Item<'a>); - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type +error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/streaming_iterator.rs:40:48 | LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rust-2018/trait-import-suggestions.stderr b/src/test/ui/rust-2018/trait-import-suggestions.stderr index e97cb318784..e4c17680c90 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.stderr +++ b/src/test/ui/rust-2018/trait-import-suggestions.stderr @@ -27,10 +27,12 @@ LL | x.baz(); //~ ERROR no method named `baz` | ^^^ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope - --> $DIR/trait-import-suggestions.rs:30:13 + --> $DIR/trait-import-suggestions.rs:30:18 | LL | let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` - | ^^^^^^^^^^^^^ function or associated item not found in `u32` + | -----^^^^^^^^ + | | + | function or associated item not found in `u32` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: diff --git a/src/test/ui/structs/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs index 1cafe265b2e..7c770852d22 100644 --- a/src/test/ui/structs/struct-path-associated-type.rs +++ b/src/test/ui/structs/struct-path-associated-type.rs @@ -13,7 +13,7 @@ fn f<T: Tr>() { //~^ ERROR expected struct, variant or union type, found associated type let z = T::A::<u8> {}; //~^ ERROR expected struct, variant or union type, found associated type - //~| ERROR type parameters are not allowed on this type + //~| ERROR type arguments are not allowed on this entity match S { T::A {} => {} //~^ ERROR expected struct, variant or union type, found associated type @@ -22,7 +22,7 @@ fn f<T: Tr>() { fn g<T: Tr<A = S>>() { let s = T::A {}; // OK - let z = T::A::<u8> {}; //~ ERROR type parameters are not allowed on this type + let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed on this entity match S { T::A {} => {} // OK } @@ -31,7 +31,7 @@ fn g<T: Tr<A = S>>() { fn main() { let s = S::A {}; //~ ERROR ambiguous associated type let z = S::A::<u8> {}; //~ ERROR ambiguous associated type - //~^ ERROR type parameters are not allowed on this type + //~^ ERROR type arguments are not allowed on this entity match S { S::A {} => {} //~ ERROR ambiguous associated type } diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 41360d87930..80824d98478 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -4,11 +4,11 @@ error[E0071]: expected struct, variant or union type, found associated type LL | let s = T::A {}; | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:14:20 | LL | let z = T::A::<u8> {}; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -22,11 +22,11 @@ error[E0071]: expected struct, variant or union type, found associated type LL | T::A {} => {} | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:25:20 | -LL | let z = T::A::<u8> {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 @@ -34,11 +34,11 @@ error[E0223]: ambiguous associated type LL | let s = S::A {}; //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `<S as Trait>::A` -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:33:20 | LL | let z = S::A::<u8> {}; //~ ERROR ambiguous associated type - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:33:13 diff --git a/src/test/ui/structs/struct-path-self.rs b/src/test/ui/structs/struct-path-self.rs index ccbf3db29b1..51ed9e5457e 100644 --- a/src/test/ui/structs/struct-path-self.rs +++ b/src/test/ui/structs/struct-path-self.rs @@ -6,7 +6,7 @@ trait Tr { //~^ ERROR expected struct, variant or union type, found Self let z = Self::<u8> {}; //~^ ERROR expected struct, variant or union type, found Self - //~| ERROR type parameters are not allowed on this type + //~| ERROR type arguments are not allowed on this entity match s { Self { .. } => {} //~^ ERROR expected struct, variant or union type, found Self @@ -17,7 +17,7 @@ trait Tr { impl Tr for S { fn f() { let s = Self {}; // OK - let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type + let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity match s { Self { .. } => {} // OK } @@ -27,7 +27,7 @@ impl Tr for S { impl S { fn g() { let s = Self {}; // OK - let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type + let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity match s { Self { .. } => {} // OK } diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index a1df1a0764c..cda6b7a533f 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -4,11 +4,11 @@ error[E0071]: expected struct, variant or union type, found Self LL | let s = Self {}; | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:7:24 | LL | let z = Self::<u8> {}; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0071]: expected struct, variant or union type, found Self --> $DIR/struct-path-self.rs:7:17 @@ -22,17 +22,17 @@ error[E0071]: expected struct, variant or union type, found Self LL | Self { .. } => {} | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:20:24 | -LL | let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type +error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:30:24 | -LL | let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr index 5913f7b4b18..c65a9a3ed94 100644 --- a/src/test/ui/traits/trait-item-privacy.stderr +++ b/src/test/ui/traits/trait-item-privacy.stderr @@ -33,26 +33,30 @@ LL | c.a(); //~ ERROR method `a` is private | ^ error[E0599]: no function or associated item named `a` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:78:5 + --> $DIR/trait-item-privacy.rs:78:8 | LL | struct S; | --------- function or associated item `a` not found for this ... LL | S::a(&S); - | ^^^^ function or associated item not found in `S` + | ---^ + | | + | function or associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `a`, perhaps you need to implement it: candidate #1: `method::A` error[E0599]: no function or associated item named `b` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:80:5 + --> $DIR/trait-item-privacy.rs:80:8 | LL | struct S; | --------- function or associated item `b` not found for this ... LL | S::b(&S); - | ^^^^ function or associated item not found in `S` + | ---^ + | | + | function or associated item not found in `S` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: @@ -67,26 +71,30 @@ LL | C::a(&S); //~ ERROR method `a` is private | ^^^^ error[E0599]: no associated item named `A` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:97:5 + --> $DIR/trait-item-privacy.rs:97:8 | LL | struct S; | --------- associated item `A` not found for this ... LL | S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope - | ^^^^ associated item not found in `S` + | ---^ + | | + | associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `A`, perhaps you need to implement it: candidate #1: `assoc_const::A` error[E0599]: no associated item named `B` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:98:5 + --> $DIR/trait-item-privacy.rs:98:8 | LL | struct S; | --------- associated item `B` not found for this ... LL | S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope - | ^^^^ associated item not found in `S` + | ---^ + | | + | associated item not found in `S` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: diff --git a/src/test/ui/type-alias-enum-variants-panic.rs b/src/test/ui/type-alias-enum-variants-panic.rs new file mode 100644 index 00000000000..f97592f5d3b --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-panic.rs @@ -0,0 +1,17 @@ +// ignore-tidy-linelength + +#![feature(type_alias_enum_variants)] + +#![allow(unreachable_code)] + +enum Enum { Variant {} } +type Alias = Enum; + +fn main() { + Alias::Variant; + //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533] + let Alias::Variant = panic!(); + //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533] + let Alias::Variant(..) = panic!(); + //~^ ERROR expected tuple struct/variant, found struct variant `<Alias>::Variant` [E0164] +} diff --git a/src/test/ui/type-alias-enum-variants-panic.stderr b/src/test/ui/type-alias-enum-variants-panic.stderr new file mode 100644 index 00000000000..3480d116383 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-panic.stderr @@ -0,0 +1,22 @@ +error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:11:5 + | +LL | Alias::Variant; + | ^^^^^^^^^^^^^^ + +error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:13:9 + | +LL | let Alias::Variant = panic!(); + | ^^^^^^^^^^^^^^ + +error[E0164]: expected tuple struct/variant, found struct variant `<Alias>::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:15:9 + | +LL | let Alias::Variant(..) = panic!(); + | ^^^^^^^^^^^^^^^^^^ not a tuple variant or struct + +error: aborting due to 3 previous errors + +Some errors occurred: E0164, E0533. +For more information about an error, try `rustc --explain E0164`. diff --git a/src/test/ui/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants.rs new file mode 100644 index 00000000000..3ec200d57c5 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants.rs @@ -0,0 +1,11 @@ +#![feature(type_alias_enum_variants)] + +type Alias<T> = Option<T>; + +fn main() { + let _ = Option::<u8>::None; // OK + let _ = Option::None::<u8>; // OK (Lint in future!) + let _ = Alias::<u8>::None; // OK + let _ = Alias::None::<u8>; // Error + //~^ type arguments are not allowed on this entity +} diff --git a/src/test/ui/type-alias-enum-variants.stderr b/src/test/ui/type-alias-enum-variants.stderr new file mode 100644 index 00000000000..cf81f5b27ac --- /dev/null +++ b/src/test/ui/type-alias-enum-variants.stderr @@ -0,0 +1,9 @@ +error[E0109]: type arguments are not allowed on this entity + --> $DIR/type-alias-enum-variants.rs:9:27 + | +LL | let _ = Alias::None::<u8>; // Error + | ^^ type argument not allowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr index 0297d883b8c..a576fdde117 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.stderr +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -187,16 +187,20 @@ LL | let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<<u8 as Tr>::Y as Trait>::NN` error[E0599]: no associated item named `NN` found for type `<u8 as Tr>::Y` in the current scope - --> $DIR/ufcs-partially-resolved.rs:38:5 + --> $DIR/ufcs-partially-resolved.rs:38:20 | LL | <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y` - | ^^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Tr>::Y` + | ---------------^^ + | | + | associated item not found in `<u8 as Tr>::Y` error[E0599]: no associated item named `N` found for type `<u8 as Dr>::X` in the current scope - --> $DIR/ufcs-partially-resolved.rs:55:5 + --> $DIR/ufcs-partially-resolved.rs:55:20 | LL | <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X` - | ^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Dr>::X` + | ---------------^ + | | + | associated item not found in `<u8 as Dr>::X` error: aborting due to 32 previous errors diff --git a/src/test/ui/unspecified-self-in-trait-ref.stderr b/src/test/ui/unspecified-self-in-trait-ref.stderr index cb7ee93338f..b295b39d33c 100644 --- a/src/test/ui/unspecified-self-in-trait-ref.stderr +++ b/src/test/ui/unspecified-self-in-trait-ref.stderr @@ -1,26 +1,34 @@ error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:10:13 + --> $DIR/unspecified-self-in-trait-ref.rs:10:18 | LL | let a = Foo::lol(); - | ^^^^^^^^ function or associated item not found in `dyn Foo<_>` + | -----^^^ + | | + | function or associated item not found in `dyn Foo<_>` error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:12:13 + --> $DIR/unspecified-self-in-trait-ref.rs:12:23 | LL | let b = Foo::<_>::lol(); - | ^^^^^^^^^^^^^ function or associated item not found in `dyn Foo<_>` + | ----------^^^ + | | + | function or associated item not found in `dyn Foo<_>` error[E0599]: no function or associated item named `lol` found for type `dyn Bar<_, _>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:14:13 + --> $DIR/unspecified-self-in-trait-ref.rs:14:18 | LL | let c = Bar::lol(); - | ^^^^^^^^ function or associated item not found in `dyn Bar<_, _>` + | -----^^^ + | | + | function or associated item not found in `dyn Bar<_, _>` error[E0599]: no function or associated item named `lol` found for type `dyn Bar<usize, _>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:16:13 + --> $DIR/unspecified-self-in-trait-ref.rs:16:30 | LL | let d = Bar::<usize, _>::lol(); - | ^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `dyn Bar<usize, _>` + | -----------------^^^ + | | + | function or associated item not found in `dyn Bar<usize, _>` error[E0393]: the type parameter `A` must be explicitly specified --> $DIR/unspecified-self-in-trait-ref.rs:18:13 |
