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

Debug assertion failure when error snippet has tab character #83638

Closed
osa1 opened this issue Mar 29, 2021 · 0 comments · Fixed by #83639
Closed

Debug assertion failure when error snippet has tab character #83638

osa1 opened this issue Mar 29, 2021 · 0 comments · Fixed by #83639
Assignees

Comments

@osa1
Copy link
Contributor

osa1 commented Mar 29, 2021

Generated by a simple fuzz tool I'm working on. Repro:

fn main() {
    """	"
}

(note that the second string has a tab)

Error:

thread 'rustc' panicked at 'assertion failed: self.text.iter().all(|r| !r.contains(&\'\\t\'))', compiler/rustc_errors/src/styled_buffer.rs:19:9
Backtrace:
stack backtrace:
   0: rust_begin_unwind
             at /home/omer/rust/rust/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /home/omer/rust/rust/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /home/omer/rust/rust/library/core/src/panicking.rs:50:5
   3: rustc_errors::styled_buffer::StyledBuffer::render
             at /home/omer/rust/rust/compiler/rustc_errors/src/styled_buffer.rs:19:9
   4: rustc_errors::emitter::EmitterWriter::emit_message_default
             at /home/omer/rust/rust/compiler/rustc_errors/src/emitter.rs:1537:30
   5: rustc_errors::emitter::EmitterWriter::emit_messages_default
             at /home/omer/rust/rust/compiler/rustc_errors/src/emitter.rs:1715:15
   6: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
             at /home/omer/rust/rust/compiler/rustc_errors/src/emitter.rs:496:9
   7: rustc_errors::HandlerInner::emit_diagnostic
             at /home/omer/rust/rust/compiler/rustc_errors/src/lib.rs:828:13
   8: rustc_errors::Handler::emit_diagnostic
             at /home/omer/rust/rust/compiler/rustc_errors/src/lib.rs:756:9
   9: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
             at /home/omer/rust/rust/compiler/rustc_errors/src/diagnostic_builder.rs:103:9
  10: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_full_stmt
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/stmt.rs:481:25
  11: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_block_tail
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/stmt.rs:415:30
  12: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_block_common
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/stmt.rs:397:13
  13: rustc_parse::parser::stmt::<impl rustc_parse::parser::Parser>::parse_inner_attrs_and_block
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/stmt.rs:378:9
  14: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn_body
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:1600:13
  15: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:1581:20
  16: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_kind
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:232:48
  17: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common_
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:145:20
  18: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:126:28
  19: rustc_parse::parser::attr_wrapper::<impl rustc_parse::parser::Parser>::collect_tokens_trailing_token
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/attr_wrapper.rs:69:23
  20: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:125:13
  21: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:91:9
  22: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:82:9
  23: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_mod
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:59:32
  24: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_crate_mod
             at /home/omer/rust/rust/compiler/rustc_parse/src/parser/item.rs:28:36
  25: rustc_parse::parse_crate_from_file
             at /home/omer/rust/rust/compiler/rustc_parse/src/lib.rs:58:5
  26: rustc_interface::passes::parse::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/passes.rs:58:30
  27: rustc_data_structures::profiling::VerboseTimingGuard::run
             at /home/omer/rust/rust/compiler/rustc_data_structures/src/profiling.rs:573:9
  28: rustc_session::utils::<impl rustc_session::session::Session>::time
             at /home/omer/rust/rust/compiler/rustc_session/src/utils.rs:10:9
  29: rustc_interface::passes::parse
             at /home/omer/rust/rust/compiler/rustc_interface/src/passes.rs:57:17
  30: rustc_interface::queries::Queries::parse::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/queries.rs:132:13
  31: rustc_interface::queries::Query<T>::compute
             at /home/omer/rust/rust/compiler/rustc_interface/src/queries.rs:40:28
  32: rustc_interface::queries::Queries::parse
             at /home/omer/rust/rust/compiler/rustc_interface/src/queries.rs:131:9
  33: rustc_driver::run_compiler::{{closure}}::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_driver/src/lib.rs:336:13
  34: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at /home/omer/rust/rust/compiler/rustc_interface/src/queries.rs:422:19
  35: rustc_driver::run_compiler::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_driver/src/lib.rs:334:22
  36: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/interface.rs:208:13
  37: rustc_span::with_source_map
             at /home/omer/rust/rust/compiler/rustc_span/src/lib.rs:788:5
  38: rustc_interface::interface::create_compiler_and_run
             at /home/omer/rust/rust/compiler/rustc_interface/src/interface.rs:202:5
  39: rustc_interface::interface::run_compiler::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/interface.rs:224:12
  40: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/util.rs:155:13
  41: scoped_tls::ScopedKey<T>::set
             at /home/omer/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
  42: rustc_span::with_session_globals
             at /home/omer/rust/rust/compiler/rustc_span/src/lib.rs:105:5
  43: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/util.rs:153:9
  44: rustc_interface::util::scoped_thread::{{closure}}
             at /home/omer/rust/rust/compiler/rustc_interface/src/util.rs:128:24
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@rustbot claim

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 30, 2021
Replace tabs in err messages before rendering

This is done in other call sites, but was missing in one place.

Fixes rust-lang#83638
@bors bors closed this as completed in 8d7432a Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant