Skip to content

String formatting crashing compiler #57681

Closed
@fsamuel

Description

@fsamuel
   fn write_indented(&self, f: &mut fmt::Formatter, indent: usize) -> fmt::Result {
        write!(
            f,
            "{:indent$}{}[{}]: {}",
            indent = indent
            self.name,
            self.job_id,
            self.url,
        )?;

        for child in &self.child_components {
            child.write_indented(f, indent + 2)?;
        }

        Ok(())
    }

This block of code crashes the compiler.

FAILED: rust_crates/cs obj/garnet/bin/cs/bin_build_info.json
/usr/bin/env ../../build/rust/build_rustc_target.py --crate-root /usr/local/google/Projects/fuchsia/garnet/bin/cs/src/main.rs --cargo-toml-dir /usr/local/google/Projects/fuchsia/out/x64/gen/garnet/bin/cs/bin --n
thread 'rustc' panicked at 'called Result::unwrap() on an Err value: Diagnostic { level: Fatal, message: [("expected =, found .", NoStyle)], code: None, span: MultiSpan { primary_spans: [Span { lo: Byte5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:70
             at src/libstd/sys_common/backtrace.rs:58
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   6: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:385
   7: rust_begin_unwind
             at src/libstd/panicking.rs:312
   8: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   9: core::result::unwrap_failed
  10: syntax_ext::format::parse_args
  11: <F as syntax::ext::base::TTMacroExpander>::expand
  12: syntax::ext::expand::MacroExpander::expand_invoc
  13: syntax::ext::expand::MacroExpander::expand_fragment
  14: syntax::ext::expand::MacroExpander::expand_crate
  15: rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}}
  16: rustc_driver::driver::phase_2_configure_and_expand_inner
  17: rustc_driver::driver::compile_input
  18: <scoped_tls::ScopedKey<T>>::set
  19: rustc_driver::run_compiler
  20: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
end of query stack

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.33.0-nightly (7ad470c0a 2019-01-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=0 -C debuginfo=2 -C link-arg=--pack-dyn-relocs=relr -C link-arg=--sysroot=/usr/local/google/Projects/fuchsia/out/x64/sdk/exported/zircon_sysroot/arch/x64/sysroot -C link-arg=-n

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions