mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
test for non local anon const printing
This commit is contained in:
parent
4ca5368a12
commit
88f81a0de1
@ -0,0 +1,8 @@
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub struct Foo<const N: usize>;
|
||||
|
||||
pub fn foo<const N: usize>() -> Foo<{ N + 1 }> {
|
||||
Foo
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
// aux-build:anon_const_non_local.rs
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
extern crate anon_const_non_local;
|
||||
|
||||
fn bar<const M: usize>()
|
||||
where
|
||||
[(); M + 1]:,
|
||||
{
|
||||
let _: anon_const_non_local::Foo<2> = anon_const_non_local::foo::<M>();
|
||||
//~^ ERROR: mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,12 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/non_local_anon_const_diagnostics.rs:12:43
|
||||
|
|
||||
LL | let _: anon_const_non_local::Foo<2> = anon_const_non_local::foo::<M>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `_`
|
||||
|
|
||||
= note: expected constant `2`
|
||||
found constant `_`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user