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: should have emitted a parenthesized generics error, -Zunpretty #109898

Closed
matthiaskrgr opened this issue Apr 3, 2023 · 1 comment · Fixed by #109914
Closed

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

matthiaskrgr opened this issue Apr 3, 2023 · 1 comment · Fixed by #109914
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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

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

@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. requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Apr 3, 2023
@compiler-errors compiler-errors self-assigned this Apr 3, 2023
@matthiaskrgr
Copy link
Member Author

regressed in 7402519 (probably where the assert was added)

aliemjay added a commit to aliemjay/rust that referenced this issue Apr 4, 2023
…oli-obk

Emit feature error for parenthesized generics in associated type bounds

We don't actually do AST->HIR lowering with some `-Zunpretty` flags, so it's not correct to just delay a bug instead of emitting a feature error.

Some diagnostics regressed because of the new errors, but oh well. 🤷

Fixes rust-lang#109898
@bors bors closed this as completed in a5c395e Apr 4, 2023
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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.

2 participants