]> git.lizzy.rs Git - rust.git/commitdiff
Add some basic docs to `sym` and `kw` modules
authorPhilipp Hansch <dev@phansch.net>
Sun, 12 Apr 2020 07:45:08 +0000 (09:45 +0200)
committerPhilipp Hansch <dev@phansch.net>
Sun, 12 Apr 2020 09:24:58 +0000 (11:24 +0200)
I was looking into improving some Clippy documentation but was missing a
place that explains the `kw` and `sym` modules from rustc.

src/librustc_span/symbol.rs

index 6845cb3b9a35258477360e67c5c64b84134856f7..4c963ac84dc85c1f3b93f1013bb1ebcbd467efdb 100644 (file)
@@ -1153,12 +1153,20 @@ pub fn get(&self, symbol: Symbol) -> &str {
 }
 
 // This module has a very short name because it's used a lot.
+/// This module contains all the defined keyword `Symbol`s.
+///
+/// Given that `kw` is imported, use them like `kw::keyword_name`.
+/// For example `kw::Loop` or `kw::Break`.
 pub mod kw {
     use super::Symbol;
     keywords!();
 }
 
 // This module has a very short name because it's used a lot.
+/// This module contains all the defined non-keyword `Symbol`s.
+///
+/// Given that `sym` is imported, use them like `sym::symbol_name`.
+/// For example `sym::rustfmt` or `sym::u8`.
 #[allow(rustc::default_hash_types)]
 pub mod sym {
     use super::Symbol;