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: no resolution for an import #121760

Closed
matthiaskrgr opened this issue Feb 28, 2024 · 3 comments · Fixed by #121846
Closed

ICE: no resolution for an import #121760

matthiaskrgr opened this issue Feb 28, 2024 · 3 comments · Fixed by #121846
Assignees
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 28, 2024

auto-reduced (treereduce-rust):

mod framing {
    mod public_message_in {
        mod public_message {

            pub struct ConfirmedTranscriptHashInput;
        }

        mod public_message_in {

            #[derive(Debug)]
            pub struct ConfirmedTranscriptHashInput;
        }

        pub use self::public_message::*;
        pub use self::public_message_in::*;
    }

    pub use self::public_message_in::*;
}

use crate::framing::ConfirmedTranscriptHashInput::public_message_in;

fn main() {}
original code

original:

// https://github.com/rust-lang/rust/pull/113099
//~^ WARNING `ConfirmedTranscriptHashInput` is ambiguous

mod framing {
    mod public_message_in {
    mod public_message {
        use super::*;

        #[derive(Debug)]
        pub struct ConfirmedTranscriptHashInput;
    }

    mod public_message_in {
        use super::*;

        #[derive(Debug)]
        pub struct ConfirmedTranscriptHashInput;
    }

    pub use self::public_message::*;
    pub use self::public_message_in::*;
}

    mod framing {
    mod public_message {
        use super::*;

        #[derive(Debug)]
        pub struct ConfirmedTranscriptHashInput;
    }

    mod public_message_in {
        use super::*;

        #[derive(Debug)]
        pub struct ConfirmedTranscriptHashInput;
    }

    pub use self::public_message::*;
    pub use self::public_message_in::*;
}

    pub use self::public_message_in::*;
    pub use super::*;
}

use crate::framing::ConfirmedTranscriptHashInput::public_message_in;
//~^ WARNING `ConfirmedTranscriptHashInput` is ambiguous
// https://github.com/rust-lang/rust/pull/113099

fn main() { }

Version information

rustc 1.78.0-nightly (d377991ba 2024-02-28)
binary: rustc
commit-hash: d377991bad40c0d5c79bfa58465295751e8542fe
commit-date: 2024-02-28
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: `ConfirmedTranscriptHashInput` is ambiguous
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:21:21
   |
21 | use crate::framing::ConfirmedTranscriptHashInput::public_message_in;
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
   = note: ambiguous because of multiple glob imports of a name in the same module
note: `ConfirmedTranscriptHashInput` could refer to the struct imported here
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:14:17
   |
14 |         pub use self::public_message::*;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^
   = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
note: `ConfirmedTranscriptHashInput` could also refer to the struct imported here
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:15:17
   |
15 |         pub use self::public_message_in::*;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
   = note: `#[warn(ambiguous_glob_imports)]` on by default

warning: unused import: `self::public_message_in::*`
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:15:17
   |
15 |         pub use self::public_message_in::*;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: struct `ConfirmedTranscriptHashInput` is never constructed
 --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:5:24
  |
5 |             pub struct ConfirmedTranscriptHashInput;
  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: struct `ConfirmedTranscriptHashInput` is never constructed
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:11:24
   |
11 |             pub struct ConfirmedTranscriptHashInput;
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `ConfirmedTranscriptHashInput` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

warning: 4 warnings emitted

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: no resolution for an import
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:21:5
   |
21 | use crate::framing::ConfirmedTranscriptHashInput::public_message_in;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at compiler/rustc_ast_lowering/src/lib.rs:743:24
         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_ast_lowering::LoweringContext>::lower_import_res
         4: <rustc_ast_lowering::LoweringContext>::lower_use_tree
         5: <rustc_ast_lowering::LoweringContext>::lower_item_kind
         6: <rustc_ast_lowering::item::ItemLowerer>::lower_node
         7: rustc_ast_lowering::lower_to_hir
         8: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        10: rustc_query_impl::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
        14: <rustc_middle::hir::map::Map>::attrs
        15: rustc_passes::entry::entry_fn
        16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 12]>>
        17: <rustc_query_impl::query_impl::entry_fn::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 12]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        19: rustc_query_impl::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
        20: rustc_interface::passes::analysis
        21: 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]>>
        22: 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>
        23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        24: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        25: 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>>
        26: <<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}
        27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d377991bad40c0d5c79bfa58465295751e8542fe/library/alloc/src/boxed.rs:2016:9
        28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d377991bad40c0d5c79bfa58465295751e8542fe/library/alloc/src/boxed.rs:2016:9
        29: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/d377991bad40c0d5c79bfa58465295751e8542fe/library/std/src/sys/pal/unix/thread.rs:108:17
        30: <unknown>
        31: <unknown>
  --> /tmp/icemaker_global_tempdir.A9iMdoxm4bt7/rustc_testrunner_tmpdir_reporting.IXnzClC1fpP8/mvce.rs:21:5
   |
21 | use crate::framing::ConfirmedTranscriptHashInput::public_message_in;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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.78.0-nightly (d377991ba 2024-02-28) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Feb 28, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 28, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: `no resolution for an import ICE: no resolution for an import Feb 28, 2024
@matthiaskrgr
Copy link
Member Author

regression in #120609 cc @petrochenkov

@jieyouxu jieyouxu added A-resolve Area: Name resolution S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 28, 2024
@matthiaskrgr
Copy link
Member Author

mod A {
    mod B {
        mod C {
            pub struct D;
        }

        mod B {
            #[derive(Debug)]
            pub struct D;
        }

        pub use self::B::*;
        pub use self::C::*;
    }

    pub use self::B::*;
}

use crate::A::D::B;

fn main() {}

@bvanjoi
Copy link
Contributor

bvanjoi commented Mar 1, 2024

I believe the root cause of this issue stems from the changes I made, so @rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 5, 2024
only compare ambiguity item that have hard error

Fixes rust-lang#121760

An easy fix, r? `@petrochenkov`
@bors bors closed this as completed in 152b690 Mar 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2024
Rollup merge of rust-lang#121846 - bvanjoi:fix-121760, r=petrochenkov

only compare ambiguity item that have hard error

Fixes rust-lang#121760

An easy fix, r? ``@petrochenkov``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

4 participants