Skip to content

Commit 7112622

Browse files
committed
add UI test for issue #35144
1 parent b321edd commit 7112622

11 files changed

+61
-7
lines changed

src/tools/cargo

Submodule cargo updated 416 files

src/tools/tidy/src/ui_tests.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ use std::path::{Path, PathBuf};
1010

1111
const ENTRY_LIMIT: usize = 900;
1212
// FIXME: The following limits should be reduced eventually.
13-
const ISSUES_ENTRY_LIMIT: usize = 1893;
14-
const ROOT_ENTRY_LIMIT: usize = 872;
13+
// Max number of files under "./ui/issues"
14+
const ISSUES_ENTRY_LIMIT: usize = 1892;
15+
// Max number of files under "./ui"
16+
const ROOT_ENTRY_LIMIT: usize = 871;
1517

1618
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
1719
"rs", // test source files

tests/ui/type_id/auxiliary/a.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pub mod a {
2+
use std::cell::RefCell;
3+
4+
pub struct Arena<T> {
5+
chunks: RefCell<ChunkList<T>>,
6+
}
7+
8+
struct ChunkList<T> {
9+
current: Vec<T>,
10+
rest: Vec<Vec<T>>,
11+
}
12+
13+
impl<T> Arena<T> {
14+
pub fn new() -> Arena<T> {
15+
Arena {
16+
chunks: RefCell::new(ChunkList {
17+
current: Vec::with_capacity(12),
18+
rest: Vec::new(),
19+
}),
20+
}
21+
}
22+
}
23+
}

tests/ui/type_id/auxiliary/b.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod b {
2+
pub struct Unused {}
3+
}

tests/ui/issues/auxiliary/issue-13507.rs renamed to tests/ui/type_id/auxiliary/issue-13507.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// #13507: Fixed hashing of DefId for ty_enum
12
pub mod testtypes {
23
use std::any::TypeId;
34

@@ -18,7 +19,7 @@ pub mod testtypes {
1819
TypeId::of::<FooTuple>(),
1920
TypeId::of::<FooTrait>(),
2021
TypeId::of::<FooStruct>(),
21-
TypeId::of::<FooEnum>()
22+
TypeId::of::<FooEnum>(),
2223
]
2324
}
2425

@@ -66,13 +67,13 @@ pub mod testtypes {
6667
// Tests struct
6768
pub struct FooStruct {
6869
pub pub_foo_field: usize,
69-
foo_field: usize
70+
foo_field: usize,
7071
}
7172

7273
// Tests enum
7374
pub enum FooEnum {
7475
VarA(usize),
75-
VarB(usize, usize)
76+
VarB(usize, usize),
7677
}
7778

7879
// Tests Tuple

tests/ui/issues/issue-13507-2.rs renamed to tests/ui/type_id/issue-13507-fixed-hashing-DefId-for-ty_enum.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// #13507: Fixed hashing of DefId for ty_enum
12
// run-pass
23
#![allow(unused_imports)]
34
// aux-build:issue-13507.rs
@@ -25,7 +26,7 @@ pub fn type_ids() -> Vec<TypeId> {
2526
TypeId::of::<FooTuple>(),
2627
TypeId::of::<dyn FooTrait>(),
2728
TypeId::of::<FooStruct>(),
28-
TypeId::of::<FooEnum>()
29+
TypeId::of::<FooEnum>(),
2930
]
3031
}
3132

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// #35144: output should be the same with or without enabling the feature
2+
//
3+
// edition:2021
4+
// aux-build:a.rs
5+
// aux-build:b.rs
6+
// run-pass
7+
// compile-flags: --extern a --extern b --cfg feature="afirst" -A unused_imports -A dead_code
8+
#![feature(core_intrinsics, rustc_private)]
9+
10+
#[cfg(afirst)]
11+
use a;
12+
use b;
13+
#[cfg(not(afirst))]
14+
use a;
15+
16+
use std::intrinsics::type_id;
17+
18+
fn main() {
19+
println!(
20+
"{:?} {:?}",
21+
type_id::<a::a::Arena<()>>(),
22+
type_id::<dyn Iterator<Item = a::a::Arena<()>>>()
23+
);
24+
}
File renamed without changes.

0 commit comments

Comments
 (0)