mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
Do not ICE on range patterns in function arguments
This commit is contained in:
@@ -289,10 +289,7 @@ fn to_src(&self, cx: &DocContext<'_>) -> String {
|
||||
);
|
||||
return Symbol::intern("()");
|
||||
}
|
||||
PatKind::Range(..) => panic!(
|
||||
"tried to get argument name from PatKind::Range, \
|
||||
which is not allowed in function arguments"
|
||||
),
|
||||
PatKind::Range(..) => return kw::Underscore,
|
||||
PatKind::Slice(ref begin, ref mid, ref end) => {
|
||||
let begin = begin.iter().map(|p| name_from_pat(&**p).to_string());
|
||||
let mid = mid.as_ref().map(|p| format!("..{}", name_from_pat(&**p))).into_iter();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![crate_name = "foo"]
|
||||
|
||||
// @has foo/fn.f.html
|
||||
// @has - '//*[@class="rust fn"]' 'pub fn f(0u8 ...255: u8)'
|
||||
// @has - '//*[@class="rust fn"]' 'pub fn f(_: u8)'
|
||||
pub fn f(0u8...255: u8) {}
|
||||
|
||||
Reference in New Issue
Block a user