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: incoherent impl of negative auto trait #138149

Closed
matthiaskrgr opened this issue Mar 7, 2025 · 2 comments · Fixed by #138173
Closed

ICE: incoherent impl of negative auto trait #138149

matthiaskrgr opened this issue Mar 7, 2025 · 2 comments · Fixed by #138173
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

//@compile-flags: -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024
pub unsafe auto trait DynSend {}

macro_rules! impls_dyn_send_neg {
    ($([$t1: ty $(where $($generics1: tt)*)?])*) => {
        $(impl$(<$($generics1)*>)? !DynSend for $t1 {})*
    };
}

impls_dyn_send_neg!(
    [*mut T where T: ?Sized]
);
original code

original:

use std::alloc::Allocator;

#[rustc_on_unimplemented(message = "`{Self}` doesn't implement `DynSend`. \
            Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Send`")]
// This is an auto trait for types which can be sent across threads if `sync::is_dyn_thread_safe()`
// is true. These types can be wrapped in a `FromDyn` to get a `Send` type. Wrapping a
// `Send` type in `IntoDynSyncSend` will create a `DynSend` type.
pub unsafe auto trait DynSend {}

#[rustc_on_unimplemented(message = "`{Self}` doesn't implement `DynSync`. \
            Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Sync`")]
// This is an auto trait for types which can be shared across threads if `sync::is_dyn_thread_safe()`
// is true. These types can be wrapped in a `FromDyn` to get a `Sync` type. Wrapping a
// `Sync` type in `IntoDynSyncSend` will create a `DynSync` type.
pub unsafe auto trait DynSync {}

// Same with `Sync` and `Send`.
unsafe impl<T: DynSync + ?Sized> DynSend for &T {}

macro_rules! impls_dyn_send_neg {
    ($([$t1: ty $(where $($generics1: tt)*)?])*) => {
        $(impl$(<$($generics1)*>)? !DynSend for $t1 {})*
    };
}

// Consistent with `std`
impls_dyn_send_neg!(
    [std::env::Args]
    [std::env::ArgsOs]
    [*const T where T: ?Sized]
    [*mut T where T: ?Sized]
    [std::ptr::NonNull<T> where T: ?Sized]
    [std::rc::Rc<T, A> where T: ?Sized, A: Allocator]
    [std::rc::Weak<T, A> where T: ?Sized, A: Allocator]
    [std::sync::MutexGuard<'_, T> where T: ?Sized]
    [std::sync::RwLockReadGuard<'_, T> where T: ?Sized]
    [std::sync::RwLockWriteGuard<'_, T> where T: ?Sized]
    [std::io::StdoutLock<'_>]
    [std::io::StderrLock<'_>]
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
impl !DynSend for std::env::VarsOs {}

macro_rules! already_send {
    ($([$ty: ty])*) => {
        $(unsafe impl DynSend for $ty where $ty: Send {})*
    };
}

// These structures are already `Send`.
already_send!(
    [std::backtrace::Backtrace][std::io::Stdout][std::io::Stderr][std::io::Error][std::fs::File]
        [rustc_arena::DroplessArena][crate::memmap::Mmap][crate::profiling::SelfProfiler]
        [crate::owned_slice::OwnedSlice]
);

macro_rules! impl_dyn_send {
    ($($($attr: meta)* [$ty: ty where $($generics2: tt)*])*) => {
        $(unsafe impl<$($generics2)*> DynSend for $ty {})*
    };
}

impl_dyn_send!(
    [std::sync::atomic::AtomicPtr<T> where T]
    [std::sync::Mutex<T> where T: ?Sized+ DynSend]
    [std::sync::mpsc::Sender<T> where T: DynSend]
    [std::sync::Arc<T> where T: ?Sized + DynSync + DynSend]
    [std::sync::LazyLock<T, F> where T: DynSend, F: DynSend]
    [std::collections::HashSet<K, S> where K: DynSend, S: DynSend]
    [std::collections::HashMap<K, V, S> where K: DynSend, V: DynSend, S: DynSend]
    [std::collections::BTreeMap<K, V, A> where K: DynSend, V: DynSend, A: std::alloc::Allocator + Clone + DynSend]
    [Vec<T, A> where T: DynSend, A: std::alloc::Allocator + DynSend]
    [Box<T, A> where T: ?Sized + DynSend, A: std::alloc::Allocator + DynSend]
    [crate::sync::RwLock<T> where T: DynSend]
    [crate::tagged_ptr::TaggedRef<'a, P, T> where 'a, P: Sync, T: Send + crate::tagged_ptr::Tag]
    [rustc_arena::TypedArena<T> where T: DynSend]
    [indexmap::IndexSet<V, S> where V: DynSend, S: DynSend]
    [indexmap::IndexMap<K, V, S> where K: DynSend, V: DynSend, S: DynSend]
    [thin_vec::ThinVec<T> where T: DynSend]
    [smallvec::SmallVec<A> where A: smallvec::Array + DynSend]
);

macro_rules! impls_dyn_sync_neg {
    ($([$t1: ty $(where $($generics1: tt)*)?])*) => {
        $(impl$(<$($generics1)*>)? !DynSync for $t1 {})*
    };
}

// Consistent with `std`
impls_dyn_sync_neg!(
    [std::env::Args]
    [std::env::ArgsOs]
    [*const T where T: ?Sized]
    [*mut T where T: ?Sized]
    [std::cell::Cell<T> where T: ?Sized]
    [std::cell::RefCell<T> where T: ?Sized]
    [std::cell::UnsafeCell<T> where T: ?Sized]
    [std::ptr::NonNull<T> where T: ?Sized]
    [std::rc::Rc<T, A> where T: ?Sized, A: Allocator]
    [std::rc::Weak<T, A> where T: ?Sized, A: Allocator]
    [std::cell::OnceCell<T> where T]
    [std::sync::mpsc::Receiver<T> where T]
    [std::sync::mpsc::Sender<T> where T]
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
impl !DynSync for std::env::VarsOs {}

macro_rules! already_sync {
    ($([$ty: ty])*) => {
        $(unsafe impl DynSync for $ty where $ty: Sync {})*
    };
}

// These structures are already `Sync`.
already_sync!(
    [std::sync::atomic::AtomicBool][std::sync::atomic::AtomicUsize][std::sync::atomic::AtomicU8]
        [std::sync::atomic::AtomicU32][std::backtrace::Backtrace][std::io::Error][std::fs::File]
        [jobserver_crate::Client][crate::memmap::Mmap][crate::profiling::SelfProfiler]
        [crate::owned_slice::OwnedSlice]
);

// Use portable AtomicU64 for targets without native 64-bit atomics
#[cfg(target_has_atomic = "64")]
already_sync!([std::sync::atomic::AtomicU64]);

#[cfg(not(target_has_atomic = "64"))]
already_sync!([portable_atomic::AtomicU64]);

macro_rules! impl_dyn_sync {
    ($($($attr: meta)* [$ty: ty where $($generics2: tt)*])*) => {
        $(unsafe impl<$($generics2)*> DynSync for $ty {})*
    };
}

impl_dyn_sync!(
    [std::sync::atomic::AtomicPtr<T> where T]
    [std::sync::OnceLock<T> where T: DynSend + DynSync]
    [std::sync::Mutex<T> where T: ?Sized + DynSend]
    [std::sync::Arc<T> where T: ?Sized + DynSync + DynSend]
    [std::sync::LazyLock<T, F> where T: DynSend + DynSync, F: DynSend]
    [std::collections::HashSet<K, S> where K: DynSync, S: DynSync]
    [std::collections::HashMap<K, V, S> where K: DynSync, V: DynSync, S: DynSync]
    [std::collections::BTreeMap<K, V, A> where K: DynSync, V: DynSync, A: std::alloc::Allocator + Clone + DynSync]
    [Vec<T, A> where T: DynSync, A: std::alloc::Allocator + DynSync]
    [Box<T, A> where T: ?Sized + DynSync, A: std::alloc::Allocator + DynSync]
    [crate::sync::RwLock<T> where T: DynSend + DynSync]
    [crate::sync::WorkerLocal<T> where T: DynSend]
    [crate::intern::Interned<'a, T> where 'a, T: DynSync]
    [crate::tagged_ptr::TaggedRef<'a, P, T> where 'a, P: Sync, T: Sync + crate::tagged_ptr::Tag]
    [parking_lot::lock_api::Mutex<R, T> where R: DynSync, T: ?Sized + DynSend]
    [parking_lot::lock_api::RwLock<R, T> where R: DynSync, T: ?Sized + DynSend + DynSync]
    [indexmap::IndexSet<V, S> where V: DynSync, S: DynSync]
    [indexmap::IndexMap<K, V, S> where K: DynSync, V: DynSync, S: DynSync]
    [smallvec::SmallVec<A> where A: smallvec::Array + DynSync]
    [thin_vec::ThinVec<T> where T: DynSync]
);

pub fn assert_dyn_sync<T: ?Sized + DynSync>() {}
pub fn assert_dyn_send<T: ?Sized + DynSend>() {}
pub fn assert_dyn_send_val<T: ?Sized + DynSend>(_t: &T) {}
pub fn assert_dyn_send_sync_val<T: ?Sized + DynSync + DynSend>(_t: &T) {}

#[derive(Copy, Clone)]
pub struct FromDyn<T>(T);

impl<T> FromDyn<T> {
    #[inline(always)]
    pub fn from(val: T) -> Self {
        // Check that `sync::is_dyn_thread_safe()` is true on creation so we can
        // implement `Send` and `Sync` for this structure when `T`
        // implements `DynSend` and `DynSync` respectively.
        assert!(crate::sync::is_dyn_thread_safe());
        FromDyn(val)
    }

    #[inline(always)]
    pub fn into_inner(self) -> T {
        self.0
    }
}

// `FromDyn` is `Send` if `T` is `DynSend`, since it ensures that sync::is_dyn_thread_safe() is true.
unsafe impl<T: DynSend> Send for FromDyn<T> {}

// `FromDyn` is `Sync` if `T` is `DynSync`, since it ensures that sync::is_dyn_thread_safe() is true.
unsafe impl<T: DynSync> Sync for FromDyn<T> {}

impl<T> std::ops::Deref for FromDyn<T> {
    type Target = T;

    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

// A wrapper to convert a struct that is already a `Send` or `Sync` into
// an instance of `DynSend` and `DynSync`, since the compiler cannot infer
// it automatically in some cases. (e.g. Box<dyn Send / Sync>)
#[derive(Copy, Clone)]
pub struct IntoDynSyncSend<T: ?Sized>(pub T);

unsafe impl<T: ?Sized + Send> DynSend for IntoDynSyncSend<T> {}
unsafe impl<T: ?Sized + Sync> DynSync for IntoDynSyncSend<T> {}

impl<T> std::ops::Deref for IntoDynSyncSend<T> {
    type Target = T;

    #[inline(always)]
    fn deref(&self) -> &T {
        &self.0
    }
}

impl<T> std::ops::DerefMut for IntoDynSyncSend<T> {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut T {
        &mut self.0
    }
}

Version information

rustc 1.87.0-nightly (91a0e1604 2025-03-07)
binary: rustc
commit-hash: 91a0e1604f343730022bc903cbf201d8b0a86a71
commit-date: 2025-03-07
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

// NOTE: We ignore the applicability check for negative auto impls
// defined in libcore. In the (almost impossible) future where we
// stabilize auto impls, then the proper applicability check MUST
// be implemented here to handle non-ADT rigid types.
Ok(())
} else {
span_bug!(tcx.def_span(impl_def_id), "incoherent impl of negative auto trait");
}
}
}
}
fn ensure_impl_params_and_item_params_correspond<'tcx>(

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir --edition=2024

Program output

error[E0658]: auto traits are experimental and possibly buggy
 --> /tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs:1:1
  |
1 | pub unsafe auto trait DynSend {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
  = help: add `#![feature(auto_traits)]` to the crate attributes to enable
  = note: this compiler was built on 2025-03-07; consider upgrading it if it is out of date

error[E0658]: negative trait bounds are not fully implemented; use marker types for now
  --> /tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs:5:36
   |
5  |           $(impl$(<$($generics1)*>)? !DynSend for $t1 {})*
   |                                      ^^^^^^^^
...
9  | / impls_dyn_send_neg!(
...  |
22 | | );
   | |_- in this macro invocation
   |
   = note: see issue #68318 <https://github.com/rust-lang/rust/issues/68318> for more information
   = help: add `#![feature(negative_impls)]` to the crate attributes to enable
   = note: this compiler was built on 2025-03-07; consider upgrading it if it is out of date
   = note: this error originates in the macro `impls_dyn_send_neg` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs:22:3
   |
22 | );
   |   ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs`

error: internal compiler error: compiler/rustc_hir_analysis/src/check/always_applicable.rs:127:17: incoherent impl of negative auto trait
  --> /tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs:5:11
   |
5  |           $(impl$(<$($generics1)*>)? !DynSend for $t1 {})*
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
9  | / impls_dyn_send_neg!(
...  |
22 | | );
   | |_- in this macro invocation
   |
   = note: this error: internal compiler error originates in the macro `impls_dyn_send_neg` (in Nightly builds, run with -Z macro-backtrace for more info)


thread 'rustc' panicked at compiler/rustc_hir_analysis/src/check/always_applicable.rs:127:17:
Box<dyn Any>
stack backtrace:
   0:     0x79279ffb9cd4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h56c41017d4c018c9
   1:     0x7927a0805aa2 - core::fmt::write::h44fb6b51ecd37273
   2:     0x7927a1a88651 - std::io::Write::write_fmt::h5177286eaabb4718
   3:     0x79279ffb9b32 - std::sys::backtrace::BacktraceLock::print::h7224e6db0c6003ab
   4:     0x79279ffbc412 - std::panicking::default_hook::{{closure}}::hd57ffe6704b518f0
   5:     0x79279ffbc004 - std::panicking::default_hook::hd67996f0af20ab10
   6:     0x79279f113be7 - std[19e82b1a4c46fd01]::panicking::update_hook::<alloc[c1750e1d92c179af]::boxed::Box<rustc_driver_impl[b51e5c2563a01b77]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x79279ffbcc83 - std::panicking::rust_panic_with_hook::h28cd824a2557f292
   8:     0x79279f150ae1 - std[19e82b1a4c46fd01]::panicking::begin_panic::<rustc_errors[e194483261a0ac90]::ExplicitBug>::{closure#0}
   9:     0x79279f144ef6 - std[19e82b1a4c46fd01]::sys::backtrace::__rust_end_short_backtrace::<std[19e82b1a4c46fd01]::panicking::begin_panic<rustc_errors[e194483261a0ac90]::ExplicitBug>::{closure#0}, !>
  10:     0x79279f141879 - std[19e82b1a4c46fd01]::panicking::begin_panic::<rustc_errors[e194483261a0ac90]::ExplicitBug>
  11:     0x79279f15a601 - <rustc_errors[e194483261a0ac90]::diagnostic::BugAbort as rustc_errors[e194483261a0ac90]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x79279f6a92ac - <rustc_errors[e194483261a0ac90]::DiagCtxtHandle>::span_bug::<rustc_span[e865731220afcfda]::span_encoding::Span, alloc[c1750e1d92c179af]::string::String>
  13:     0x79279f72fdca - rustc_middle[3b30e948e3f2f3ce]::util::bug::opt_span_bug_fmt::<rustc_span[e865731220afcfda]::span_encoding::Span>::{closure#0}
  14:     0x79279f7178da - rustc_middle[3b30e948e3f2f3ce]::ty::context::tls::with_opt::<rustc_middle[3b30e948e3f2f3ce]::util::bug::opt_span_bug_fmt<rustc_span[e865731220afcfda]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x79279f71774b - rustc_middle[3b30e948e3f2f3ce]::ty::context::tls::with_context_opt::<rustc_middle[3b30e948e3f2f3ce]::ty::context::tls::with_opt<rustc_middle[3b30e948e3f2f3ce]::util::bug::opt_span_bug_fmt<rustc_span[e865731220afcfda]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x79279e046fe7 - rustc_middle[3b30e948e3f2f3ce]::util::bug::span_bug_fmt::<rustc_span[e865731220afcfda]::span_encoding::Span>
  17:     0x7927a0ddac6e - rustc_hir_analysis[a8d0531b1c136f6]::coherence::coherent_trait
  18:     0x7927a0dd7a4b - rustc_query_impl[12d212d82618db]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[12d212d82618db]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>>
  19:     0x7927a0c810d7 - rustc_query_system[aaed86abacd7d44]::query::plumbing::try_execute_query::<rustc_query_impl[12d212d82618db]::DynamicConfig<rustc_query_system[aaed86abacd7d44]::query::caches::DefIdCache<rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[12d212d82618db]::plumbing::QueryCtxt, true>
  20:     0x7927a0fb4dcf - rustc_query_impl[12d212d82618db]::query_impl::coherent_trait::get_query_incr::__rust_end_short_backtrace
  21:     0x7927a11112bb - rustc_hir_analysis[a8d0531b1c136f6]::check::check::check_item_type
  22:     0x7927a0e9fae5 - rustc_hir_analysis[a8d0531b1c136f6]::check::wfcheck::check_well_formed
  23:     0x7927a0e9e1d1 - rustc_query_impl[12d212d82618db]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[12d212d82618db]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>>
  24:     0x7927a0c859a1 - rustc_query_system[aaed86abacd7d44]::query::plumbing::try_execute_query::<rustc_query_impl[12d212d82618db]::DynamicConfig<rustc_data_structures[bfe103198732ba63]::vec_cache::VecCache<rustc_span[e865731220afcfda]::def_id::LocalDefId, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[aaed86abacd7d44]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[12d212d82618db]::plumbing::QueryCtxt, true>
  25:     0x7927a0c8eeac - rustc_query_impl[12d212d82618db]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
  26:     0x7927a0e9af5d - rustc_hir_analysis[a8d0531b1c136f6]::check::wfcheck::check_mod_type_wf
  27:     0x7927a0e9ad5f - rustc_query_impl[12d212d82618db]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[12d212d82618db]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>>
  28:     0x7927a17c88e0 - rustc_query_system[aaed86abacd7d44]::query::plumbing::try_execute_query::<rustc_query_impl[12d212d82618db]::DynamicConfig<rustc_query_system[aaed86abacd7d44]::query::caches::DefaultCache<rustc_span[e865731220afcfda]::def_id::LocalModDefId, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[12d212d82618db]::plumbing::QueryCtxt, true>
  29:     0x7927a17c933b - rustc_query_impl[12d212d82618db]::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
  30:     0x7927a0b4ff4f - rustc_hir_analysis[a8d0531b1c136f6]::check_crate
  31:     0x7927a0c87cb4 - rustc_interface[2a0eb8606666de35]::passes::run_required_analyses
  32:     0x7927a186c4ba - rustc_interface[2a0eb8606666de35]::passes::analysis
  33:     0x7927a186c499 - rustc_query_impl[12d212d82618db]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[12d212d82618db]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 0usize]>>
  34:     0x7927a1867d6a - rustc_query_system[aaed86abacd7d44]::query::plumbing::try_execute_query::<rustc_query_impl[12d212d82618db]::DynamicConfig<rustc_query_system[aaed86abacd7d44]::query::caches::SingleCache<rustc_middle[3b30e948e3f2f3ce]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[12d212d82618db]::plumbing::QueryCtxt, true>
  35:     0x7927a1867876 - rustc_query_impl[12d212d82618db]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  36:     0x7927a196a27d - rustc_interface[2a0eb8606666de35]::passes::create_and_enter_global_ctxt::<core[6618104b838f8a53]::option::Option<rustc_interface[2a0eb8606666de35]::queries::Linker>, rustc_driver_impl[b51e5c2563a01b77]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  37:     0x7927a195ae0f - rustc_interface[2a0eb8606666de35]::interface::run_compiler::<(), rustc_driver_impl[b51e5c2563a01b77]::run_compiler::{closure#0}>::{closure#1}
  38:     0x7927a178f6c8 - std[19e82b1a4c46fd01]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2a0eb8606666de35]::util::run_in_thread_with_globals<rustc_interface[2a0eb8606666de35]::util::run_in_thread_pool_with_globals<rustc_interface[2a0eb8606666de35]::interface::run_compiler<(), rustc_driver_impl[b51e5c2563a01b77]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  39:     0x7927a178ffb4 - <<std[19e82b1a4c46fd01]::thread::Builder>::spawn_unchecked_<rustc_interface[2a0eb8606666de35]::util::run_in_thread_with_globals<rustc_interface[2a0eb8606666de35]::util::run_in_thread_pool_with_globals<rustc_interface[2a0eb8606666de35]::interface::run_compiler<(), rustc_driver_impl[b51e5c2563a01b77]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6618104b838f8a53]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7927a17913b7 - std::sys::pal::unix::thread::Thread::new::thread_start::h90408beae1bbc578
  41:     0x79279b8a370a - <unknown>
  42:     0x79279b927aac - <unknown>
  43:                0x0 - <unknown>

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 make sure that you have updated to the latest nightly

note: rustc 1.87.0-nightly (91a0e1604 2025-03-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 -C link-dead-code=true -Z validate-mir

query stack during panic:
#0 [coherent_trait] coherence checking all impls of trait `DynSend`
#1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.1qSxDNmayuCe/rustc_testrunner_tmpdir_reporting.rOJBIyr9pn9e/mvce.rs:5:11: 5:52>` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr 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 7, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 7, 2025
@matthiaskrgr
Copy link
Member Author

smaller example from somewhere else

auto trait MyTrait {}

impl<T> !MyTrait for *mut T {}

@matthiaskrgr
Copy link
Member Author

#137764

@compiler-errors compiler-errors self-assigned this Mar 7, 2025
compiler-errors added a commit to compiler-errors/rust that referenced this issue Mar 7, 2025
…e-impl, r=oli-obk

Delay bug for negative auto trait rather than ICEing

Fixes rust-lang#138149

r? oli-obk
compiler-errors added a commit to compiler-errors/rust that referenced this issue Mar 7, 2025
…e-impl, r=oli-obk

Delay bug for negative auto trait rather than ICEing

Fixes rust-lang#138149

r? oli-obk
@bors bors closed this as completed in 9aac24d Mar 8, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 8, 2025
Rollup merge of rust-lang#138173 - compiler-errors:incoherent-negative-impl, r=oli-obk

Delay bug for negative auto trait rather than ICEing

Fixes rust-lang#138149

r? oli-obk
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. 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