mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Add test for delegation inside const body
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#![feature(min_generic_const_args)]
|
||||
#![feature(fn_delegation)]
|
||||
|
||||
pub struct S<const N: usize>;
|
||||
|
||||
impl
|
||||
S<
|
||||
{ //~ ERROR: complex const arguments must be placed inside of a `const` block
|
||||
fn foo() {}
|
||||
reuse foo::<> as bar;
|
||||
reuse bar;
|
||||
//~^ ERROR: the name `bar` is defined multiple times
|
||||
},
|
||||
>
|
||||
{
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,24 @@
|
||||
error[E0428]: the name `bar` is defined multiple times
|
||||
--> $DIR/inside-const-body-ice-155300.rs:11:13
|
||||
|
|
||||
LL | reuse foo::<> as bar;
|
||||
| --------------------- previous definition of the value `bar` here
|
||||
LL | reuse bar;
|
||||
| ^^^^^^^^^^ `bar` redefined here
|
||||
|
|
||||
= note: `bar` must be defined only once in the value namespace of this block
|
||||
|
||||
error: complex const arguments must be placed inside of a `const` block
|
||||
--> $DIR/inside-const-body-ice-155300.rs:8:9
|
||||
|
|
||||
LL | / {
|
||||
LL | | fn foo() {}
|
||||
LL | | reuse foo::<> as bar;
|
||||
LL | | reuse bar;
|
||||
LL | |
|
||||
LL | | },
|
||||
| |_________^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0428`.
|
||||
Reference in New Issue
Block a user