Skip to content

Commit

Permalink
add UI test for issue #35144
Browse files Browse the repository at this point in the history
  • Loading branch information
apiraino committed Jul 31, 2023
1 parent b321edd commit 7112622
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 416 files
6 changes: 4 additions & 2 deletions src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ use std::path::{Path, PathBuf};

const ENTRY_LIMIT: usize = 900;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: usize = 1893;
const ROOT_ENTRY_LIMIT: usize = 872;
// Max number of files under "./ui/issues"
const ISSUES_ENTRY_LIMIT: usize = 1892;
// Max number of files under "./ui"
const ROOT_ENTRY_LIMIT: usize = 871;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
23 changes: 23 additions & 0 deletions tests/ui/type_id/auxiliary/a.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pub mod a {
use std::cell::RefCell;

pub struct Arena<T> {
chunks: RefCell<ChunkList<T>>,
}

struct ChunkList<T> {
current: Vec<T>,
rest: Vec<Vec<T>>,
}

impl<T> Arena<T> {
pub fn new() -> Arena<T> {
Arena {
chunks: RefCell::new(ChunkList {
current: Vec::with_capacity(12),
rest: Vec::new(),
}),
}
}
}
}
3 changes: 3 additions & 0 deletions tests/ui/type_id/auxiliary/b.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod b {
pub struct Unused {}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// #13507: Fixed hashing of DefId for ty_enum
pub mod testtypes {
use std::any::TypeId;

Expand All @@ -18,7 +19,7 @@ pub mod testtypes {
TypeId::of::<FooTuple>(),
TypeId::of::<FooTrait>(),
TypeId::of::<FooStruct>(),
TypeId::of::<FooEnum>()
TypeId::of::<FooEnum>(),
]
}

Expand Down Expand Up @@ -66,13 +67,13 @@ pub mod testtypes {
// Tests struct
pub struct FooStruct {
pub pub_foo_field: usize,
foo_field: usize
foo_field: usize,
}

// Tests enum
pub enum FooEnum {
VarA(usize),
VarB(usize, usize)
VarB(usize, usize),
}

// Tests Tuple
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// #13507: Fixed hashing of DefId for ty_enum
// run-pass
#![allow(unused_imports)]
// aux-build:issue-13507.rs
Expand Down Expand Up @@ -25,7 +26,7 @@ pub fn type_ids() -> Vec<TypeId> {
TypeId::of::<FooTuple>(),
TypeId::of::<dyn FooTrait>(),
TypeId::of::<FooStruct>(),
TypeId::of::<FooEnum>()
TypeId::of::<FooEnum>(),
]
}

Expand Down
24 changes: 24 additions & 0 deletions tests/ui/type_id/issue-35144-typeid-output-same-ignore-cfgs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// #35144: output should be the same with or without enabling the feature
//
// edition:2021
// aux-build:a.rs
// aux-build:b.rs
// run-pass
// compile-flags: --extern a --extern b --cfg feature="afirst" -A unused_imports -A dead_code
#![feature(core_intrinsics, rustc_private)]

#[cfg(afirst)]
use a;
use b;
#[cfg(not(afirst))]
use a;

use std::intrinsics::type_id;

fn main() {
println!(
"{:?} {:?}",
type_id::<a::a::Arena<()>>(),
type_id::<dyn Iterator<Item = a::a::Arena<()>>>()
);
}
File renamed without changes.
File renamed without changes.

0 comments on commit 7112622

Please sign in to comment.