Skip to content

Commit dd45a20

Browse files
committed
Add test for const parameter type depending on type parameter
1 parent b4ec830 commit dd45a20

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type = "lib"]
12+
13+
pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0668]: const parameters cannot depend on type parameters
2+
--> $DIR/const-param-type-depends-on-type-param.rs:13:34
3+
|
4+
LL | pub struct Dependent<T, const X: T>([(); X]); //~ ERROR const parameters
5+
| ^ const parameter depends on type parameter
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0668`.

0 commit comments

Comments
 (0)