rust/tests/ui/self/invalid-self-argument.rs
reddevilmidzy a4a79500b5 Cleaned up some tests
fix explicit-call-to-dtor.rs
fix explicit-call-to-supertrait-dtor.rs
merge issues/issue-17740.rs with lifetimes/explicit-self-lifetime-mismatch.rs
merge bare-fn-start.rs and trait-fn.rs into invalid-self-argument.rs
add comment tests/ui/traits/catch-unwind-cell-interior-mut
2025-12-01 19:51:20 +09:00

22 lines
662 B
Rust

//! regression test for <https://github.com/rust-lang/rust/issues/55972>
fn a(&self) {}
//~^ ERROR `self` parameter is only allowed in associated functions
//~| NOTE not semantically valid as function parameter
//~| NOTE associated functions are those in `impl` or `trait` definitions
fn b(foo: u32, &mut self) {}
//~^ ERROR unexpected `self` parameter in function
//~| NOTE must be the first parameter of an associated function
struct Foo {}
impl Foo {
fn c(foo: u32, self) {}
//~^ ERROR unexpected `self` parameter in function
//~| NOTE must be the first parameter of an associated function
fn good(&mut self, foo: u32) {}
}
fn main() {}