Skip to content

Commit d4077ad

Browse files
committed
Hard break for #46976
1 parent 8d4da4f commit d4077ad

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/librustdoc/html/render.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -4130,7 +4130,11 @@ fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option
41304130
match *clean_type {
41314131
clean::ResolvedPath { ref path, .. } => {
41324132
let segments = &path.segments;
4133-
Some(segments[segments.len() - 1].name.clone())
4133+
let path_segment = segments.into_iter().last().unwrap_or_else(|| panic!(
4134+
"get_index_type_name(clean_type: {:?}, accept_generic: {:?}) had length zero path",
4135+
clean_type, accept_generic
4136+
));
4137+
Some(path_segment.name.clone())
41344138
}
41354139
clean::Generic(ref s) if accept_generic => Some(s.clone()),
41364140
clean::Primitive(ref p) => Some(format!("{:?}", p)),

src/test/rustdoc/issue-46976.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(universal_impl_trait)]
12+
pub fn ice(f: impl Fn()) {}

0 commit comments

Comments
 (0)