diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-28 18:59:25 -0500 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-06-28 19:07:29 -0500 |
| commit | 74657a4a1a8b18bed905bd997aa390a90a3b943f (patch) | |
| tree | e39102ef76ae0e98782b63ba06463db6fb7381ae /tests/ui/resolve/struct-function-same-name.rs | |
| parent | 3bc767e1a215c4bf8f099b32e84edb85780591b1 (diff) | |
| download | rust-74657a4a1a8b18bed905bd997aa390a90a3b943f.tar.gz rust-74657a4a1a8b18bed905bd997aa390a90a3b943f.zip | |
Move some UI tests to more apropriate directories
Prepare for rework done in the rest of [PR143118]. [PR143118]: https://www.github.com/rust-lang/rust/pull/143118 Co-authored-by: Kivooeo <Kivooeo123@gmail.com>
Diffstat (limited to 'tests/ui/resolve/struct-function-same-name.rs')
| -rw-r--r-- | tests/ui/resolve/struct-function-same-name.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/resolve/struct-function-same-name.rs b/tests/ui/resolve/struct-function-same-name.rs new file mode 100644 index 00000000000..338a3156a9a --- /dev/null +++ b/tests/ui/resolve/struct-function-same-name.rs @@ -0,0 +1,32 @@ +//@ run-pass + +#![allow(non_snake_case)] +trait Product { + fn product(&self) -> isize; +} + +struct Foo { + x: isize, + y: isize, +} + +impl Foo { + pub fn sum(&self) -> isize { + self.x + self.y + } +} + +impl Product for Foo { + fn product(&self) -> isize { + self.x * self.y + } +} + +fn Foo(x: isize, y: isize) -> Foo { + Foo { x: x, y: y } +} + +pub fn main() { + let foo = Foo(3, 20); + println!("{} {}", foo.sum(), foo.product()); +} |
