diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-10-14 10:47:14 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-10-14 10:47:14 +0900 |
| commit | 88a495cdcff92a7322c5721da3dc12acc04fb1a9 (patch) | |
| tree | 1df8157e1390c1738ab5b3b5ff044926f5ca034b | |
| parent | f653db92d691ba3ebeb77dc75b6cb51cbf31519b (diff) | |
| download | rust-88a495cdcff92a7322c5721da3dc12acc04fb1a9.tar.gz rust-88a495cdcff92a7322c5721da3dc12acc04fb1a9.zip | |
Add test for issue-48027
| -rw-r--r-- | src/test/ui/associated-item/issue-48027.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/associated-item/issue-48027.stderr | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/associated-item/issue-48027.rs b/src/test/ui/associated-item/issue-48027.rs new file mode 100644 index 00000000000..c9b4ccd3e8a --- /dev/null +++ b/src/test/ui/associated-item/issue-48027.rs @@ -0,0 +1,8 @@ +trait Bar { + const X: usize; + fn return_n(&self) -> [u8; Bar::X]; //~ ERROR: type annotations needed +} + +impl dyn Bar {} //~ ERROR: the trait `Bar` cannot be made into an object + +fn main() {} diff --git a/src/test/ui/associated-item/issue-48027.stderr b/src/test/ui/associated-item/issue-48027.stderr new file mode 100644 index 00000000000..562146a426d --- /dev/null +++ b/src/test/ui/associated-item/issue-48027.stderr @@ -0,0 +1,21 @@ +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-48027.rs:6:6 + | +LL | const X: usize; + | - the trait cannot contain associated consts like `X` +... +LL | impl dyn Bar {} + | ^^^^^^^ the trait `Bar` cannot be made into an object + +error[E0283]: type annotations needed: cannot resolve `_: Bar` + --> $DIR/issue-48027.rs:3:32 + | +LL | const X: usize; + | --------------- required by `Bar::X` +LL | fn return_n(&self) -> [u8; Bar::X]; + | ^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0038, E0283. +For more information about an error, try `rustc --explain E0038`. |
