Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI test for issue #35144 #114092

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Comment on lines +13 to +16
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I shouldnt need to touch this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless maybe you're moving things out of this folder. Otherwise, you are already adding a tests in a subfolder, so things should be fine from that point.


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
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.
Loading