Skip to content

Fingerprints not matching #85429

Closed
Closed
@myz-dev

Description

@myz-dev

Hi,

the compiler asked me to provide this bug report so I hope I can provide some useful information:
I boiled the code down to:

Code

mod udp;
const INTERNAL_UDP_COMM_LOCAL_ADDR: &str = "127.0.0.1:14555";
const INTERNAL_UDP_COMM_REMOTE_ADDR: &str = "127.0.0.1:14556";
const INTERNAL_UDP_COMM_REMOTE_PORT_NO: u16 = 14556;

fn send_table() -> String {
    let mut send_buf = [0; 250];
    let mut i: u8 = 0;
    for n in 0..250 {
        send_buf[n] = i;
        i = i + 1;
    }
    let udp_sender = match udp::UdpComm::new(
        &INTERNAL_UDP_COMM_LOCAL_ADDR,
        INTERNAL_UDP_COMM_REMOTE_ADDR.to_string(),
        false,
        true,
    ) {
        Some(c) => c,
        None => {
            eprintln! {"ERROR! Could not create UdpComm object!"};
            return "ERROR! Could not create UdpComm object!".to_string();
        }
    };
    use std::net::{IpAddr, Ipv4Addr, SocketAddr};
    let remote_socket = SocketAddr::new(
        IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
        INTERNAL_UDP_COMM_REMOTE_PORT_NO,
    );

    let sent = udp_sender.sendto(&send_buf, remote_socket);
    println!("Sent out {} bytes!", sent);
    return "Send OK".to_string();
}


fn main() {
        let some_string = send_table();
        println!("{}", some_string);
}

//udp file
use std::net::UdpSocket;

pub struct UdpComm {
    _local_address: &'static str,
    _remote_address: String,
    verbose: bool,
    pub socket: UdpSocket,
}

const INVALID_IP: (u8, u8, u8, u8) = (0, 0, 0, 0);
const INVALID_PORT: u16 = 0;

impl UdpComm {
    /// creates new isntance of UdpComm
    /// can be blocking or not blocking
    /// # Arguments
    /// * 'local_addr' - pass like "127.0.0.1:6547"
    /// * 'remote_addr' - pass like "127.0.0.1:6548"
    /// * 'is_not_blocking' - determines behaviour of the socket
    /// # Examples
    /// ```rust
    /// let somestr = "127.0.0.1:34254";
    /// let my_comm = match UdpComm::new(somestr, "not used".to_string(), true) {
    ///    Some(c) => c,
    ///    None => {
    ///        eprintln! {"ERROR! Could not create UdpComm object!"};
    ///        return Ok(());
    ///    }
    /// };
    /// let mut buf = [0; 10];
    /// let (len, src) = my_comm.socket.recv_from(&mut buf)?;
    /// ```
    pub fn new(
        local_addr: &'static str,
        remote_addr: String,
        debug_output: bool,
        is_not_blocking: bool,
    ) -> Option<UdpComm> {
        match UdpSocket::bind(local_addr) {
            Ok(the_socket) => {
                Some(UdpComm {
                    _local_address: local_addr,
                    _remote_address: remote_addr,
                    verbose: debug_output,
                    socket: {
                        match the_socket.set_nonblocking(is_not_blocking) {
                        Ok(_) => println!("OK!"),
                        Err(e) => println!("Error while trying to set the socket blocking mode to {:?}. Error: {}", is_not_blocking, e),
                    }
                        the_socket
                    },
                })
            }
            Err(_) => None,
        }
    }
    pub fn sendto(&self, buf: &[u8], addr: std::net::SocketAddr) -> usize {
        use std::net::{IpAddr, Ipv4Addr};
        // check if the socket is invalid
        if addr.ip()
            == IpAddr::V4(Ipv4Addr::new(
                INVALID_IP.0,
                INVALID_IP.1,
                INVALID_IP.2,
                INVALID_IP.3,
            ))
            && addr.port() == INVALID_PORT
        {
            return 0;
        }
        let mut ret: usize = 0;

        match self.socket.send_to(buf, &addr) {
            Ok(u) => ret = u,
            Err(e) => {
                if self.verbose {
                    eprintln!("Error when sending: {:?}", e)
                };
            }
        }
        ret
    }
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (42816d61e 2021-04-24)
binary: rustc
commit-hash: 42816d61ead7e46d462df997958ccfd514f8c21c
commit-date: 2021-04-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(16583452399460452482, 11050759427754160152))`,
 right: `Some(Fingerprint(15134842177790262924, 9594111019284992043))`: found unstable fingerprints for predicates_of(core[ec89]::iter::traits::collect::IntoIterator): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::iter::IntoIterator>), []), /home/myz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:202:1: 202:23 (#0))] }', /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/compiler/rustc_query_system/src/query/plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.53.0-nightly (42816d61e 2021-04-24) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [predicates_of] computing predicates of `std::iter::IntoIterator`
#1 [typeck] type-checking `send_table`
end of query stack
error: could not compile `web_test`

To learn more, run the command again with --verbose.
Backtrace

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(16583452399460452482, 11050759427754160152))`,
 right: `Some(Fingerprint(15134842177790262924, 9594111019284992043))`: found unstable fingerprints for predicates_of(core[ec89]::iter::traits::collect::IntoIterator): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::iter::IntoIterator>), []), /home/myz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:202:1: 202:23 (#0))] }', /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/compiler/rustc_query_system/src/query/plumbing.rs:593:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/core/src/panicking.rs:92:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
   4: rustc_query_system::query::plumbing::incremental_verify_ich
   5: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
   6: rustc_query_system::query::plumbing::get_query_impl
   7: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::predicates_of
   8: rustc_middle::ty::generics::GenericPredicates::instantiate_into
   9: rustc_middle::ty::generics::GenericPredicates::instantiate
  10: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_bounds
  11: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::add_required_obligations
  12: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::resolve_lang_item_path
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  15: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  16: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  18: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_scrutinee_type
  19: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  22: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  23: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  24: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  25: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  27: rustc_typeck::check::check::check_fn
  28: rustc_infer::infer::InferCtxtBuilder::enter
  29: rustc_typeck::check::typeck
  30: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::force_query_with_job
  34: rustc_query_system::query::plumbing::get_query_impl
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  36: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  37: rustc_typeck::check::typeck_item_bodies
  38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_data_structures::stack::ensure_sufficient_stack
  41: rustc_query_system::query::plumbing::force_query_with_job
  42: rustc_query_system::query::plumbing::get_query_impl
  43: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  44: rustc_session::utils::<impl rustc_session::session::Session>::time
  45: rustc_typeck::check_crate
  46: rustc_interface::passes::analysis
  47: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  48: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  49: rustc_data_structures::stack::ensure_sufficient_stack
  50: rustc_query_system::query::plumbing::force_query_with_job
  51: rustc_query_system::query::plumbing::get_query_impl
  52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  53: rustc_interface::passes::QueryContext::enter
  54: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  55: rustc_span::with_source_map
  56: rustc_interface::interface::create_compiler_and_run
  57: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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.53.0-nightly (42816d61e 2021-04-24) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [predicates_of] computing predicates of `std::iter::IntoIterator`
#1 [typeck] type-checking `send_table`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `web_test`

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions