You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
578 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## Raw identifiers
Rust因为版本更迭原因可能会新增一些`关键字`,这些新增关键字可能会导致旧的函数名调用不再通过编译例如在Rust Edition 2015中引入了新的关键字`try`.
运行以下代码:
```rust
extern crate foo;
fn main() {
foo::try();
}
```
将获得下面的错误
```rust
error: expected identifier, found keyword `try`
--> src/main.rs:4:4
|
4 | foo::try();
| ^^^ expected identifier, found keyword
```
可以用Raw identifier来解决:
```rust
extern crate foo;
fn main() {
foo::r#try();
}
```