Skip to content

Commit c8b310e

Browse files
committed
add is_val_statically_known test
1 parent 6c9576c commit c8b310e

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

src/compile_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ run_test! {intrinsics,catch,stable}
705705
run_test! {intrinsics,cmp_bytes,stable}
706706
run_test! {intrinsics,copy_nonoverlaping,stable}
707707
run_test! {intrinsics,ctpop,stable}
708+
run_test! {intrinsics,is_val_statically_known,stable}
708709
run_test! {intrinsics,malloc,stable}
709710
run_test! {intrinsics,offset_of,unstable}
710711
run_test! {intrinsics,overflow_ops,stable}

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,10 @@ impl ArchiveBuilderBuilder for RlibArchiveBuilder {
320320
&self,
321321
_sess: &Session,
322322
_lib_name: &str,
323-
_dll_imports: std::vec::Vec<(std::string::String, std::option::Option<u16>)>,
323+
_dll_imports: &[rustc_session::cstore::DllImport],
324324
_tmpdir: &Path,
325-
) {
325+
_bool: bool,
326+
) -> PathBuf {
326327
unimplemented!("creating dll imports is not supported");
327328
}
328329
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#![feature(
2+
lang_items,
3+
adt_const_params,
4+
associated_type_defaults,
5+
core_intrinsics,
6+
start,
7+
unsized_const_params
8+
)]
9+
#![allow(internal_features, incomplete_features, unused_variables, dead_code)]
10+
#![no_std]
11+
include!("../common.rs");
12+
extern crate core;
13+
14+
use core::intrinsics::is_val_statically_known;
15+
16+
fn main() {
17+
test_eq!(is_val_statically_known(42), true);
18+
test_eq!(is_val_statically_known([42]), false);
19+
test_eq!(is_val_statically_known("42"), false);
20+
test_eq!(is_val_statically_known(FortyTwo {}), false);
21+
test_eq!(is_val_statically_known(FortyTwo {}.forty_two()), false);
22+
}
23+
24+
#[derive(Copy, Clone)]
25+
struct FortyTwo {}
26+
27+
trait Return {
28+
fn forty_two(&self) -> usize;
29+
}
30+
31+
impl Return for FortyTwo {
32+
fn forty_two(&self) -> usize {
33+
42
34+
}
35+
}

0 commit comments

Comments
 (0)