Skip to content
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 test ensuring simd codegen checks don't run when a static assertion failed #122287

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

RalfJung
Copy link
Member

stdarch relies on this to ensure that SIMD indices are in bounds.

I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. @oli-obk @bjorn3 do you have any idea?

@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2024

r? @pnkfelix

rustbot has assigned @pnkfelix.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 10, 2024
@RalfJung
Copy link
Member Author

RalfJung commented Mar 10, 2024

We do have this:

Ok(v) => v,
Err(ErrorHandled::Reported(..)) => return,
Err(ErrorHandled::TooGeneric(..)) => span_bug!(
self.body.source_info(location).span,
"collection encountered polymorphic constant: {:?}",
const_
),
};
collect_const_value(self.tcx, val, self.output);

This will show the const-error, but the collector keeps going. I guess somewhere it still then check if there was any error and stop before starting codegen? Is that this line here?

tcx.dcx().abort_if_errors();

So I think the key point is there's actually two phases here: collecting all the items, and then codegen'ing them. Const errors are "collection-time errors", not "codegen-time errors".

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the simd-static-assert branch 2 times, most recently from 2dc6689 to 4c57746 Compare March 10, 2024 11:53
@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2024

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@pnkfelix
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 14, 2024

📌 Commit d765fb8 has been approved by pnkfelix

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 14, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#119029 (Avoid closing invalid handles)
 - rust-lang#122238 (Document some builtin impls in the next solver)
 - rust-lang#122247 (rustdoc-search: depth limit `T<U>` -> `U` unboxing)
 - rust-lang#122287 (add test ensuring simd codegen checks don't run when a static assertion failed)
 - rust-lang#122368 (chore: remove repetitive words)
 - rust-lang#122397 (Various cleanups around the const eval query providers)
 - rust-lang#122406 (Fix WF for `AsyncFnKindHelper` in new trait solver)
 - rust-lang#122477 (Change some attribute to only_local)
 - rust-lang#122482 (Ungate the `UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES` lint)
 - rust-lang#122490 (Update build instructions for OpenHarmony)

Failed merges:

 - rust-lang#122471 (preserve span when evaluating mir::ConstOperand)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6a4dd19 into rust-lang:master Mar 14, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 14, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 14, 2024
Rollup merge of rust-lang#122287 - RalfJung:simd-static-assert, r=pnkfelix

add test ensuring simd codegen checks don't run when a static assertion failed

stdarch relies on this to ensure that SIMD indices are in bounds.

I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
@RalfJung RalfJung deleted the simd-static-assert branch March 15, 2024 10:04
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Mar 16, 2024
…felix

add test ensuring simd codegen checks don't run when a static assertion failed

stdarch relies on this to ensure that SIMD indices are in bounds.

I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants