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

Bug in fulfillment_errors.rs when compiling #135410

Open
DavideCanton opened this issue Jan 12, 2025 · 4 comments
Open

Bug in fulfillment_errors.rs when compiling #135410

DavideCanton opened this issue Jan 12, 2025 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics

Comments

@DavideCanton
Copy link

DavideCanton commented Jan 12, 2025

Code

use cgroups_rs;
use nix::mount::{mount, MsFlags};

use std::path::Path;

fn main() {
    mount(None, Path::new("foo"), None, MsFlags::empty(), None).unwrap();
}

Meta

rustc --version --verbose:

rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5

Error output

thread 'rustc' panicked at compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1824:44:
called `Option::unwrap()` on a `None` value
Backtrace

stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_similar_impl_candidates
   5: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_error
   6: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
   7: rustc_hir_typeck::typeck
      [... omitted 1 frame ...]
   8: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#4}>::{closure#0}
   9: rustc_hir_analysis::check_crate
  10: rustc_interface::passes::run_required_analyses
  11: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  12: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

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: rustc 1.84.0 (9fc6b4312 2025-01-07) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack

Content of Cargo.toml

[package]
name = "rustc_bug"
version = "0.1.0"
edition = "2021"

[dependencies]
cgroups-rs = "0.3.4"
nix = { version = "0.29.0", features = ["mount"] }

Additional information

The bug seems related to the use cgroups_rs; line, if I remove it the bug goes away.

Compiling with cargo +nightly build works fine.

Please note that the code does not actually compile, with the following patch it does compile without panics.

-    mount(None, Path::new("foo"), None, MsFlags::empty(), None).unwrap();
+    mount::<Path, Path, Path, Path>(None, Path::new("foo"), None, MsFlags::empty(), None).unwrap();
@DavideCanton DavideCanton 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 Jan 12, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 12, 2025
@lqd
Copy link
Member

lqd commented Jan 12, 2025

There were some fixed ICEs in diagnostics in the last cycle, and we may have missed a backport for this one. I'll bisect and look for the PR that fixed it.

@lqd
Copy link
Member

lqd commented Jan 12, 2025

I found the culprit: it was me! #133304

@lqd
Copy link
Member

lqd commented Jan 12, 2025

The good news is that should be fixed when the next stable is released, the bad news is it's in 5 weeks. I guess we can keep this open for now.

I'll also mark this as a stable regression...

@lqd lqd added A-diagnostics Area: Messages for errors, warnings, and lints WG-diagnostics Working group: Diagnostics and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 12, 2025
@lqd lqd added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jan 12, 2025
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 12, 2025
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-diagnostics Working group: Diagnostics
Projects
None yet
Development

No branches or pull requests

4 participants