summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-consts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/associated-consts')
-rw-r--r--tests/ui/associated-consts/associated-const-ambiguity-report.stderr8
-rw-r--r--tests/ui/associated-consts/defaults-not-assumed-fail.stderr1
-rw-r--r--tests/ui/associated-consts/issue-105330.rs10
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr82
-rw-r--r--tests/ui/associated-consts/issue-58022.rs1
-rw-r--r--tests/ui/associated-consts/issue-58022.stderr22
6 files changed, 32 insertions, 92 deletions
diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
index 5435f2232..e39224f2c 100644
--- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
+++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
@@ -14,14 +14,12 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
|
LL | const ID: i32 = 3;
| ^^^^^^^^^^^^^
-help: disambiguate the associated constant for candidate #1
- |
-LL | const X: i32 = <i32 as Foo>::ID;
- | ~~~~~~~~~~~~~~
-help: disambiguate the associated constant for candidate #2
+help: use fully-qualified syntax to disambiguate
|
LL | const X: i32 = <i32 as Bar>::ID;
| ~~~~~~~~~~~~~~
+LL | const X: i32 = <i32 as Foo>::ID;
+ | ~~~~~~~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
index d65991234..ac5ec8e05 100644
--- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
+++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
@@ -24,6 +24,7 @@ note: erroneous constant encountered
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-105330.rs b/tests/ui/associated-consts/issue-105330.rs
index 86e45f10b..6c6dae864 100644
--- a/tests/ui/associated-consts/issue-105330.rs
+++ b/tests/ui/associated-consts/issue-105330.rs
@@ -9,13 +9,11 @@ impl TraitWAssocConst for impl Demo { //~ ERROR E0404
}
fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658
- foo::<Demo>()(); //~ ERROR E0271
- //~^ ERROR E0618
- //~| ERROR E0277
+ foo::<Demo>()();
}
-fn main<A: TraitWAssocConst<A=32>>() { //~ ERROR E0131
+fn main<A: TraitWAssocConst<A=32>>() {
//~^ ERROR E0658
- foo::<Demo>(); //~ ERROR E0277
- //~^ ERROR E0271
+ //~| ERROR E0131
+ foo::<Demo>();
}
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index 927422fa8..aeedf6b19 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -25,7 +25,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() {
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
error[E0658]: associated const equality is incomplete
- --> $DIR/issue-105330.rs:17:29
+ --> $DIR/issue-105330.rs:15:29
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^
@@ -33,91 +33,19 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
--> $DIR/issue-105330.rs:6:27
|
LL | impl TraitWAssocConst for impl Demo {
| ^^^^^^^^^
error[E0131]: `main` function is not allowed to have generic parameters
- --> $DIR/issue-105330.rs:17:8
+ --> $DIR/issue-105330.rs:15:8
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:12:11
- |
-LL | foo::<Demo>()();
- | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
- |
-help: this trait has no implementations, consider adding one
- --> $DIR/issue-105330.rs:1:1
- |
-LL | pub trait TraitWAssocConst {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:11
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:12:11
- |
-LL | foo::<Demo>()();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error[E0618]: expected function, found `()`
- --> $DIR/issue-105330.rs:12:5
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ----------------------------------- `foo::<Demo>` defined here returns `()`
-LL | foo::<Demo>()();
- | ^^^^^^^^^^^^^--
- | |
- | call expression requires function
-
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:19:11
- |
-LL | foo::<Demo>();
- | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
- |
-help: this trait has no implementations, consider adding one
- --> $DIR/issue-105330.rs:1:1
- |
-LL | pub trait TraitWAssocConst {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:11
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:19:11
- |
-LL | foo::<Demo>();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error: aborting due to 11 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658.
+Some errors have detailed explanations: E0131, E0404, E0562, E0658.
For more information about an error, try `rustc --explain E0131`.
diff --git a/tests/ui/associated-consts/issue-58022.rs b/tests/ui/associated-consts/issue-58022.rs
index 2a8a1eaa6..8e2a441f2 100644
--- a/tests/ui/associated-consts/issue-58022.rs
+++ b/tests/ui/associated-consts/issue-58022.rs
@@ -11,6 +11,7 @@ impl Bar<[u8]> {
const SIZE: usize = 32;
fn new(slice: &[u8; Self::SIZE]) -> Self {
+ //~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
Foo(Box::new(*slice))
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
}
diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr
index 56d85c066..82cbc9ed3 100644
--- a/tests/ui/associated-consts/issue-58022.stderr
+++ b/tests/ui/associated-consts/issue-58022.stderr
@@ -7,13 +7,27 @@ LL |
LL | fn new(slice: &[u8; Foo::SIZE]) -> Self;
| ^^^^^^^^^ cannot refer to the associated constant of trait
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/issue-58022.rs:13:41
+ |
+LL | fn new(slice: &[u8; Self::SIZE]) -> Self {
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`
+note: required because it appears within the type `Bar<[u8]>`
+ --> $DIR/issue-58022.rs:8:12
+ |
+LL | pub struct Bar<T: ?Sized>(T);
+ | ^^^
+ = note: the return type of a function must have a statically known size
+
error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo`
- --> $DIR/issue-58022.rs:14:9
+ --> $DIR/issue-58022.rs:15:9
|
LL | Foo(Box::new(*slice))
| ^^^ not a function, tuple struct or tuple variant
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0423, E0790.
-For more information about an error, try `rustc --explain E0423`.
+Some errors have detailed explanations: E0277, E0423, E0790.
+For more information about an error, try `rustc --explain E0277`.