-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add check for [T;N]
/usize
mismatch in astconv
#80538
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![crate_type = "lib"] | ||
|
||
fn example<const N: usize>() {} | ||
|
||
fn other() { | ||
example::<[usize; 3]>(); | ||
//~^ ERROR type provided when a const | ||
example::<[usize; 4+5]>(); | ||
//~^ ERROR type provided when a const | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0747]: type provided when a constant was expected | ||
--> $DIR/suggest_const_for_array.rs:6:13 | ||
| | ||
LL | example::<[usize; 3]>(); | ||
| ^^^^^^^^^^ help: array type provided where a `usize` was expected, try: `{ 3 }` | ||
|
||
error[E0747]: type provided when a constant was expected | ||
--> $DIR/suggest_const_for_array.rs:8:13 | ||
| | ||
LL | example::<[usize; 4+5]>(); | ||
| ^^^^^^^^^^^^ help: array type provided where a `usize` was expected, try: `{ 4+5 }` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0747`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is it possible that this loop is a lot hotter than I expected so storing arg with param here is quite costly?
Other than that i really don't know waht could be causing the perf regression.
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 agree that this would be the most likely cause, it could be that the type for param for deeply-nested-async stuff is huge and thus takes up a lot of space on the stack, so even if it's not hot it might just be causing a lot more cache misses
edit: these are refs, so the size shouldn't matter, ignore above
Would it be good to change this to an index instead? I don't remember where the param was coming from at the moment
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.
It seems possible that this increases the size of force_infer_lt enough that it becomes stored on the stack instead of a register, I guess, but it's pretty odd that it would cause any problems (still just two pointers vs one). An index would still be a usize so should be equally costly I'd expect.
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 added a print to the inner body, and during compilation it appears that the body is hit at least 1.5M times, so I guess that's fairly hot?
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.
you mean during the compilation of the compiler itself? so during
./x.py build --stage 2
or just while building std?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 was running
./x.py test src/test/ui
, but it got to compiling stage 1 artifacts and I quit out