2020-12-20 10:19:49 -06:00
|
|
|
// run-rustfix
|
|
|
|
#![deny(clippy::internal)]
|
2022-05-05 09:12:52 -05:00
|
|
|
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
|
2020-12-20 10:19:49 -06:00
|
|
|
#![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
|
2021-01-15 03:56:44 -06:00
|
|
|
let _ = rustc_span::sym::f32;
|
2020-12-20 10:19:49 -06:00
|
|
|
|
|
|
|
// Using a sym macro
|
2021-01-15 03:56:44 -06:00
|
|
|
let _ = rustc_span::sym::f32;
|
2020-12-20 10:19:49 -06:00
|
|
|
|
|
|
|
// Correct suggestion when symbol isn't stringified constant name
|
2021-01-15 03:56:44 -06:00
|
|
|
let _ = rustc_span::sym::proc_dash_macro;
|
|
|
|
|
|
|
|
// interning a keyword
|
|
|
|
let _ = rustc_span::symbol::kw::SelfLower;
|
2020-12-20 10:19:49 -06:00
|
|
|
|
|
|
|
// 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) {}
|