Skip to content

Commit 06ab34e

Browse files
committed
cleaned up some tests
1 parent aae43c4 commit 06ab34e

13 files changed

+98
-170
lines changed

tests/ui/char.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ui/class-cast-to-trait.rs

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/ui/class-cast-to-trait.stderr

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/ui/class-method-missing.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/ui/class-method-missing.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/ui/cleanup-rvalue-for-scope.rs

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//! Check that temporaries in the for into-iterable expr are not dropped
2+
//! until the end of the for expr.
3+
4+
//@ run-pass
5+
6+
static mut FLAGS: u64 = 0;
7+
8+
struct AddFlags {
9+
bits: u64,
10+
}
11+
12+
impl Drop for AddFlags {
13+
fn drop(&mut self) {
14+
unsafe {
15+
FLAGS += self.bits;
16+
}
17+
}
18+
}
19+
20+
fn check_flags(expected: u64) {
21+
unsafe {
22+
let actual = FLAGS;
23+
FLAGS = 0;
24+
assert_eq!(actual, expected, "flags {}, expected {}", actual, expected);
25+
}
26+
}
27+
28+
fn main() {
29+
for _ in &[AddFlags { bits: 1 }] {
30+
check_flags(0);
31+
}
32+
check_flags(1);
33+
}

tests/ui/cenum_impl_drop_cast.rs renamed to tests/ui/enum/enum-drop-cast-error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Check that trying to cast an enum with a Drop impl to an integer is rejected.
2+
//!
3+
//! Issue: <https://github.com/rust-lang/rust/issues/35941>
4+
15
enum E {
26
A = 0,
37
}

tests/ui/cenum_impl_drop_cast.stderr renamed to tests/ui/enum/enum-drop-cast-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot cast enum `E` into integer `u32` because it implements `Drop`
2-
--> $DIR/cenum_impl_drop_cast.rs:13:13
2+
--> $DIR/enum-drop-cast-error.rs:17:13
33
|
44
LL | let i = e as u32;
55
| ^^^^^^^^
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! Trait objects only allow access to methods defined in the trait.
2+
3+
trait MyTrait {
4+
fn trait_method(&mut self);
5+
}
6+
7+
struct ImplType;
8+
9+
impl MyTrait for ImplType {
10+
fn trait_method(&mut self) {}
11+
}
12+
13+
impl ImplType {
14+
fn struct_impl_method(&mut self) {}
15+
}
16+
17+
fn main() {
18+
let obj: Box<dyn MyTrait> = Box::new(ImplType);
19+
obj.struct_impl_method(); //~ ERROR no method named `struct_impl_method` found
20+
}

0 commit comments

Comments
 (0)