Skip to content

Commit

Permalink
Rollup merge of rust-lang#107076 - megakorre:106419_add_test_case, r=…
Browse files Browse the repository at this point in the history
…compiler-errors

Added const-generic ui test case for issue rust-lang#106419

This PR adds a test case for rust-lang#106419 which has been fixed in master by rust-lang#105292

I also ran the test on f769d34 (the commit before rust-lang#105292 was merged)
and it did fail there with the following output.
```
--- stderr -------------------------------
error[E0308]: mismatched types
  --> /home/patrikk/src/rust/src/test/ui/const-generics/issue-106419-struct-with-multiple-const-params.rs:5:10
   |
LL | #[derive(Clone)]
   |          ^^^^^
   |          |
   |          expected `A`, found `B`
   |          expected `Bar<A, B>` because of return type
   |
   = note: expected struct `Bar<A, _>`
              found struct `Bar<B, _>`
   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
------------------------------------------
```
  • Loading branch information
matthiaskrgr authored Jan 20, 2023
2 parents 66a9006 + 8657cb8 commit 75655a9
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

#[derive(Clone)]
struct Bar<const A: usize, const B: usize>
where
[(); A as usize]:,
[(); B as usize]:,
{}

fn main() {}

0 comments on commit 75655a9

Please sign in to comment.