[gccrs,COMMIT] testsuite: Add a testcase for issue 3537

Message ID 20260506163610.3196-1-gerris.rs@gmail.com
State New
Headers
Series [gccrs,COMMIT] testsuite: Add a testcase for issue 3537 |

Commit Message

gerris.rs@gmail.com May 6, 2026, 4:36 p.m. UTC
  From: Harishankar <harishankarpp7@gmail.com>

Fixes Rust-GCC/gccrs#3537
gcc/testsuite/ChangeLog:
	* rust/compile/issue-3537.rs: New test.

Signed-off-by: Harishankar <harishankarpp7@gmail.com>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: https://github.com/Rust-GCC/gccrs/commit/063b9d54b66f0b6f441445ec624c8966ee23a701

The commit has been mentioned in the following issue(s):
 - Rust-GCC/gccrs#3537: https://github.com/Rust-GCC/gccrs/issues/3537

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4546

 gcc/testsuite/rust/compile/issue-3537.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 gcc/testsuite/rust/compile/issue-3537.rs


base-commit: 9e6c8d48dfe5f011b81358266562d48258124b49
  

Patch

diff --git a/gcc/testsuite/rust/compile/issue-3537.rs b/gcc/testsuite/rust/compile/issue-3537.rs
new file mode 100644
index 000000000..59f749537
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-3537.rs
@@ -0,0 +1,18 @@ 
+#![feature(no_core)]
+#![no_core]
+
+// { dg-error "undeclared lang item: .*into_iter.*" "" { target *-*-* } 0 }
+
+fn main() {
+    'inner: while let Some(0u32) = None {
+    // { dg-error "Cannot find path .None. in this scope" "" { target *-*-* } .-1 }
+    // { dg-error "Cannot find path .Some. in this scope" "" { target *-*-* } .-2 }
+
+        let _ = Iterator::next(&mut ());
+        // { dg-error "Cannot find path .Iterator::next. in this scope" "" { target *-*-* } .-1 }
+
+        let _ = Iterator::next(&mut ());
+        // { dg-error "Cannot find path .Iterator::next. in this scope" "" { target *-*-* } .-1 }
+        for _ in false {}
+    }
+}
\ No newline at end of file