Closed
Description
When I used the character …
in comment, combined with some (invalid) code preceding it, the compiler panicked.
I tried this code:
struct X {}
fn f() {
vec![X]; //…
}
I expected to see this happen: rustc compiles this code.
Instead, this happened: rustc panicked with the following output
thread 'rustc' panicked at 'byte index 38 is not a char boundary; it is inside '…' (bytes 36..39) of `struct X {}
fn f() {
vec![X]; //…
}
`', src/libcore/str/mod.rs:2027: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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.35.0 (3c235d560 2019-05-20) running on x86_64-apple-darwin
Meta
rustc --version --verbose
:
rustc 1.35.0 (3c235d560 2019-05-20)
binary: rustc
commit-hash: 3c235d5600393dfe6c36eeed34042efad8d4f26e
commit-date: 2019-05-20
host: x86_64-apple-darwin
release: 1.35.0
LLVM version: 8.0
Backtrace:
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::continue_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::str::slice_error_fail
10: core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}
11: syntax::source_map::SourceMap::span_to_snippet
12: rustc_resolve::error_reporting::<impl rustc_resolve::Resolver>::smart_resolve_report_errors
13: rustc_resolve::Resolver::smart_resolve_path_fragment::{{closure}}
14: rustc_resolve::Resolver::smart_resolve_path_fragment
15: rustc_resolve::Resolver::smart_resolve_path
16: rustc_resolve::Resolver::resolve_expr
17: syntax::visit::walk_expr
18: rustc_resolve::Resolver::resolve_expr
19: rustc_resolve::Resolver::resolve_expr
20: rustc_resolve::Resolver::resolve_expr
21: <rustc_resolve::Resolver as syntax::visit::Visitor>::visit_block
22: <rustc_resolve::Resolver as syntax::visit::Visitor>::visit_fn
23: syntax::visit::walk_item
24: rustc_resolve::Resolver::resolve_item
25: rustc_resolve::Resolver::resolve_crate
26: rustc::util::common::time
27: rustc_interface::passes::configure_and_expand_inner
28: rustc_interface::passes::configure_and_expand::{{closure}}
29: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
30: rustc_interface::passes::configure_and_expand
31: rustc_interface::queries::Query<T>::compute
32: rustc_interface::queries::Query<T>::compute
33: rustc_interface::queries::Query<T>::compute
34: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::prepare_outputs
35: rustc_interface::interface::run_compiler_in_existing_thread_pool
36: std::thread::local::LocalKey<T>::with
37: scoped_tls::ScopedKey<T>::set
38: syntax::with_globals
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Name/path resolution done by `rustc_resolve` specificallyArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.