summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-47364.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/issues/issue-47364.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/issues/issue-47364.rs')
-rw-r--r--tests/ui/issues/issue-47364.rs59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-47364.rs b/tests/ui/issues/issue-47364.rs
new file mode 100644
index 000000000..b524354d9
--- /dev/null
+++ b/tests/ui/issues/issue-47364.rs
@@ -0,0 +1,59 @@
+// run-pass
+#![allow(unused_variables)]
+// compile-flags: -C codegen-units=8 -O
+#![allow(non_snake_case)]
+
+fn main() {
+ nom_sql::selection(b"x ");
+}
+
+pub enum Err<P>{
+ Position(P),
+ NodePosition(u32),
+}
+
+pub enum IResult<I,O> {
+ Done(I,O),
+ Error(Err<I>),
+ Incomplete(u32, u64)
+}
+
+pub fn multispace<T: Copy>(input: T) -> ::IResult<i8, i8> {
+ ::IResult::Done(0, 0)
+}
+
+mod nom_sql {
+ fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option<String>> {
+ let X = match ::multispace(i) {
+ ::IResult::Done(..) => ::IResult::Done(i, None::<String>),
+ _ => ::IResult::Error(::Err::NodePosition(0)),
+ };
+ match X {
+ ::IResult::Done(_, _) => ::IResult::Done(i, None),
+ _ => X
+ }
+ }
+
+ pub fn selection(i: &[u8]) {
+ let Y = match {
+ match {
+ where_clause(i)
+ } {
+ ::IResult::Done(_, o) => ::IResult::Done(i, Some(o)),
+ ::IResult::Error(_) => ::IResult::Done(i, None),
+ _ => ::IResult::Incomplete(0, 0),
+ }
+ } {
+ ::IResult::Done(z, _) => ::IResult::Done(z, None::<String>),
+ _ => return ()
+ };
+ match Y {
+ ::IResult::Done(x, _) => {
+ let bytes = b"; ";
+ let len = x.len();
+ bytes[len];
+ }
+ _ => ()
+ }
+ }
+}