From c26ae489564fa644aef61db6c636395f97f6bf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 3 Jun 2022 19:22:41 +0200 Subject: [PATCH 1/2] add 4 ices https://github.com/rust-lang/rust/issues/97695 https://github.com/rust-lang/rust/issues/97698 https://github.com/rust-lang/rust/issues/97706 https://github.com/rust-lang/rust/issues/97728 --- ices/97695.sh | 27 ++++++++++++++++++++ ices/97698.rs | 9 +++++++ ices/97706.rs | 24 ++++++++++++++++++ ices/97728.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100755 ices/97695.sh create mode 100644 ices/97698.rs create mode 100644 ices/97706.rs create mode 100644 ices/97728.sh diff --git a/ices/97695.sh b/ices/97695.sh new file mode 100755 index 00000000..c9a79806 --- /dev/null +++ b/ices/97695.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +rustc -Zmir-opt-level=3 --emit=mir - << EOF + +pub trait Associate { + type Associated; +} + +pub struct Wrap<'a> { + pub field: &'a i32, +} + +pub trait Create { + fn create() -> Self; +} + +pub fn oh_no<'a, T>() +where + Wrap<'a>: Associate, + as Associate>::Associated: Create, +{ + as Associate>::Associated::create(); +} + +pub fn main() {} + +EOF diff --git a/ices/97698.rs b/ices/97698.rs new file mode 100644 index 00000000..a7b058c6 --- /dev/null +++ b/ices/97698.rs @@ -0,0 +1,9 @@ +use std::ffi::CString; + +impl Lock { + pub fn new() { + if () == -1 { + CString::new(); + } + } +} diff --git a/ices/97706.rs b/ices/97706.rs new file mode 100644 index 00000000..c34b5709 --- /dev/null +++ b/ices/97706.rs @@ -0,0 +1,24 @@ +pub fn compose( + f1: impl FnOnce(f64) -> f64 + Clone, + f2: impl FnOnce(f64) -> f64 + Clone, +) -> impl FnOnce(f64) -> f64 + Clone { + move |x| f1(f2(x)) +} + +pub fn double(f: impl FnOnce(f64) -> f64 + Clone) -> impl FnOnce(f64) -> f64 + Clone { + compose(f.clone(), f) +} + + +fn repeat_helper(f: impl FnOnce(f64) -> f64 + Clone, res: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone { + if times == 1 { + return res; + } + repeat_helper(f.clone(), compose(f, res), times - 1) +} + +pub fn repeat(f: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f64) -> f64 + Clone { + repeat_helper(f.clone(), f, times) +} + +pub fn main() {} diff --git a/ices/97728.sh b/ices/97728.sh new file mode 100644 index 00000000..ef65606a --- /dev/null +++ b/ices/97728.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +rustc -Zmir-opt-level=3 --emit=mir - << EOF + + +// check-pass + +#![allow(dead_code)] + +trait ParseError { + type StreamError; +} + +impl ParseError for T { + type StreamError = (); +} + +trait Stream { + type Item; + type Error: ParseError; +} + +trait Parser +where + ::PartialState: Default, +{ + type PartialState; + fn parse_mode(_: &Self, _: Self::PartialState) { + loop {} + } +} + +impl Stream for () { + type Item = (); + type Error = (); +} + +impl Parser for () { + type PartialState = (); +} + +struct AndThen(core::marker::PhantomData<(A, B)>); + +impl Parser for AndThen +where + A: Stream, + B: Into<::StreamError>, +{ + type PartialState = (); +} + +fn expr() -> impl Parser +where + A: Stream::Item>, +{ + AndThen::(core::marker::PhantomData) +} + +fn parse_mode_impl() +where + ::Error: ParseError, + A: Stream::Item>, +{ + Parser::parse_mode(&expr::(), Default::default()) +} + +fn main() {} + + +EOF From 3a5b3659145016178b44facab310a463d94d6205 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 4 Jun 2022 21:46:01 +0900 Subject: [PATCH 2/2] Tweak code --- {ices => fixed}/97695.sh | 2 +- ices/97698.rs | 2 ++ ices/97706.rs | 2 +- ices/97728.sh | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-) rename {ices => fixed}/97695.sh (95%) diff --git a/ices/97695.sh b/fixed/97695.sh similarity index 95% rename from ices/97695.sh rename to fixed/97695.sh index c9a79806..4389b232 100755 --- a/ices/97695.sh +++ b/fixed/97695.sh @@ -22,6 +22,6 @@ where as Associate>::Associated::create(); } -pub fn main() {} +fn main() {} EOF diff --git a/ices/97698.rs b/ices/97698.rs index a7b058c6..ca900894 100644 --- a/ices/97698.rs +++ b/ices/97698.rs @@ -7,3 +7,5 @@ impl Lock { } } } + +fn main() {} diff --git a/ices/97706.rs b/ices/97706.rs index c34b5709..eae8b91b 100644 --- a/ices/97706.rs +++ b/ices/97706.rs @@ -21,4 +21,4 @@ pub fn repeat(f: impl FnOnce(f64) -> f64 + Clone, times: usize) -> impl FnOnce(f repeat_helper(f.clone(), f, times) } -pub fn main() {} +fn main() {} diff --git a/ices/97728.sh b/ices/97728.sh index ef65606a..ddeef28a 100644 --- a/ices/97728.sh +++ b/ices/97728.sh @@ -1,8 +1,6 @@ #!/bin/sh rustc -Zmir-opt-level=3 --emit=mir - << EOF - - // check-pass #![allow(dead_code)] @@ -66,5 +64,4 @@ where fn main() {} - EOF