Skip to content

Commit

Permalink
Rollup merge of rust-lang#78996 - lcnr:cg-promotion, r=RalfJung
Browse files Browse the repository at this point in the history
add explicit test for const param promotion

r? `@RalfJung`
  • Loading branch information
GuillaumeGomez committed Nov 13, 2020
2 parents 22cc878 + c56add0 commit 7ea8e32
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/ui/const-generics/promotion.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// run-pass
// tests that promoting expressions containing const parameters is allowed.
#![feature(min_const_generics)]

fn promotion_test<const N: usize>() -> &'static usize {
&(3 + N)
}

fn main() {
assert_eq!(promotion_test::<13>(), &16);
}

0 comments on commit 7ea8e32

Please sign in to comment.