Skip to content

Move some stdlib tests from tests/ui to library/std/tests #124497

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

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 3 additions & 15 deletions library/std/tests/builtin-clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn test_clone<T: Clone>(arg: T) {
let _ = arg.clone();
}

fn foo() { }
fn foo() {}

#[derive(Debug, PartialEq, Eq)]
struct S(i32);
Expand All @@ -27,19 +27,7 @@ fn builtin_clone() {
let b = [S(1), S(2), S(3)];
assert_eq!(b, a.clone());

let a = (
(S(1), S(0)),
(
(S(0), S(0), S(1)),
S(0)
)
);
let b = (
(S(2), S(1)),
(
(S(1), S(1), S(2)),
S(1)
)
);
let a = ((S(1), S(0)), ((S(0), S(0), S(1)), S(0)));
let b = ((S(2), S(1)), ((S(1), S(1), S(2)), S(1)));
assert_eq!(b, a.clone());
}
32 changes: 27 additions & 5 deletions library/std/tests/eq-multidispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,35 @@ struct Foo;
#[derive(Debug)]
struct Fu;

impl PartialEq for Baz { fn eq(&self, _: &Baz) -> bool { true } }
impl PartialEq for Baz {
fn eq(&self, _: &Baz) -> bool {
true
}
}

impl PartialEq<Fu> for Foo {
fn eq(&self, _: &Fu) -> bool {
true
}
}

impl PartialEq<Fu> for Foo { fn eq(&self, _: &Fu) -> bool { true } }
impl PartialEq<Foo> for Fu { fn eq(&self, _: &Foo) -> bool { true } }
impl PartialEq<Foo> for Fu {
fn eq(&self, _: &Foo) -> bool {
true
}
}

impl PartialEq<Bar> for Foo { fn eq(&self, _: &Bar) -> bool { false } }
impl PartialEq<Foo> for Bar { fn eq(&self, _: &Foo) -> bool { false } }
impl PartialEq<Bar> for Foo {
fn eq(&self, _: &Bar) -> bool {
false
}
}

impl PartialEq<Foo> for Bar {
fn eq(&self, _: &Foo) -> bool {
false
}
}

#[test]
fn eq_multidispatch() {
Expand Down
10 changes: 8 additions & 2 deletions library/std/tests/issue-21058.rs
Copy link
Member

Choose a reason for hiding this comment

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

Please try to give an actual name to this test. What is it testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the name and moved the description into the function's doc comment.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
use std::fmt::Debug;

struct NT(str);
struct DST { a: u32, b: str }

struct DST {
a: u32,
b: str,
}

macro_rules! check {
(val: $ty_of:expr, $expected:expr) => {
Expand Down Expand Up @@ -56,7 +60,9 @@ fn type_name_of_val<T>(_: T) -> &'static str {
struct Foo;

impl Foo {
fn new() -> Self { Foo }
fn new() -> Self {
Foo
}
}

fn foo() -> impl Debug {
Expand Down
4 changes: 3 additions & 1 deletion library/std/tests/istr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ fn test_stack_assign() {
}

#[test]
fn test_heap_lit() { "a big string".to_string(); }
fn test_heap_lit() {
"a big string".to_string();
}

#[test]
fn test_heap_assign() {
Expand Down
4 changes: 2 additions & 2 deletions library/std/tests/log-knows-the-names-of-variants-in-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#[derive(Clone, Debug)]
enum foo {
a(usize),
b(String),
a(usize),
b(String),
}

fn check_log<T: std::fmt::Debug>(exp: String, v: T) {
Expand Down
4 changes: 2 additions & 2 deletions library/std/tests/minmax-stability-issue-23687.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::fmt::Debug;
use std::cmp::{self, Ordering};
use std::fmt::Debug;

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Foo {
n: u8,
name: &'static str
name: &'static str,
}

impl PartialOrd for Foo {
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3862,7 +3862,6 @@ ui/statics/issue-91050-1.rs
ui/statics/issue-91050-2.rs
ui/std/issue-3563-3.rs
ui/std/issue-81357-unsound-file-methods.rs
ui/stdlib-unit-tests/issue-21058.rs
ui/structs-enums/enum-rec/issue-17431-6.rs
ui/structs-enums/enum-rec/issue-17431-7.rs
ui/structs-enums/issue-103869.rs
Expand Down
Loading