forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#71018 - lcnr:custom-const-param, r=eddyb
handle ConstValue::ByRef in relate fixes rust-lang#68615 r? @eddyb
- Loading branch information
Showing
7 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(const_generics)] | ||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash | ||
|
||
struct Const<const V: [usize; 1]> {} | ||
|
||
fn main() { | ||
let mut x = Const::<{ [3] }> {}; | ||
x = Const::<{ [4] }> {}; | ||
//~^ ERROR mismatched types | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash | ||
--> $DIR/different_byref.rs:1:12 | ||
| | ||
LL | #![feature(const_generics)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/different_byref.rs:8:9 | ||
| | ||
LL | x = Const::<{ [4] }> {}; | ||
| ^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `4usize` | ||
| | ||
= note: expected struct `Const<[3usize]>` | ||
found struct `Const<[4usize]>` | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Const<const V: [usize; 0]> {} | ||
type MyConst = Const<{ [] }>; | ||
|
||
fn main() { | ||
let _x = Const::<{ [] }> {}; | ||
let _y = MyConst {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<const V: [usize; 0] > {} | ||
|
||
type MyFoo = Foo<{ [] }>; | ||
|
||
fn main() { | ||
let _ = Foo::<{ [] }> {}; | ||
} |