fix Const generics are handled incorrectly

This commit is contained in:
rchaser53 2019-05-16 13:22:25 +09:00
parent 531b2d9136
commit bdf105245b
2 changed files with 10 additions and 0 deletions

View File

@ -880,6 +880,12 @@ pub(crate) fn recover_missing_comment_in_span(
Some(String::new())
} else {
let missing_snippet = context.snippet(span);
let trimmed_missing_snippet = missing_snippet.trim();
if !trimmed_missing_snippet.starts_with("//") && !trimmed_missing_snippet.starts_with("/*")
{
return None;
};
let pos = missing_snippet.find('/').unwrap_or(0);
// 1 = ` `
let total_width = missing_comment.len() + used_width + 1;

View File

@ -0,0 +1,4 @@
#![feature(const_generics)]
pub struct S<const N: usize>;
impl S<{ 0 }> {}