From 02f75247d0c60d295e24ac62f9522e21c81e8672 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 1 May 2018 14:33:17 +0200 Subject: [PATCH] Fix rustdoc ICE for impl trait in argument position --- src/librustdoc/clean/mod.rs | 1 - .../rustdoc/ice-impl-trait-arg-position.rs | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc/ice-impl-trait-arg-position.rs diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index bd64ac67ac93e..a301ff738e154 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -4048,7 +4048,6 @@ where let old_bounds = mem::replace(&mut *cx.impl_trait_bounds.borrow_mut(), bounds); let r = f(); - assert!(cx.impl_trait_bounds.borrow().is_empty()); *cx.impl_trait_bounds.borrow_mut() = old_bounds; r } diff --git a/src/test/rustdoc/ice-impl-trait-arg-position.rs b/src/test/rustdoc/ice-impl-trait-arg-position.rs new file mode 100644 index 0000000000000..2663ab322ab95 --- /dev/null +++ b/src/test/rustdoc/ice-impl-trait-arg-position.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::io::Read; + +pub struct D(R); + +pub struct A; +impl A { + pub fn a(&self, d: impl IntoIterator>) -> Result<(), ()> { + unimplemented!() + } + + pub fn b(&self, d: impl IntoIterator>) -> Result<(), ()> { + unimplemented!() + } +}