diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/confuse-field-and-method | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/confuse-field-and-method')
10 files changed, 0 insertions, 378 deletions
diff --git a/src/test/ui/confuse-field-and-method/issue-18343.rs b/src/test/ui/confuse-field-and-method/issue-18343.rs deleted file mode 100644 index bc2d73fae..000000000 --- a/src/test/ui/confuse-field-and-method/issue-18343.rs +++ /dev/null @@ -1,9 +0,0 @@ -struct Obj<F> where F: FnMut() -> u32 { - closure: F, -} - -fn main() { - let o = Obj { closure: || 42 }; - o.closure(); - //~^ ERROR no method named `closure` found -} diff --git a/src/test/ui/confuse-field-and-method/issue-18343.stderr b/src/test/ui/confuse-field-and-method/issue-18343.stderr deleted file mode 100644 index 1c9a6847c..000000000 --- a/src/test/ui/confuse-field-and-method/issue-18343.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0599]: no method named `closure` found for struct `Obj` in the current scope - --> $DIR/issue-18343.rs:7:7 - | -LL | struct Obj<F> where F: FnMut() -> u32 { - | ------------- method `closure` not found for this struct -... -LL | o.closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (o.closure)(); - | + + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/confuse-field-and-method/issue-2392.rs b/src/test/ui/confuse-field-and-method/issue-2392.rs deleted file mode 100644 index 8aef091fe..000000000 --- a/src/test/ui/confuse-field-and-method/issue-2392.rs +++ /dev/null @@ -1,69 +0,0 @@ -struct FuncContainer { - f1: fn(data: u8), - f2: extern "C" fn(data: u8), - f3: unsafe fn(data: u8), -} - -struct FuncContainerOuter { - container: Box<FuncContainer> -} - -struct Obj<F> where F: FnOnce() -> u32 { - closure: F, - not_closure: usize, -} - -struct BoxedObj { - boxed_closure: Box<dyn FnOnce() -> u32>, -} - -struct Wrapper<F> where F: FnMut() -> u32 { - wrap: Obj<F>, -} - -fn func() -> u32 { - 0 -} - -fn check_expression() -> Obj<Box<dyn FnOnce() -> u32>> { - Obj { closure: Box::new(|| 42_u32) as Box<dyn FnOnce() -> u32>, not_closure: 42 } -} - -fn main() { - // test variations of function - - let o_closure = Obj { closure: || 42, not_closure: 42 }; - o_closure.closure(); //~ ERROR no method named `closure` found - - o_closure.not_closure(); - //~^ ERROR no method named `not_closure` found - - let o_func = Obj { closure: func, not_closure: 5 }; - o_func.closure(); //~ ERROR no method named `closure` found - - let boxed_fn = BoxedObj { boxed_closure: Box::new(func) }; - boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found - - let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<dyn FnOnce() -> u32> }; - boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found - - // test expression writing in the notes - - let w = Wrapper { wrap: o_func }; - w.wrap.closure();//~ ERROR no method named `closure` found - - w.wrap.not_closure(); - //~^ ERROR no method named `not_closure` found - - check_expression().closure();//~ ERROR no method named `closure` found -} - -impl FuncContainerOuter { - fn run(&self) { - unsafe { - (*self.container).f1(1); //~ ERROR no method named `f1` found - (*self.container).f2(1); //~ ERROR no method named `f2` found - (*self.container).f3(1); //~ ERROR no method named `f3` found - } - } -} diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr deleted file mode 100644 index 440fbb27c..000000000 --- a/src/test/ui/confuse-field-and-method/issue-2392.stderr +++ /dev/null @@ -1,151 +0,0 @@ -error[E0599]: no method named `closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:36:15 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `closure` not found for this struct -... -LL | o_closure.closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (o_closure.closure)(); - | + + - -error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:38:15 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `not_closure` not found for this struct -... -LL | o_closure.not_closure(); - | ^^^^^^^^^^^-- help: remove the arguments - | | - | field, not a method - -error[E0599]: no method named `closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:42:12 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `closure` not found for this struct -... -LL | o_func.closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (o_func.closure)(); - | + + - -error[E0599]: no method named `boxed_closure` found for struct `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:45:14 - | -LL | struct BoxedObj { - | --------------- method `boxed_closure` not found for this struct -... -LL | boxed_fn.boxed_closure(); - | ^^^^^^^^^^^^^ field, not a method - | -help: to call the function stored in `boxed_closure`, surround the field access with parentheses - | -LL | (boxed_fn.boxed_closure)(); - | + + - -error[E0599]: no method named `boxed_closure` found for struct `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:48:19 - | -LL | struct BoxedObj { - | --------------- method `boxed_closure` not found for this struct -... -LL | boxed_closure.boxed_closure(); - | ^^^^^^^^^^^^^ field, not a method - | -help: to call the function stored in `boxed_closure`, surround the field access with parentheses - | -LL | (boxed_closure.boxed_closure)(); - | + + - -error[E0599]: no method named `closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:53:12 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `closure` not found for this struct -... -LL | w.wrap.closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (w.wrap.closure)(); - | + + - -error[E0599]: no method named `not_closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:55:12 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `not_closure` not found for this struct -... -LL | w.wrap.not_closure(); - | ^^^^^^^^^^^-- help: remove the arguments - | | - | field, not a method - -error[E0599]: no method named `closure` found for struct `Obj` in the current scope - --> $DIR/issue-2392.rs:58:24 - | -LL | struct Obj<F> where F: FnOnce() -> u32 { - | ------------- method `closure` not found for this struct -... -LL | check_expression().closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (check_expression().closure)(); - | + + - -error[E0599]: no method named `f1` found for struct `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:64:31 - | -LL | struct FuncContainer { - | -------------------- method `f1` not found for this struct -... -LL | (*self.container).f1(1); - | ^^ field, not a method - | -help: to call the function stored in `f1`, surround the field access with parentheses - | -LL | ((*self.container).f1)(1); - | + + - -error[E0599]: no method named `f2` found for struct `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:65:31 - | -LL | struct FuncContainer { - | -------------------- method `f2` not found for this struct -... -LL | (*self.container).f2(1); - | ^^ field, not a method - | -help: to call the function stored in `f2`, surround the field access with parentheses - | -LL | ((*self.container).f2)(1); - | + + - -error[E0599]: no method named `f3` found for struct `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:66:31 - | -LL | struct FuncContainer { - | -------------------- method `f3` not found for this struct -... -LL | (*self.container).f3(1); - | ^^ field, not a method - | -help: to call the function stored in `f3`, surround the field access with parentheses - | -LL | ((*self.container).f3)(1); - | + + - -error: aborting due to 11 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/confuse-field-and-method/issue-32128.rs b/src/test/ui/confuse-field-and-method/issue-32128.rs deleted file mode 100644 index 5a024aa4b..000000000 --- a/src/test/ui/confuse-field-and-method/issue-32128.rs +++ /dev/null @@ -1,15 +0,0 @@ -struct Example { - example: Box<dyn Fn(i32) -> i32> -} - -fn main() { - let demo = Example { - example: Box::new(|x| { - x + 1 - }) - }; - - demo.example(1); - //~^ ERROR no method named `example` - // (demo.example)(1); -} diff --git a/src/test/ui/confuse-field-and-method/issue-32128.stderr b/src/test/ui/confuse-field-and-method/issue-32128.stderr deleted file mode 100644 index 4b96bce8d..000000000 --- a/src/test/ui/confuse-field-and-method/issue-32128.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0599]: no method named `example` found for struct `Example` in the current scope - --> $DIR/issue-32128.rs:12:10 - | -LL | struct Example { - | -------------- method `example` not found for this struct -... -LL | demo.example(1); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `example`, surround the field access with parentheses - | -LL | (demo.example)(1); - | + + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/confuse-field-and-method/issue-33784.rs b/src/test/ui/confuse-field-and-method/issue-33784.rs deleted file mode 100644 index e9bb1f9fb..000000000 --- a/src/test/ui/confuse-field-and-method/issue-33784.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::ops::Deref; - -struct Obj<F> where F: FnMut() -> u32 { - fn_ptr: fn() -> (), - closure: F, -} - -struct C { - c_fn_ptr: fn() -> (), -} - -struct D(C); - -impl Deref for D { - type Target = C; - fn deref(&self) -> &C { - &self.0 - } -} - - -fn empty() {} - -fn main() { - let o = Obj { fn_ptr: empty, closure: || 42 }; - let p = &o; - p.closure(); //~ ERROR no method named `closure` found - let q = &p; - q.fn_ptr(); //~ ERROR no method named `fn_ptr` found - let r = D(C { c_fn_ptr: empty }); - let s = &r; - s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found -} diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr deleted file mode 100644 index 34debb683..000000000 --- a/src/test/ui/confuse-field-and-method/issue-33784.stderr +++ /dev/null @@ -1,36 +0,0 @@ -error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope - --> $DIR/issue-33784.rs:27:7 - | -LL | p.closure(); - | ^^^^^^^ field, not a method - | -help: to call the function stored in `closure`, surround the field access with parentheses - | -LL | (p.closure)(); - | + + - -error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope - --> $DIR/issue-33784.rs:29:7 - | -LL | q.fn_ptr(); - | ^^^^^^ field, not a method - | -help: to call the function stored in `fn_ptr`, surround the field access with parentheses - | -LL | (q.fn_ptr)(); - | + + - -error[E0599]: no method named `c_fn_ptr` found for reference `&D` in the current scope - --> $DIR/issue-33784.rs:32:7 - | -LL | s.c_fn_ptr(); - | ^^^^^^^^ field, not a method - | -help: to call the function stored in `c_fn_ptr`, surround the field access with parentheses - | -LL | (s.c_fn_ptr)(); - | + + - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/confuse-field-and-method/private-field.rs b/src/test/ui/confuse-field-and-method/private-field.rs deleted file mode 100644 index 28b8935ac..000000000 --- a/src/test/ui/confuse-field-and-method/private-field.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod animal { - pub struct Dog { - pub age: usize, - dog_age: usize, - } - - impl Dog { - pub fn new(age: usize) -> Dog { - Dog { age: age, dog_age: age * 7 } - } - } -} - -fn main() { - let dog = animal::Dog::new(3); - let dog_age = dog.dog_age(); //~ ERROR no method - //let dog_age = dog.dog_age; - println!("{}", dog_age); -} diff --git a/src/test/ui/confuse-field-and-method/private-field.stderr b/src/test/ui/confuse-field-and-method/private-field.stderr deleted file mode 100644 index 783378f8d..000000000 --- a/src/test/ui/confuse-field-and-method/private-field.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0599]: no method named `dog_age` found for struct `Dog` in the current scope - --> $DIR/private-field.rs:16:23 - | -LL | pub struct Dog { - | -------------- method `dog_age` not found for this struct -... -LL | let dog_age = dog.dog_age(); - | ^^^^^^^ private field, not a method - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. |