Repository navigation
Rustc panic when building bobbin-sdk #58767
Copy link
Copy link
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
Activity
- addedI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)
on Feb 27, 2019 cc @oli-obk
Minimal repro:
pub struct Hz; impl Hz { pub const fn num(&self) -> u32 { 42 } pub const fn normalized(&self) -> Hz { Hz } pub const fn as_u32(&self) -> u32 { self.normalized().num() } }
you need both the
self, a method call.normalized, and a method call on the result of that in order to trigger promotion. It seems likeself.normalized()is promoted to make a&Hzfor the call tonumOk, so promotion is indeed screwing up. The MIR is promoting the
selfargument.4c4 < // disambiguator = before --- > // disambiguator = after 14,24c14 < StorageLive(_3); // bb0[1]: scope 0 at src/lib.rs:12:9: 12:26 < StorageLive(_4); // bb0[2]: scope 0 at src/lib.rs:12:9: 12:13 < _4 = &(*_1); // bb0[3]: scope 0 at src/lib.rs:12:9: 12:13 < _3 = const Hz::normalized(move _4) -> [return: bb2, unwind: bb1]; // bb0[4]: scope 0 at src/lib.rs:12:9: 12:26 < // ty::Const < // + ty: for<'r> fn(&'r Hz) -> Hz {Hz::normalized} < // + val: Scalar(Bits { size: 0, bits: 0 }) < // mir::Constant < // + span: src/lib.rs:12:14: 12:24 < // + ty: for<'r> fn(&'r Hz) -> Hz {Hz::normalized} < // + literal: Evaluated(Const { ty: for<'r> fn(&'r Hz) -> Hz {Hz::normalized}, val: Scalar(Bits { size: 0, bits: 0 }) }) --- > goto -> bb2; // bb0[1]: scope 0 at src/lib.rs:12:9: 12:26 32,34c22,23 < _2 = &_3; // bb2[0]: scope 0 at src/lib.rs:12:9: 12:26 < StorageDead(_4); // bb2[1]: scope 0 at src/lib.rs:12:25: 12:26 < _0 = const Hz::num(move _2) -> [return: bb3, unwind: bb1]; // bb2[2]: scope 0 at src/lib.rs:12:9: 12:32 --- > _2 = &(promoted[0]: Hz); // bb2[0]: scope 0 at src/lib.rs:12:9: 12:26 > _0 = const Hz::num(move _2) -> [return: bb3, unwind: bb1]; // bb2[1]: scope 0 at src/lib.rs:12:9: 12:32 46,47c35 < StorageDead(_3); // bb3[1]: scope 0 at src/lib.rs:13:5: 13:6 < return; // bb3[2]: scope 0 at src/lib.rs:13:6: 13:6 --- > return; // bb3[1]: scope 0 at src/lib.rs:13:6: 13:6
- addedregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
on Feb 28, 2019 triage: P-high. Looks under control.
Just to confirm, this has not made it out to the nightly, correct? As of today I am still seeing the same error when attempting to build bobbin-hz as part of bobbin-sdk.
No, #58784 is still open, I'll bump its priority
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
While attempting to build the current bobbin-sdk under Ubuntu 18.04 using rust 1.34.0-nightly (02c4c28 2019-02-26) I get a panic in rustc.