Skip to content

ICE: should have emitted a parenthesized generics error, -Zunpretty #109898

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc -Zunpretty=expanded --edition=2021 file.rs

trait Trait {
    async fn method() {}
}

fn foo<T: Trait<method(i32): Send>>() {}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (3a8a131e9 2023-04-02)
binary: rustc
commit-hash: 3a8a131e9509c478ece1c58fe0ea2d49463d2300
commit-date: 2023-04-02
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.0

Error output

<output>
Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: should have emitted a parenthesized generics error
 --> FE63C417F11E9E11E7A3B512BF1A640CC0D838E364D8259584C24D3FBF4E0CF6.rs:5:17
  |
5 | fn foo<T: Trait<method(i32): Send>>() {}
  |                 ^^^^^^^^^^^^^^^^^
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_ast_passes::feature_gate::PostExpansionVisitor as rustc_ast::visit::Visitor>::visit_assoc_constraint
             3: <rustc_ast_passes::feature_gate::PostExpansionVisitor as rustc_ast::visit::Visitor>::visit_generic_args
             4: <rustc_ast_passes::feature_gate::PostExpansionVisitor as rustc_ast::visit::Visitor>::visit_poly_trait_ref
             5: rustc_ast::visit::walk_fn::<rustc_ast_passes::feature_gate::PostExpansionVisitor>
             6: <rustc_ast_passes::feature_gate::PostExpansionVisitor as rustc_ast::visit::Visitor>::visit_fn
             7: rustc_ast::visit::walk_item::<rustc_ast_passes::feature_gate::PostExpansionVisitor>
             8: <rustc_ast_passes::feature_gate::PostExpansionVisitor as rustc_ast::visit::Visitor>::visit_item
             9: rustc_ast_passes::feature_gate::check_crate
            10: <rustc_session::session::Session>::time::<(), rustc_interface::passes::early_lint_checks::{closure#0}>
            11: rustc_interface::passes::early_lint_checks
            12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::early_lint_checks, rustc_query_impl::plumbing::QueryCtxt>
            13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::early_lint_checks
            14: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#1}>
            15: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            16: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            17: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            18: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
            19: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3a8a131e9509c478ece1c58fe0ea2d49463d2300/library/alloc/src/boxed.rs:1976:9
            20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3a8a131e9509c478ece1c58fe0ea2d49463d2300/library/alloc/src/boxed.rs:1976:9
            21: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/3a8a131e9509c478ece1c58fe0ea2d49463d2300/library/std/src/sys/unix/thread.rs:108:17
            22: <unknown>
            23: <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: rustc 1.70.0-nightly (3a8a131e9 2023-04-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=expanded

query stack during panic:
end of query stack

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-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.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions