We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Const generics are handled incorrectly
1 parent 531b2d9 commit bdf1052Copy full SHA for bdf1052
src/comment.rs
@@ -880,6 +880,12 @@ pub(crate) fn recover_missing_comment_in_span(
880
Some(String::new())
881
} else {
882
let missing_snippet = context.snippet(span);
883
+ let trimmed_missing_snippet = missing_snippet.trim();
884
+ if !trimmed_missing_snippet.starts_with("//") && !trimmed_missing_snippet.starts_with("/*")
885
+ {
886
+ return None;
887
+ };
888
+
889
let pos = missing_snippet.find('/').unwrap_or(0);
890
// 1 = ` `
891
let total_width = missing_comment.len() + used_width + 1;
tests/target/issue-3554.rs
@@ -0,0 +1,4 @@
1
+#![feature(const_generics)]
2
3
+pub struct S<const N: usize>;
4
+impl S<{ 0 }> {}
0 commit comments