rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.34k stars 12.72k forks source link

rustc panic #97556

Closed lz1998 closed 2 years ago

lz1998 commented 2 years ago

Code

pub fn break_sentence(s: &str) -> Vec<usize> {
    use icu_segmenter::SentenceBreakSegmenter;
    let provider = icu_testdata::get_provider();
    let segmenter = SentenceBreakSegmenter::try_new(&provider).expect("Data exists");

    let breakpoints: Vec<usize> = segmenter.segment_str(s).collect();
    breakpoints
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_break_sentence() {
        println!("{:?}", break_sentence("Hello World. Hello world."));
    }
}
[package]
name = "sentence_test"
version = "0.1.0"
edition = "2021"

[dependencies]
icu_segmenter = "0.6"
icu_testdata="0.6"

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (e85edd9a8 2022-04-28)
binary: rustc
commit-hash: e85edd9a844b523a02dbd89f3c02cd13e4c9fe46
commit-date: 2022-04-28
host: x86_64-apple-darwin
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

thread 'rustc' panicked at 'assertion failed: !new_self_ty.has_escaping_bound_vars()', compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs:1960:9
Backtrace

``` stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3: ::mk_trait_obligation_with_new_self_ty 4: ::suggest_add_reference_to_arg::{closure#1} 5: ::suggest_add_reference_to_arg 6: ::report_selection_error 7: ::report_fulfillment_error 8: ::report_fulfillment_errors 9: ::check_argument_types 10: ::confirm_builtin_call 11: ::check_call 12: ::check_expr_kind 13: ::check_expr_with_expectation_and_args 14: ::check_expr_kind 15: ::check_expr_with_expectation_and_args 16: ::check_decl_initializer 17: ::check_decl 18: ::check_stmt 19: ::check_block_with_expected 20: ::check_expr_kind 21: ::check_expr_with_expectation_and_args 22: ::check_return_expr 23: rustc_typeck::check::check::check_fn 24: ::enter::<&rustc_middle::ty::context::TypeckResults, ::enter::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}> 25: rustc_typeck::check::typeck 26: >::with_task:: 27: rustc_query_system::query::plumbing::try_execute_query::> 28: rustc_query_system::query::plumbing::get_query:: 29: ::par_body_owners:: 30: rustc_typeck::check::typeck_item_bodies 31: >::with_task:: 32: rustc_query_system::query::plumbing::try_execute_query::> 33: rustc_query_system::query::plumbing::get_query:: 34: ::time::<(), rustc_typeck::check_crate::{closure#7}> 35: rustc_typeck::check_crate 36: rustc_interface::passes::analysis 37: >::with_task::> 38: rustc_query_system::query::plumbing::try_execute_query::>> 39: rustc_query_system::query::plumbing::get_query:: 40: ::enter::> 41: ::enter::, rustc_errors::ErrorGuaranteed>> 42: rustc_span::with_source_map::, rustc_interface::interface::create_compiler_and_run, rustc_driver::run_compiler::{closure#1}>::{closure#1}> 43: rustc_interface::interface::create_compiler_and_run::, rustc_driver::run_compiler::{closure#1}> 44: >::set::, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: internal compiler error: unexpected panic ```

compiler-errors commented 2 years ago

hi @lz1998, can you see if this still reproduces on an up-to-date nightly?

lz1998 commented 2 years ago

hi @lz1998, can you see if this still reproduces on an up-to-date nightly?

No, the latest nightly version works well.

compiler-errors commented 2 years ago

If the latest nightly version works, then this was fixed. I will close the issue, thanks for the report :smile: