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

ICE related to f16 / f128 #123074

Closed
tgross35 opened this issue Mar 26, 2024 · 3 comments · Fixed by #123085
Closed

ICE related to f16 / f128 #123074

tgross35 opened this issue Mar 26, 2024 · 3 comments · Fixed by #123085
Assignees
Labels
C-bug Category: This is a bug. F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tgross35
Copy link
Contributor

tgross35 commented Mar 26, 2024

Code

#![feature(f16, f128)]

extern "Rust" {
    pub fn foo(a: f16) -> f128;
}

fn main() {
    let a: f16 = 1.23;
    let b = unsafe { foo(a) };
}

Meta

Playground nightly version: 1.79.0-nightly (2024-03-25 5f2c7d2)

Error output

warning: unused variable: `b`
 --> src/main.rs:9:9
  |
9 |     let b = unsafe { foo(a) };
  |         ^ help: if this is intentional, prefix it with an underscore: `_b`
  |
  = note: `#[warn(unused_variables)]` on by default

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: TraitPredicate(<f16 as std::marker::Copy>, polarity:Positive), bound_vars: [] } } }
 --> src/main.rs:9:26
  |
9 |     let b = unsafe { foo(a) };
  |                          ^
  |
note: delayed at /rustc/5f2c7d2bfd46cad00352ab7cd66242077e2e518c/compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs:165:29
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_borrowck::type_check::TypeChecker>::prove_trait_ref
         4: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_operand
         5: <rustc_borrowck::type_check::TypeVerifier as rustc_middle::mir::visit::Visitor>::visit_body
         6: rustc_borrowck::type_check::type_check
         7: rustc_borrowck::nll::compute_regions
         8: rustc_borrowck::do_mir_borrowck
         9: rustc_borrowck::mir_borrowck
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/5f2c7d2bfd46cad00352ab7cd66242077e2e518c/library/alloc/src/boxed.rs:2015:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/5f2c7d2bfd46cad00352ab7cd66242077e2e518c/library/alloc/src/boxed.rs:2015:9
        22: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/5f2c7d2bfd46cad00352ab7cd66242077e2e518c/library/std/src/sys/pal/unix/thread.rs:108:17
        23: start_thread
        24: clone
 --> src/main.rs:9:26
  |
9 |     let b = unsafe { foo(a) };
  |                          ^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please attach the file at `/playground/rustc-ice-2024-03-26T04_39_23-19.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground` (bin "playground"); 1 warning emitted

This isn't expected since it doesn't seem to hit a todo!()

@rustbot label +T-compiler +f-f16_and_f128 +I-ICE +requires-incomplete-features +S-has-mcve
@rustbot claim

@tgross35 tgross35 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` requires-incomplete-features This issue requires the use of incomplete features. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Mar 26, 2024
@tgross35
Copy link
Contributor Author

@rustbot label -needs-triage

@rustbot rustbot removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 26, 2024
@fmease
Copy link
Member

fmease commented Mar 26, 2024

Minimized:

#![feature(f16)]
fn main() {
    let x: f16 = 1.23;
    f(x);
    fn f(_: f16) {}
}

tgross35 added a commit to tgross35/rust that referenced this issue Mar 26, 2024
Split off part of <rust-lang#122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <rust-lang#123074>
@tgross35
Copy link
Contributor Author

tgross35 commented Mar 26, 2024

Looks like it just expects primitives to be Copy. I'm not sure where exactly this assumption comes from, but might as well fix it before the rest of libs support can get merged. #123085

tgross35 added a commit to tgross35/rust that referenced this issue Mar 27, 2024
Split off part of <rust-lang#122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <rust-lang#123074>
tgross35 added a commit to tgross35/rust that referenced this issue Mar 27, 2024
Split off part of <rust-lang#122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <rust-lang#123074>
tgross35 added a commit to tgross35/rust that referenced this issue Mar 27, 2024
Split off part of <rust-lang#122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <rust-lang#123074>
tgross35 added a commit to tgross35/rust that referenced this issue Mar 28, 2024
Split off part of <rust-lang#122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <rust-lang#123074>
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 30, 2024
…-impls, r=Amanieu

Add basic trait impls for `f16` and `f128`

Split off part of <rust-lang#122470> so the compiler doesn't ICE because it expects primitives to have some minimal traits.

Fixes <rust-lang#123074>
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Mar 31, 2024
…=Amanieu

Add basic trait impls for `f16` and `f128`

Split off part of <rust-lang/rust#122470> so the compiler doesn't ICE because it expects primitives to have some minimal traits.

Fixes <rust-lang/rust#123074>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants