summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/issue-109743.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/mir/issue-109743.rs
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/mir/issue-109743.rs')
-rw-r--r--tests/ui/mir/issue-109743.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/ui/mir/issue-109743.rs b/tests/ui/mir/issue-109743.rs
new file mode 100644
index 000000000..73f3405e3
--- /dev/null
+++ b/tests/ui/mir/issue-109743.rs
@@ -0,0 +1,51 @@
+// build-pass
+// compile-flags: --crate-type=lib
+
+use std::marker::PhantomData;
+
+pub trait StreamOnce {
+ type Token;
+}
+
+impl StreamOnce for &str {
+ type Token = ();
+}
+
+pub trait Parser<Input: StreamOnce> {
+ type PartialState: Default;
+ fn parse_mode(&self, _state: &Self::PartialState) {}
+ fn parse_mode_impl() {}
+}
+
+pub fn parse_bool<'a>() -> impl Parser<&'a str> {
+ pub struct TokensCmp<C, Input>
+ where
+ Input: StreamOnce,
+ {
+ _cmp: C,
+ _marker: PhantomData<Input>,
+ }
+
+ impl<Input, C> Parser<Input> for TokensCmp<C, Input>
+ where
+ C: FnMut(Input::Token),
+ Input: StreamOnce,
+ {
+ type PartialState = ();
+ }
+
+ TokensCmp { _cmp: |_| (), _marker: PhantomData }
+}
+
+pub struct ParseBool;
+
+impl<'a> Parser<&'a str> for ParseBool
+where
+ &'a str: StreamOnce,
+{
+ type PartialState = ();
+
+ fn parse_mode_impl() {
+ parse_bool().parse_mode(&Default::default())
+ }
+}