-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE when compiling this core change #121064
Conversation
Per @dtolnay suggestion in serde-rs/serde#2697 (comment) - attempt to speed up performance in the cases of a simple string format without arguments: ```rust write!(f, "text") -> f.write_str("text") ```
The job Click to see the possible cause of the failure (guessed by this bot)
|
@rustbot blocked |
@@ -201,13 +201,23 @@ pub trait Write { | |||
impl<W: Write + ?Sized> SpecWriteFmt for &mut W { | |||
#[inline] | |||
default fn spec_write_fmt(mut self, args: Arguments<'_>) -> Result { | |||
if unsafe { core::intrinsics::is_val_statically_known(args) } { |
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_val_statically_known only supports primitives
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.
feel free to PR a better error message, since I'd expect many people to run into this
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.
@Nilstrieb I suspect ICE is ICE no matter what the users try to do? That said, I don't see anything in the docs about it only supporting primitives - it does have T: Copy
though.
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's not documented, you need to look at the implementation
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.
Can an expression be evaluated for this intrinsic? e.g. for a primitive bool
:
if unsafe { core::intrinsics::is_val_statically_known(args) } { | |
if unsafe { core::intrinsics::is_val_statically_known(args.as_str().is_some()) } { |
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 suspect ICE is ICE no matter what the users try to do?
No, if you use internal features such as intrinsics, then some ICEs are expected. It's not worth the effort and overhead of guarding against ICEs when users explicitly ask to fiddle with the internal details of the compiler.
ICEing was fixed in #120484. Best thing to do here is probably to update the docs to make it better, unless we want to backport the fix? |
I don't think we want to backport this. The docs could be made better |
For the novice, when you say backport - are you referring to the fact that the current binary bootstrapping compiler used by |
backporting means taking a commit that landed on nightly and letting it skip the release train by putting it directly into beta or even stable. We do this for urgent issues like bad regression fixes. |
Going to close this PR. We get a better error message on nightly, which seems fine. |
Bug report for this PR: #121066
This code causes ICE in rustc when running
./x.py build --stage 1 alloc
-- the error shows up in CI https://github.com/rust-lang/rust/actions/runs/7896056798/job/21549391196?pr=121064#step:26:2201This issue showed up with two code variants:
Stacktrace