Cleaned up 5 tests in tests/ui
This commit is contained in:
parent
645d0ad2a4
commit
db2a73e284
11 changed files with 44 additions and 41 deletions
|
|
@ -1,21 +0,0 @@
|
|||
#[derive(Debug)]
|
||||
struct Foo {
|
||||
i: isize,
|
||||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn foo(i:isize) -> Foo {
|
||||
Foo {
|
||||
i: i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = x.clone();
|
||||
//~^ ERROR no method named `clone` found
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error: no rules expected `@`
|
||||
--> $DIR/fail-simple.rs:2:12
|
||||
--> $DIR/no-matching-rule.rs:2:12
|
||||
|
|
||||
LL | panic!(@);
|
||||
| ^ no rules expected this token in macro call
|
||||
19
tests/ui/methods/clone-missing.rs
Normal file
19
tests/ui/methods/clone-missing.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
|
||||
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
|
||||
// so attempting to clone it should fail.
|
||||
|
||||
struct Foo {
|
||||
i: isize,
|
||||
}
|
||||
|
||||
fn foo(i:isize) -> Foo {
|
||||
Foo {
|
||||
i: i
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = foo(10);
|
||||
let _y = x.clone();
|
||||
//~^ ERROR no method named `clone` found
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
|
||||
--> $DIR/copy-a-resource.rs:18:16
|
||||
--> $DIR/clone-missing.rs:17:16
|
||||
|
|
||||
LL | struct Foo {
|
||||
| ---------- method `clone` not found for this struct
|
||||
11
tests/ui/modules/mod-pub-access.rs
Normal file
11
tests/ui/modules/mod-pub-access.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//@ run-pass
|
||||
// This is a name resolution smoke test that ensures paths with more than one
|
||||
// segment (e.g., `foo::bar`) resolve correctly.
|
||||
// It also serves as a basic visibility test — confirming that a `pub` item
|
||||
// inside a private module can still be accessed from outside that module.
|
||||
|
||||
mod foo {
|
||||
pub fn bar(_offset: usize) {}
|
||||
}
|
||||
|
||||
fn main() { foo::bar(0); }
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
mod foo {
|
||||
pub fn bar(_offset: usize) { }
|
||||
}
|
||||
|
||||
pub fn main() { foo::bar(0); }
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0434]: can't capture dynamic environment in a fn item
|
||||
--> $DIR/capture1.rs:3:32
|
||||
--> $DIR/fn-item-cant-capture-dynamic-env.rs:3:32
|
||||
|
|
||||
LL | fn foo() -> isize { return bar; }
|
||||
| ^^^
|
||||
11
tests/ui/type-alias/type-param.rs
Normal file
11
tests/ui/type-alias/type-param.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//@ run-pass
|
||||
// This is a smoke test to ensure that type aliases with type parameters
|
||||
// are accepted by the compiler and that the parameters are correctly
|
||||
// resolved in the aliased item type.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
type Foo<T> = extern "C" fn(T) -> bool;
|
||||
type Bar<T> = fn(T) -> bool;
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
//@ run-pass
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
||||
|
||||
type lteq<T> = extern "C" fn(T) -> bool;
|
||||
|
||||
pub fn main() { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue