mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
fix Const generics are handled incorrectly
This commit is contained in:
parent
531b2d9136
commit
bdf105245b
@ -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;
|
||||
|
4
tests/target/issue-3554.rs
Normal file
4
tests/target/issue-3554.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![feature(const_generics)]
|
||||
|
||||
pub struct S<const N: usize>;
|
||||
impl S<{ 0 }> {}
|
Loading…
Reference in New Issue
Block a user