-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: Adjust the inferred type of string literals #19996
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
Conversation
e7ba741
to
d93e516
Compare
@@ -651,20 +651,20 @@ pub fn test_implicit_derefs() { | |||
let str2; | |||
{ | |||
let str1 = "bar"; | |||
str2 = "foo".to_string() + &str1; // $ Source[rust/access-after-lifetime-ended]=str1 | |||
str2 = "foo".to_string() + &str1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it actually is still considered a source, but the results are excluded due to the restriction you linked to. And these inline expectations only show sources associated with results, as I understand it, hence it is now hidden.
In any case both results we lost here are spurious, so I'm happy with this.
3aa472c
to
2a207f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. DCA is showing a rather surprising 21% analysis time regression!
@@ -651,20 +651,20 @@ pub fn test_implicit_derefs() { | |||
let str2; | |||
{ | |||
let str1 = "bar"; | |||
str2 = "foo".to_string() + &str1; // $ Source[rust/access-after-lifetime-ended]=str1 | |||
str2 = "foo".to_string() + &str1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it actually is still considered a source, but the results are excluded due to the restriction you linked to. And these inline expectations only show sources associated with results, as I understand it, hence it is now hidden.
In any case both results we lost here are spurious, so I'm happy with this.
I have pushed another commit that should fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the performance fix, this LGTM. :)
Adjusts the types from
str
type&str
.