blob: eaea218e128886373d6c4ebc82fe5e377a831ce8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// run-rustfix
#![deny(clippy::internal)]
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
#![feature(rustc_private)]
extern crate rustc_span;
use rustc_span::symbol::Symbol;
macro_rules! sym {
($tt:tt) => {
rustc_span::symbol::Symbol::intern(stringify!($tt))
};
}
fn main() {
// Direct use of Symbol::intern
let _ = rustc_span::sym::f32;
// Using a sym macro
let _ = rustc_span::sym::f32;
// Correct suggestion when symbol isn't stringified constant name
let _ = rustc_span::sym::proc_dash_macro;
// interning a keyword
let _ = rustc_span::symbol::kw::SelfLower;
// Interning a symbol that is not defined
let _ = Symbol::intern("xyz123");
let _ = sym!(xyz123);
// Using a different `intern` function
let _ = intern("f32");
}
fn intern(_: &str) {}
|