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
fn postfix_from_infix(infix: Vec) -> Vec {
let postfix = Vec::::new();
for token in infix {
match token {
Toekn::LeftParen(_) => break,
_ => {}
}
}
postfix
}
C:\UserData\Tech\Rust\expr\src>cargo run -- "527 + 35*2"
Compiling expr v0.1.0 (file:///C:/UserData/Tech/Rust/expr)
main.rs:20:10: 20:26 error: failed to resolve. Use of undeclared type or module
`Toekn` [E0433]
main.rs:20 Toekn::LeftParen(_) => break,
^~~~~~~~~~~~~~~~
main.rs:20:10: 20:26 help: run `rustc --explain E0433` to see a detailed explana
tion
main.rs:20:10: 20:29 error: internal compiler error: ../src/librustc\middle\mem_
categorization.rs:1262: enum pattern didn't resolve to enum or struct None
main.rs:20 Toekn::LeftParen(_) => break,
^~~~~~~~~~~~~~~~~~~
**note: the compiler unexpectedly panicked. this is a bug.**
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/m
aster/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax\errors/mod.rs:545
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `expr`.
To learn more, run the command again with --verbose.
###################
I misspelt the enum Token as Toekn. The compiler panics.
C:\UserData\Tech\Rust\expr\src>rustc --version
rustc 1.10.0 (cfcb716cf 2016-07-03)
The text was updated successfully, but these errors were encountered:
enum Token {
Num(i32),
AddSub(char),
MulDiv(char),
LeftParen(char),
RightParen(char)
}
fn main() {
println!("Hello World\n");
}
[allow(dead_code)]
fn postfix_from_infix(infix: Vec) -> Vec {
let postfix = Vec::::new();
for token in infix {
match token {
Toekn::LeftParen(_) => break,
_ => {}
}
}
postfix
}
The text was updated successfully, but these errors were encountered: