From 07158effd3268d8ea3431a0b6e8a9b572cb944b9 Mon Sep 17 00:00:00 2001 From: ouz-a Date: Sat, 19 Nov 2022 23:03:14 +0300 Subject: [PATCH] re-add test and bless --- src/test/ui/issues/issue-23122-2.stderr | 2 +- src/test/ui/recursion/issue-95134.rs | 30 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/recursion/issue-95134.rs diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 33af86918e08c..dd97bcc7b3e73 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -10,7 +10,7 @@ note: required for `GetNext<<<<<<... as Next>::Next as Next>::Next as Next>::Nex | LL | impl Next for GetNext { | ^^^^ ^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-2230235837754269907.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-23122-2/issue-23122-2.long-type-3976323088118947840.txt' error: aborting due to previous error diff --git a/src/test/ui/recursion/issue-95134.rs b/src/test/ui/recursion/issue-95134.rs new file mode 100644 index 0000000000000..fdc4d53698143 --- /dev/null +++ b/src/test/ui/recursion/issue-95134.rs @@ -0,0 +1,30 @@ +// build-fail +// known-bug: #95134 +// compile-flags: -Copt-level=0 +// failure-status: 101 +// dont-check-compiler-stderr + +pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { + if n > 15 { + encode_num(n / 16, &mut writer)?; + } + Ok(()) +} + +pub trait ExampleWriter { + type Error; +} + +impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T { + type Error = T::Error; +} + +struct EmptyWriter; + +impl ExampleWriter for EmptyWriter { + type Error = (); +} + +fn main() { + encode_num(69, &mut EmptyWriter).unwrap(); +}