From 347d503333a12087f3bf885e4de13f70abdc4018 Mon Sep 17 00:00:00 2001 From: jackh726 Date: Mon, 18 Oct 2021 10:46:59 -0400 Subject: [PATCH] Add a couple tests for normalize under binder issues --- .../normalize-under-binder/issue-56556.rs | 13 +++++++++++++ .../normalize-under-binder/issue-76956.rs | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs create mode 100644 src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs new file mode 100644 index 0000000000000..768d1c36619da --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-56556.rs @@ -0,0 +1,13 @@ +// check-pass + +fn foo(t: T) -> usize +where + for<'a> &'a T: IntoIterator, + for<'a> <&'a T as IntoIterator>::IntoIter: ExactSizeIterator, +{ + t.into_iter().len() +} + +fn main() { + foo::>(vec![]); +} diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs new file mode 100644 index 0000000000000..583470080a2fc --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-76956.rs @@ -0,0 +1,15 @@ +// check-pass + +use std::ops::Deref; + +struct Data { + boxed: Box<&'static i32> +} + +impl Data { + fn use_data(&self, user: impl for <'a> FnOnce( as Deref>::Target)) { + user(*self.boxed) + } +} + +fn main() {}