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

thread 'rustc' panicked at 'called Result::unwrap() on an Err value: DistinctSources(DistinctSources #66805

Open
dawid-nowak opened this issue Nov 27, 2019 · 16 comments
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been 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.

Comments

@dawid-nowak
Copy link

Compiler panics. Debugging info attached. I would expect the compiler not to crash and print an error.
out.txt

@jonas-schievink
Copy link
Contributor

Please provide the source code needed to reproduce this.

Backtrace:

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("src/main.rs"), BytePos(0)), end: (Macros("::async_stream::stream"), BytePos(12713142)) })', src/libcore/result.rs:1165:5
stack backtrace:
  <snip>
  15: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  16: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  17: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  18: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
  19: rustc_errors::HandlerInner::emit_diagnostic
  20: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  21: rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt>::demand_coerce
  22: rustc_typeck::check::FnCtxt::check_argument_types
  23: rustc_typeck::check::FnCtxt::check_method_argument_types
  24: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  25: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_meets_expectation_or_error
  27: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  28: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  29: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  30: rustc_typeck::check::FnCtxt::check_stmt
  31: rustc_typeck::check::FnCtxt::check_block_with_expected
  32: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  33: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  34: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_meets_expectation_or_error
  35: rustc_typeck::check::FnCtxt::check_stmt
  36: rustc_typeck::check::FnCtxt::check_block_with_expected
  37: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  38: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  39: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  40: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  41: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  42: rustc_typeck::check::FnCtxt::check_block_with_expected
  43: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  44: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  45: rustc_typeck::check::FnCtxt::check_block_with_expected
  46: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  47: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  48: rustc_typeck::check::FnCtxt::check_block_with_expected
  49: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  50: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  51: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  52: rustc_typeck::check::check_fn
  53: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  54: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  55: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  56: rustc_typeck::check::FnCtxt::check_argument_types
  57: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  58: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  59: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  60: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  61: rustc_typeck::check::FnCtxt::check_argument_types
  62: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  63: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  64: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  65: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  66: rustc_typeck::check::FnCtxt::check_block_with_expected
  67: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  68: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  69: rustc_typeck::check::FnCtxt::check_decl_initializer
  70: rustc_typeck::check::FnCtxt::check_decl_local
  71: rustc_typeck::check::FnCtxt::check_stmt
  72: rustc_typeck::check::FnCtxt::check_block_with_expected
  73: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  74: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  75: rustc_typeck::check::FnCtxt::check_block_with_expected
  76: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  77: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  78: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  79: rustc_typeck::check::check_fn
  80: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  81: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  82: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  83: rustc_typeck::check::FnCtxt::check_argument_types
  84: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  85: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  86: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  87: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  88: rustc_typeck::check::FnCtxt::check_argument_types
  89: rustc_typeck::check::FnCtxt::check_method_argument_types
  90: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  91: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  92: rustc_typeck::check::FnCtxt::check_block_with_expected
  93: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  94: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  95: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  96: rustc_typeck::check::check_fn
  97: rustc::ty::context::GlobalCtxt::enter_local
  98: rustc_typeck::check::typeck_tables_of
  99: rustc::ty::query::__query_compute::typeck_tables_of
 100: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
 101: rustc::dep_graph::graph::DepGraph::with_task_impl
 102: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
 103: rustc::ty::query::__query_compute::typeck_tables_of
 104: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
 105: rustc::dep_graph::graph::DepGraph::with_task_impl

@jonas-schievink
Copy link
Contributor

Might be a duplicate of #63800, please retry with the newest nightly

@dawid-nowak
Copy link
Author

dawid-nowak commented Nov 27, 2019 via email

@dawid-nowak
Copy link
Author

code to reproduce the problem
bug.tar.gz

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2019
@jonas-schievink
Copy link
Contributor

Thanks!

@dawid-nowak
Copy link
Author

same behavior with async-stream = "0.2.0"

@hellow554
Copy link
Contributor

reduced (but not minimal yet):

pub fn func() {}

fn main() {
    let s = async_stream::stream! {
        Ok(0_i32)?;
        yield func();
    };  
}

Seems to be an issue with the ? operator and a non Result yield in the next line

@pnkfelix pnkfelix added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Nov 28, 2019
@pnkfelix
Copy link
Member

triage: P-high. Removing nomination label.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Nov 28, 2019
@hellow554
Copy link
Contributor

hellow554 commented Nov 28, 2019

I tried to boil it down and am now have three files. One main.rs, one a.rs which contains the macro_rules! macro (kind of like #63800) and one for the proc macro which I can't get rid of atm. Maybe somebody has a good idea:

src/main.rs:

#![feature(proc_macro_hygiene)]

use std::marker::PhantomData;
use pm::crash;

mod a;

struct Sender<T> {
    _p: PhantomData<T>,
}

impl<T> Sender<T> {
    fn new() -> Self { unimplemented!() }
    fn send(self, _: T) {}
}

fn func() {}

fn main() {
    stream! {
        ()?;
        yield func();
    }   
}

src/a.rs:

#[macro_export]
macro_rules! stream {
    ($($body:tt)*) => {{
        crash! {
             {
                 $($body)*
             }
        }
        stream_0!()
    }}  
}

pm/src/lib.rs:

extern crate proc_macro;

use proc_macro::{Group, TokenStream, TokenTree};
use quote::quote;
use syn::visit_mut::VisitMut;

struct Dummy;


impl VisitMut for Dummy {
    fn visit_expr_mut(&mut self, i: &mut syn::Expr) {
        match i { 
            syn::Expr::Yield(yield_expr) => {
                let value_expr = yield_expr.expr.as_ref().unwrap();
                *i = syn::parse_quote! { __yield_tx.send(#value_expr)}
            }
            syn::Expr::Try(try_expr) => {
                let e = &try_expr.expr;
                *i = syn::parse_quote! { __yield_tx.send(Err(#e)) };
            }
            _ => (), 
        }
    }   
}

fn replace_for_await(input: TokenStream) -> TokenStream {
    input.into_iter().map(|token| {
        match token {
            TokenTree::Group(group) => {
                let stream = replace_for_await(group.stream());
                Group::new(group.delimiter(), stream).into()
            }
            _ => token
        }
    }).collect()
}

#[proc_macro]
pub fn crash(input: TokenStream) -> TokenStream {
    let inner = replace_for_await(input);
    let syn::Block { mut stmts, .. } = syn::parse(inner).unwrap();

    for mut stmt in &mut stmts[..] {
        Dummy.visit_stmt_mut(&mut stmt);
    }   

    quote!(
            let __yield_tx = crate::Sender::new();
            macro_rules! stream_0 {
                () => {{
                    #(#stmts)*
                }}
            }
    )   
    .into()
}

where the Cargo.toml for pm contains:

[package]
name = "pm"
version = "0.0.0"
edition = "2018"

[lib]
proc-macro = true

[dependencies]
syn = { version = "1", features = ["full", "visit-mut"]}
quote = "1"

@hellow554
Copy link
Contributor

hellow554 commented Nov 28, 2019

This is indeed very similar to #63800 .

The clue is, that a proc macro must create a macro_rules macro and then it must be called within the other macro (in this case stream_0! will be called inside stream!).

I added the proc_macro_hygiene feature to be able to simply this a bit. It is not needed for the ICE at all (see previous versions of #66805 (comment)).

@matthewjasper you fix the original problem. Would you like to take a guess what's happening?

@Amanita-muscaria
Copy link

I've seen something similiar. I don't know if it's the same or not but this is what I've got

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("src/shell/filesystem_shell.rs"), BytePos(517740)), end: (Macros("::async_stream::stream"), BytePos(16954038)) })', src/librustc_errors/lib.rs:187:29
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1057
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/3291ae33907f2a866ea6cea89113200555038d06/src/liballoc/boxed.rs:1029
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/3291ae33907f2a866ea6cea89113200555038d06/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  14: rust_begin_unwind
             at src/libstd/panicking.rs:380
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  16: core::option::expect_none_failed
             at src/libcore/option.rs:1198
  17: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  18: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  19: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
  20: <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
  21: rustc_errors::HandlerInner::emit_diagnostic
  22: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  23: rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt>::demand_coerce
  24: rustc_typeck::check::FnCtxt::check_argument_types
  25: rustc_typeck::check::FnCtxt::check_method_argument_types
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  27: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  28: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  29: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  30: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  31: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  32: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  33: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  34: rustc_typeck::check::FnCtxt::check_block_with_expected
  35: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  37: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  38: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  39: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  40: rustc_typeck::check::FnCtxt::check_block_with_expected
  41: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  42: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  43: rustc_typeck::check::FnCtxt::check_stmt
  44: rustc_typeck::check::FnCtxt::check_block_with_expected
  45: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  46: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  47: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  48: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  49: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  50: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  51: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  52: rustc_typeck::check::FnCtxt::check_block_with_expected
  53: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  54: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  55: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  56: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  57: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  58: rustc_typeck::check::FnCtxt::check_block_with_expected
  59: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  60: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  61: rustc_typeck::check::FnCtxt::check_block_with_expected
  62: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  63: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  64: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  65: rustc_typeck::check::check_fn
  66: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  67: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  68: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  69: rustc_typeck::check::FnCtxt::check_argument_types
  70: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  71: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  72: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  73: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  74: rustc_typeck::check::FnCtxt::check_argument_types
  75: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  76: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  77: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  78: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  79: rustc_typeck::check::FnCtxt::check_block_with_expected
  80: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  81: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  82: rustc_typeck::check::FnCtxt::check_decl_initializer
  83: rustc_typeck::check::FnCtxt::check_decl_local
  84: rustc_typeck::check::FnCtxt::check_stmt
  85: rustc_typeck::check::FnCtxt::check_block_with_expected
  86: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  87: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  88: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  89: rustc_typeck::check::check_fn
  90: rustc::ty::context::tls::with_context::{{closure}}
  91: rustc_typeck::check::typeck_tables_of
  92: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  93: rustc::dep_graph::graph::DepGraph::with_task_impl
  94: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::force_query
  95: rustc::ty::query::plumbing::force_from_dep_node
  96: rustc::dep_graph::graph::DepGraph::try_mark_previous_green
  97: rustc::dep_graph::graph::DepGraph::try_mark_green
  98: rustc::dep_graph::graph::DepGraph::try_mark_green_and_read
  99: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
 100: rustc_typeck::collect::type_of
 101: rustc::ty::query::__query_compute::type_of
 102: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
 103: rustc::dep_graph::graph::DepGraph::with_task_impl
 104: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
 105: rustc_hir::intravisit::walk_expr
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (3291ae339 2020-01-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [typeck_tables_of] processing `<shell::filesystem_shell::FilesystemShell as shell::shell::Shell>::ls`
#1 [typeck_tables_of] processing `<shell::filesystem_shell::FilesystemShell as shell::shell::Shell>::ls::{{closure}}#0`
#2 [type_of] processing `<shell::filesystem_shell::FilesystemShell as shell::shell::Shell>::ls::{{closure}}#0`
#3 [collect_mod_item_types] collecting item types in module `shell::filesystem_shell`
#4 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `nu`.
  • Toolchain: Both stable 1.40.0 and nightly 1.42.0 (x86_64-unknown-linux-gnu)

  • The commit I was working on is here: Amanita-muscaria/nushell@54db654

  • uname -r: 5.4.11-arch1-1

  • CPU: Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz

Let me know if there's any other information you need.

@jonas-schievink
Copy link
Contributor

A pretty small reproduction was posted in #68605

@chastabor
Copy link

I'm having the same issue on rustc 1.41.0 (5e1a799 2020-01-27) running on x86_64-unknown-linux-gnu
mdepot.out.txt
main.rs.txt
Cargo.toml.txt

@jonas-schievink jonas-schievink removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Feb 4, 2020
@chastabor
Copy link

The issue I was running into does not break when I change to nightly:
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.42.0-nightly (212b2c7 2020-01-30)

@jackh726 jackh726 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Feb 1, 2022
@jackh726
Copy link
Member

jackh726 commented Feb 1, 2022

Marking as needs test - from reading this thread, seems like this might be fixed (though feel free to remove label if this isn't the case)

@jackh726
Copy link
Member

jackh726 commented Feb 3, 2022

I tried to boil it down and am now have three files. One main.rs, one a.rs which contains the macro_rules! macro (kind of like #63800) and one for the proc macro which I can't get rid of atm. Maybe somebody has a good idea:

I made two changes: 1) Adding #[derive(Copy, Clone)] on Sender 2) Changing func to return Result<(), ()> With those, this compiles.

Removing priority label.

@jackh726 jackh726 removed the P-high High priority label Feb 3, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been 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.
Projects
None yet
Development

No branches or pull requests

7 participants