You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler panics when the following standalone code is built:
use std::str;fnmain(){const filename:&'static str = "myfile";format!("File {} not found.",&*filename);}
Here's the output of cargo build:
Compiling test v0.0.1 (file:///usr/home/randy/code/test)
src/main.rs:4:5: 4:45 warning: constant `filename` should have an upper case name such as `FILENAME`, #[warn(non_upper_case_globals)] on by default
src/main.rs:4 const filename: &'static str = "myfile";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@const3845 = internal unnamed_addr constant %str_slice { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str3844, i32 0, i32 0), i64 6 }, align 8
{ i8*, i64 } undef
error: internal compiler error: src/librustc_trans/consts.rs:443: const expr(38: &*filename) of type &'static str has size 8 instead of 16
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', src/libsyntax/errors/mod.rs:575
Both the lowercase constant and the curly braces in the string are necessary to reproduce the panic.
The compiler panics when the following standalone code is built:
Here's the output of
cargo build
:Both the lowercase constant and the curly braces in the string are necessary to reproduce the panic.
Rust version:
The text was updated successfully, but these errors were encountered: