-
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 reifying function pointers to copy / copy_nonoverlapping using an if #84297
Comments
This also happens for any intrinsic where the type signatures match up. #![feature(core_intrinsics)]
fn main() {
let _unused = if true {
std::intrinsics::likely
} else {
std::intrinsics::unlikely
};
} And this variant will ICE on nightlies older than the one above, but it requires a nightly compiler and opting in to intrinsics. Match statements also work. Looks like a similar issue to #64104 |
Assigning priority as discussed as part of the Prioritization Working Group procedure and removing @rustbot label -I-prioritize +P-medium |
It happens on beta too: https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=a922a77b8fb2361b488d151613cd48e4 |
… r=Mark-Simulacrum Check for intrinsics before coercing to a function pointer Return an error if coercing function items / non-capturing closures to a common function pointer type would require reifying an intrinsic. Turns ICE reported in rust-lang#84297 into a proper error.
#84404 needs to be backported to beta for this to be fixed. Adding the labels on that PR. |
#81238 turned This change also exposed an ICE that might occur when an attempt is made to coerce intrinsics into a common type. The ICE was turned into error by #84404, but I would consider this to be of secondary importance. If we actually want to avoid a breaking change here, in the short term the only solution is to revert #81238. |
…imulacrum [stable] 1.52.0 release This includes the release notes (rust-lang#84183) as well as cherry-picked commits from: * [beta] revert PR rust-lang#77885 rust-lang#84710 * [beta] remove assert_matches rust-lang#84759 * Revert PR 81473 to resolve (on beta) issues 81626 and 81658. rust-lang#83171 * [beta] rustdoc revert deref recur rust-lang#84868 * Fix ICE of for-loop mut borrowck where no suggestions are available rust-lang#83401 Additionally in "fresh work" we're also: * reverting: directly expose copy and copy_nonoverlapping intrinsics rust-lang#81238 to avoid rust-lang#84297 on 1.52
Re-classifying as P-critical, as this is observable on non-nightly builds. Nominating for T-lang; I'd like to get a read on whether there's something special about intrinsics that should prevent reification here (i.e., is this "just something that needs to be fixed" or something underlying).
|
From a compiler implementation perspective, intrinsics are not real functions, they are more like "custom MIR statements". No function call code is ever generated when you "call" an intrinsic. But in principle, for fully monomorphic uses of intrinsics I see no reason why we couldn't auto-generate little shim functions that call the intrinsic. The user can already write these functions manually, so this is no increase in expressivity, just more convenient. |
Yeah, I think that's true, but I want to check-in -- not sure if T-lang is the right set of folks either, maybe we'll leave it nominated for T-compiler. Certainly there's some overlap anyway. I suspect the auto-generation of shim functions isn't something we'd be willing to backport, so likely we'll want to apply the revert to 1.53 (beta) and 1.54 (master), and then land the fix for intrinsic reification, and then land the original (set of) PRs. |
Probably a glitch of github didnt apply the new priority label as suggested by @Mark-Simulacrum @rustbot label -label:P-medium label:P-critical |
Error: Parsing relabel command in comment failed: ...'bel -label' | error: a label delta at >| ':P-medium '... Please let |
Issue was mentioned during T-compiler meeting and discussion will happen in a dedicated Zulip topic |
(Just an update: as mentioned in yesterday's compiler team meeting, and the plan outlined above is what we are going to do. I am doing it.) |
Also, the discussion about what to do in the long term is taking place on zulip |
…Mark-Simulacrum Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue rust-lang#84297. It effectively reverts PRs rust-lang#81167 rust-lang#81238 (and part of rust-lang#82967), rust-lang#83091, and parts of rust-lang#79684.
…r=dtolnay Beta targetted Make copy/copy_nonoverlapping fn's again beta backport of PR rust-lang#86003 to address issue rust-lang#84297
…Mark-Simulacrum Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue rust-lang#84297. It effectively reverts PRs rust-lang#81167 rust-lang#81238 (and part of rust-lang#82967), rust-lang#83091, and parts of rust-lang#79684.
This happens on nightly only, I included a bisection at the bottom. (But it doesn't seem as if the bisected commit is the direct cause of this).
It only ICE's if you assign the result to a variable, assigning it to
_
or not at all doesn't ICE.The bisection for using
core::intrinsics::copy
is the same.Code
Meta
rustc --version --verbose
:Error output
Backtrace
Bisection
searched nightlies: from nightly-2021-01-01 to nightly-2021-04-18
regressed nightly: nightly-2021-02-14
searched commits: from 3f5aee2 to 8e54a21
regressed commit: 8e54a21
bisected with cargo-bisect-rustc v0.6.0
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
The text was updated successfully, but these errors were encountered: