about summary refs log tree commit diff
path: root/tests/ui/parser/integer-literal-method-call-underscore.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/integer-literal-method-call-underscore.rs')
-rw-r--r--tests/ui/parser/integer-literal-method-call-underscore.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/parser/integer-literal-method-call-underscore.rs b/tests/ui/parser/integer-literal-method-call-underscore.rs
new file mode 100644
index 00000000000..9e4abf28cba
--- /dev/null
+++ b/tests/ui/parser/integer-literal-method-call-underscore.rs
@@ -0,0 +1,15 @@
+//! Checks that methods with names starting with an underscore (`_`) can be
+//! successfully called directly on integer literals, confirming the correct
+//! parsing of such expressions where the underscore is part of the method identifier.
+
+//@ run-pass
+
+trait Tr: Sized {
+    fn _method_on_numbers(self) {}
+}
+
+impl Tr for i32 {}
+
+fn main() {
+    42._method_on_numbers();
+}