Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit b18dbc3

Browse files
authored
Merge pull request #1280 from matthiaskrgr/20220603
Co-authored-by: Yuki Okushi <[email protected]>
2 parents 8d5f295 + 3a5b365 commit b18dbc3

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

fixed/97695.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
rustc -Zmir-opt-level=3 --emit=mir - << EOF
4+
5+
pub trait Associate {
6+
type Associated;
7+
}
8+
9+
pub struct Wrap<'a> {
10+
pub field: &'a i32,
11+
}
12+
13+
pub trait Create<T> {
14+
fn create() -> Self;
15+
}
16+
17+
pub fn oh_no<'a, T>()
18+
where
19+
Wrap<'a>: Associate,
20+
<Wrap<'a> as Associate>::Associated: Create<T>,
21+
{
22+
<Wrap<'a> as Associate>::Associated::create();
23+
}
24+
25+
fn main() {}
26+
27+
EOF

ices/97698.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::ffi::CString;
2+
3+
impl Lock {
4+
pub fn new() {
5+
if () == -1 {
6+
CString::new();
7+
}
8+
}
9+
}
10+
11+
fn main() {}

ices/97706.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pub fn compose(
2+
f1: impl FnOnce(f64) -> f64 + Clone,
3+
f2: impl FnOnce(f64) -> f64 + Clone,
4+
) -> impl FnOnce(f64) -> f64 + Clone {
5+
move |x| f1(f2(x))
6+
}
7+
8+
pub fn double(f: impl FnOnce(f64) -> f64 + Clone) -> impl FnOnce(f64) -> f64 + Clone {
9+
compose(f.clone(), f)
10+
}
11+
12+
13+
fn repeat_helper(f: impl FnOnce(f64) -> f64 + Clone, res: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone {
14+
if times == 1 {
15+
return res;
16+
}
17+
repeat_helper(f.clone(), compose(f, res), times - 1)
18+
}
19+
20+
pub fn repeat(f: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone {
21+
repeat_helper(f.clone(), f, times)
22+
}
23+
24+
fn main() {}

ices/97728.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/sh
2+
3+
rustc -Zmir-opt-level=3 --emit=mir - << EOF
4+
// check-pass
5+
6+
#![allow(dead_code)]
7+
8+
trait ParseError {
9+
type StreamError;
10+
}
11+
12+
impl<T> ParseError for T {
13+
type StreamError = ();
14+
}
15+
16+
trait Stream {
17+
type Item;
18+
type Error: ParseError;
19+
}
20+
21+
trait Parser
22+
where
23+
<Self as Parser>::PartialState: Default,
24+
{
25+
type PartialState;
26+
fn parse_mode(_: &Self, _: Self::PartialState) {
27+
loop {}
28+
}
29+
}
30+
31+
impl Stream for () {
32+
type Item = ();
33+
type Error = ();
34+
}
35+
36+
impl Parser for () {
37+
type PartialState = ();
38+
}
39+
40+
struct AndThen<A, B>(core::marker::PhantomData<(A, B)>);
41+
42+
impl<A, B> Parser for AndThen<A, B>
43+
where
44+
A: Stream,
45+
B: Into<<A::Error as ParseError>::StreamError>,
46+
{
47+
type PartialState = ();
48+
}
49+
50+
fn expr<A>() -> impl Parser
51+
where
52+
A: Stream<Error = <A as Stream>::Item>,
53+
{
54+
AndThen::<A, ()>(core::marker::PhantomData)
55+
}
56+
57+
fn parse_mode_impl<A>()
58+
where
59+
<A as Stream>::Error: ParseError,
60+
A: Stream<Error = <A as Stream>::Item>,
61+
{
62+
Parser::parse_mode(&expr::<A>(), Default::default())
63+
}
64+
65+
fn main() {}
66+
67+
EOF

0 commit comments

Comments
 (0)