Skip to content

Possible Incompleteness #16734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
YichiZhang0613 opened this issue Mar 2, 2024 · 1 comment · Fixed by #16735
Closed

Possible Incompleteness #16734

YichiZhang0613 opened this issue Mar 2, 2024 · 1 comment · Fixed by #16735
Labels
C-bug Category: bug

Comments

@YichiZhang0613
Copy link

In rust-analyzer-master/crates/hir-expand/src/name.rss, I think the code should check text.len() <= 22 as comments mentioned before use text to avoid possible incompleteness.

/// Shortcut to create inline plain text name. Panics if `text.len() > 22`
    const fn new_static(text: &'static str) -> Name {
        Name::new_text(SmolStr::new_static(text))
    }
@lnicola
Copy link
Member

lnicola commented Mar 2, 2024

No, it's shouldn't check, because it's fine to panic for strings known at compile-time (SmolStr::new_static used to panic on these). But the comment is outdated anyway, since we no longer panic in that case.

@bors bors closed this as completed in 6cb576a Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants