Skip to content

[ICE]: is not an owner #163374

Open
Open

Description

@matthiaskrgr

Code

#[warn(rust_2024_prelude_collisions)]
fn main() {
    ().into_future()
}
use future::{IntoFuture};
mod future {
    pub trait IntoFuture {
        fn into_future(&self) {}
    }
    impl IntoFuture for () {}
}

Meta

rustc --version --verbose:

rustc 1.100.0-nightly (5ceaf6608 2026-09-25)
binary: rustc
commit-hash: 5ceaf6608eb354c2f5bbb3b8d974caa367dac81c
commit-date: 2026-09-25
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1

Error output

<output>
Backtrace

error: internal compiler error: /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_middle/src/hir/map.rs:140:32: DefId(0:5 ~ code[4489]::{use#1}::{use#0}) is not an owner
 --> code.rs:5:14
  |
5 | use future::{IntoFuture};
  |              ^^^^^^^^^^


thread 'rustc' (3425717) panicked at /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_middle/src/hir/map.rs:140:32:
Box<dyn Any>
stack backtrace:
   0:     0x7fe72d410916 - <<std[4e3e5122718436ea]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[df69dfd27f4aceb1]::fmt::Display>::fmt
   1:     0x7fe72da092df - core[df69dfd27f4aceb1]::fmt::write
   2:     0x7fe72d4258dc - <std[4e3e5122718436ea]::sys::stdio::unix::Stderr as core[df69dfd27f4aceb1]::io::write::Write>::write_fmt
   3:     0x7fe72d3e321a - std[4e3e5122718436ea]::panicking::default_hook::{closure#0}
   4:     0x7fe72d404d23 - std[4e3e5122718436ea]::panicking::default_hook
   5:     0x7fe72c168ed6 - std[4e3e5122718436ea]::panicking::update_hook::<alloc[f7b4942899dbd9a8]::boxed::Box<rustc_driver_impl[8a9241412565640d]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fe72d4051c2 - std[4e3e5122718436ea]::panicking::panic_with_hook
   7:     0x7fe72cf98f71 - std[4e3e5122718436ea]::panicking::begin_panic::<rustc_span[17eb9802bfc7b0b1]::macros::ExplicitBug>::{closure#0}
   8:     0x7fe72cf97abe - std[4e3e5122718436ea]::sys::backtrace::__rust_end_short_backtrace::<std[4e3e5122718436ea]::panicking::begin_panic<rustc_span[17eb9802bfc7b0b1]::macros::ExplicitBug>::{closure#0}, !>
   9:     0x7fe72cf97262 - std[4e3e5122718436ea]::panicking::begin_panic::<rustc_span[17eb9802bfc7b0b1]::macros::ExplicitBug>
  10:     0x7fe729311161 - rustc_span[17eb9802bfc7b0b1]::macros::bug_impl
  11:     0x7fe72dfce470 - <rustc_middle[bcd1109c707c4cd5]::ty::context::TyCtxt>::hir_expect_item
  12:     0x7fe72c4dadb2 - <rustc_hir_typeck[8b455a8928c70169]::fn_ctxt::FnCtxt>::trait_path_or_bare_name
  13:     0x7fe72c562207 - <rustc_hir_typeck[8b455a8928c70169]::method::prelude_edition_lints::AmbiguousTraitMethod as rustc_errors[5a936017551d7df9]::diagnostic::Diagnostic>::into_diag
  14:     0x7fe72c49280e - <rustc_middle[bcd1109c707c4cd5]::lint::emit_lint_base<rustc_hir_typeck[8b455a8928c70169]::method::prelude_edition_lints::AmbiguousTraitMethod, rustc_middle[bcd1109c707c4cd5]::lint::LevelSpec<rustc_lint_defs[b9a46a91eb6606ea]::StableLintExpectationId>>::{closure#0} as core[df69dfd27f4aceb1]::ops::function::FnOnce<(rustc_errors[5a936017551d7df9]::DiagCtxtHandle, rustc_errors[5a936017551d7df9]::Level)>>::call_once::{shim:vtable#0}
  15:     0x7fe72deffb18 - rustc_middle[bcd1109c707c4cd5]::lint::emit_lint_base::emit_lint_base_impl
  16:     0x7fe72db5d5e4 - <rustc_hir_typeck[8b455a8928c70169]::fn_ctxt::FnCtxt>::check_expr_method_call
  17:     0x7fe72e402335 - <rustc_hir_typeck[8b455a8928c70169]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18:     0x7fe72e3f497f - <rustc_hir_typeck[8b455a8928c70169]::fn_ctxt::FnCtxt>::check_expr_block
  19:     0x7fe72e402309 - <rustc_hir_typeck[8b455a8928c70169]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20:     0x7fe72e3ed678 - rustc_hir_typeck[8b455a8928c70169]::check::check_fn
  21:     0x7fe72ee5a486 - rustc_hir_typeck[8b455a8928c70169]::typeck_with_inspect::{closure#0}
  22:     0x7fe72ee5893a - rustc_query_impl[658b0b4479b4082]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
  23:     0x7fe72e42f6fa - rustc_query_impl[658b0b4479b4082]::execution::try_execute_query::<rustc_data_structures[479a506a1b750eb2]::vec_cache::VecCache<rustc_span[17eb9802bfc7b0b1]::def_id::LocalDefId, rustc_middle[bcd1109c707c4cd5]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[bcd1109c707c4cd5]::dep_graph::graph::DepNodeIndex>, false>
  24:     0x7fe72e42f32b - rustc_query_impl[658b0b4479b4082]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
  25:     0x7fe72e07f5fa - <rustc_middle[bcd1109c707c4cd5]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[ba0aa8f9a0e166c8]::check_crate::{closure#1}>::{closure#0}
  26:     0x7fe72e07eca5 - rustc_hir_analysis[ba0aa8f9a0e166c8]::check_crate
  27:     0x7fe72e42c0fc - rustc_interface[7962de54e6a85a]::passes::analysis
  28:     0x7fe72eb085c7 - rustc_query_impl[658b0b4479b4082]::execution::try_execute_query::<rustc_middle[bcd1109c707c4cd5]::query::caches::SingleCache<rustc_middle[bcd1109c707c4cd5]::query::erase::ErasedData<[u8; 0usize]>>, false>
  29:     0x7fe72eb0836b - rustc_query_impl[658b0b4479b4082]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  30:     0x7fe72eccd6fe - rustc_interface[7962de54e6a85a]::interface::run_compiler::<(), rustc_driver_impl[8a9241412565640d]::run_compiler::{closure#0}>::{closure#2}
  31:     0x7fe72ed135e4 - std[4e3e5122718436ea]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[7962de54e6a85a]::util::run_in_thread_with_globals<rustc_interface[7962de54e6a85a]::util::run_in_thread_pool_with_globals<rustc_interface[7962de54e6a85a]::interface::run_compiler<(), rustc_driver_impl[8a9241412565640d]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  32:     0x7fe72ed1338b - <std[4e3e5122718436ea]::thread::lifecycle::spawn_unchecked<rustc_interface[7962de54e6a85a]::util::run_in_thread_with_globals<rustc_interface[7962de54e6a85a]::util::run_in_thread_pool_with_globals<rustc_interface[7962de54e6a85a]::interface::run_compiler<(), rustc_driver_impl[8a9241412565640d]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[df69dfd27f4aceb1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7fe72ed1eb5b - <std[4e3e5122718436ea]::sys::thread::unix::Thread>::new::thread_start
  34:     0x7fe727c980a2 - <unknown>
  35:     0x7fe727d2080c - <unknown>
  36:                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: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-09-26T12_23_20-3425707.txt` to your bug report

note: rustc 1.100.0-nightly (5ceaf6608 2026-09-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck_root] type-checking `main`
#1 [analysis] running analysis passes on crate `code`
end of query stack
error: aborting due to 1 previous error

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Sep 26, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 26, 2026
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 26, 2026
  4. matthiaskrgr commented on Sep 26, 2026

    @matthiaskrgr
    MemberAuthor

    this compiled on beta:

    warning: trait method `into_future` will become ambiguous in Rust 2024
     --> code.rs:3:5
      |
    3 |     ().into_future()
      |     ^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `IntoFuture::into_future(&())`
      |
      = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
      = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/prelude.html>
    note: the lint level is defined here
     --> code.rs:1:8
      |
    1 | #[warn(rust_2024_prelude_collisions)]
      |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    warning: 1 warning emitted
    
  5. matthiaskrgr commented on Sep 26, 2026

    @matthiaskrgr
    MemberAuthor

    this smells like #161349 because when I change
    use future::{IntoFuture};
    to
    use future::IntoFuture;, the code compiles

  6. apiraino commented on Sep 26, 2026

    @apiraino
    Contributor

    I think I'm doing something wrong, I can't reproduce with the nightly build you indicate. I just run rustc test.rs on your repro and I see no difference with compiling with the beta or stable. Maybe I need some params? 🤔

  7. matthiaskrgr commented on Sep 26, 2026

    @matthiaskrgr
    MemberAuthor

    it does reproduce for me with editions 2015 (default) and 2018, 2021.
    Did you do this inside a cargo new (which defaults to 2024)?
    playground repro:

    https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b2cb4b611c7907c6dccee0c3080c1869

  8. Sontran0118 commented on Sep 27, 2026

    @Sontran0118

    I reproduced the error in editions 2015, 2018, and 2021. The same error also showed up in this code:

    fn main() {
        ().try_into()
    }
    use conv::{TryIntoLike};
    mod conv {
        pub trait TryIntoLike {
            fn try_into(&self) {}
        }
        impl TryIntoLike for () {}
    }
    
    
  9. added
    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 28, 2026
  10. added and removed on Oct 10, 2026
  11. Kuksgauzen commented on Oct 10, 2026

    @Kuksgauzen
    Contributor

    Bisected the MCVE above (edition 2021, cargo build):

    searched nightlies: from nightly-2026-09-20 to nightly-2026-09-27
    regressed nightly: nightly-2026-09-26
    searched commit range: f7575a9...5ceaf66
    regressed commit: 0d38a84

    bisected with cargo-bisect-rustc v0.6.12

    Host triple: aarch64-apple-darwin
    Reproduce with:

    cargo bisect-rustc --start 2026-09-20 --end 2026-09-27 --regress ice --access github -- build 

    Regressed in #161349. cc @oli-obk @petrochenkov

    Re-checked on the CI builds around the merge (f7575a9da8e4 builds, 0d38a842626a ICEs) on both aarch64-apple-darwin and x86_64-unknown-linux-gnu. Still reproduces on 1.100.0-beta.4 and nightly-2026-10-10 (32dba69d6).

    The backtrace points at the lint suggestion: AmbiguousTraitMethod::into_diag → FnCtxt::trait_path_or_bare_name → hir_expect_item(import_id) (here). The code right after it treats UseKind::Nested as unreachable!(), so it looks like it still assumes flattened use lists, which #161349 changed. Both parts are needed to hit it: the lint has to fire (no ICE with #[allow(rust_2024_prelude_collisions)] or in edition 2024), and the import has to be in braces (use future::IntoFuture; compiles fine).

    In the 1.100 beta crater runs (beta-1.100-2 and beta-1.100-3) this ICE shows up only in stackvec 0.2.1 (#164084): I scanned all 1,871 regression logs that are not depends-on across the two runs (all fetched with HTTP 200).

    Edit: it also triggers with default lint levels. array_into_iter is warn-by-default in editions 2015 and 2018 and goes through the same path, so an .into_iter() call on an array plus a same-named trait method imported through a use list is enough. MCVE without attributes: #164084 (comment)

    @rustbot label +S-has-bisection

  12. self-assigned this
    on Oct 11, 2026
  13. oli-obk commented on Oct 11, 2026

    @oli-obk
    Contributor

    Ah interesting. Yea we'll have to look at the impl of that lint. Probably need to switch from calling Resolver::owner_id to picking the right method depending on whether we are the owner. Maybe we should reintroduce local_def_id as a helper that just does that.

  14. theemathas commented on Oct 11, 2026

    @theemathas
    Contributor

    @Kuksgauzen Thank you for contributing! Although, I would like to note our LLM policy. LLM text tends to contain excessive unnecessary information and be overly verbose. Many people find such text unpleasant to read. So, we would prefer that you manually summarize the LLM output. Thanks!

  15. theemathas commented on Oct 11, 2026

    @theemathas
    Contributor

    #164084 is possibly a duplicate of this, but with a different lint.

  16. theemathas commented on Oct 19, 2026

    @theemathas
    Contributor

    @Sontran0118 @oli-obk FYI, both of you are currently assigned this issue.

  17. oli-obk commented on Oct 20, 2026

    @oli-obk
    Contributor

    Yea I was at eurorust last week and have a work meeting this week. Should get to it later this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}S-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant 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.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions