Skip to content

Commit 7bc657b

Browse files
committed
Fix following removal of parse_ty_path
The merge of rust-lang/rust#40043 removes parse_ty_path in the latest nightly, which we depended on. This patch rewrites that code path using parse_path, and in the process eliminates an unreachable!() if let arm.
1 parent 40faf25 commit 7bc657b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/plugins/src/lib.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn ty_snake_to_camel(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacRe
109109
// The `expand_expr` method is called so that any macro calls in the
110110
// parsed expression are expanded.
111111

112-
let mut ty = match parser.parse_ty_path() {
112+
let mut path = match parser.parse_path(PathStyle::Type) {
113113
Ok(s) => s,
114114
Err(mut diagnostic) => {
115115
diagnostic.emit();
@@ -123,14 +123,13 @@ fn ty_snake_to_camel(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacRe
123123
}
124124

125125
// Only capitalize the final segment
126-
if let TyKind::Path(_, ref mut path) = ty {
127-
convert(&mut path.segments.last_mut().unwrap().identifier);
128-
} else {
129-
unreachable!()
130-
}
126+
convert(&mut path.segments
127+
.last_mut()
128+
.unwrap()
129+
.identifier);
131130
MacEager::ty(P(Ty {
132131
id: ast::DUMMY_NODE_ID,
133-
node: ty,
132+
node: TyKind::Path(None, path),
134133
span: sp,
135134
}))
136135
}

0 commit comments

Comments
 (0)