aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/name.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/name.rs')
-rw-r--r--crates/ra_hir_expand/src/name.rs116
1 files changed, 59 insertions, 57 deletions
diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs
index c5a191160..4f2f702c0 100644
--- a/crates/ra_hir_expand/src/name.rs
+++ b/crates/ra_hir_expand/src/name.rs
@@ -38,8 +38,8 @@ impl Name {
38 } 38 }
39 39
40 /// Shortcut to create inline plain text name 40 /// Shortcut to create inline plain text name
41 const fn new_inline_ascii(len: usize, text: &[u8]) -> Name { 41 const fn new_inline_ascii(text: &[u8]) -> Name {
42 Name::new_text(SmolStr::new_inline_from_ascii(len, text)) 42 Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text))
43 } 43 }
44 44
45 /// Resolve a name from the text of token. 45 /// Resolve a name from the text of token.
@@ -105,68 +105,70 @@ impl AsName for ra_db::Dependency {
105} 105}
106 106
107// Primitives 107// Primitives
108pub const ISIZE: Name = Name::new_inline_ascii(5, b"isize"); 108pub const ISIZE: Name = Name::new_inline_ascii(b"isize");
109pub const I8: Name = Name::new_inline_ascii(2, b"i8"); 109pub const I8: Name = Name::new_inline_ascii(b"i8");
110pub const I16: Name = Name::new_inline_ascii(3, b"i16"); 110pub const I16: Name = Name::new_inline_ascii(b"i16");
111pub const I32: Name = Name::new_inline_ascii(3, b"i32"); 111pub const I32: Name = Name::new_inline_ascii(b"i32");
112pub const I64: Name = Name::new_inline_ascii(3, b"i64"); 112pub const I64: Name = Name::new_inline_ascii(b"i64");
113pub const I128: Name = Name::new_inline_ascii(4, b"i128"); 113pub const I128: Name = Name::new_inline_ascii(b"i128");
114pub const USIZE: Name = Name::new_inline_ascii(5, b"usize"); 114pub const USIZE: Name = Name::new_inline_ascii(b"usize");
115pub const U8: Name = Name::new_inline_ascii(2, b"u8"); 115pub const U8: Name = Name::new_inline_ascii(b"u8");
116pub const U16: Name = Name::new_inline_ascii(3, b"u16"); 116pub const U16: Name = Name::new_inline_ascii(b"u16");
117pub const U32: Name = Name::new_inline_ascii(3, b"u32"); 117pub const U32: Name = Name::new_inline_ascii(b"u32");
118pub const U64: Name = Name::new_inline_ascii(3, b"u64"); 118pub const U64: Name = Name::new_inline_ascii(b"u64");
119pub const U128: Name = Name::new_inline_ascii(4, b"u128"); 119pub const U128: Name = Name::new_inline_ascii(b"u128");
120pub const F32: Name = Name::new_inline_ascii(3, b"f32"); 120pub const F32: Name = Name::new_inline_ascii(b"f32");
121pub const F64: Name = Name::new_inline_ascii(3, b"f64"); 121pub const F64: Name = Name::new_inline_ascii(b"f64");
122pub const BOOL: Name = Name::new_inline_ascii(4, b"bool"); 122pub const BOOL: Name = Name::new_inline_ascii(b"bool");
123pub const CHAR: Name = Name::new_inline_ascii(4, b"char"); 123pub const CHAR: Name = Name::new_inline_ascii(b"char");
124pub const STR: Name = Name::new_inline_ascii(3, b"str"); 124pub const STR: Name = Name::new_inline_ascii(b"str");
125 125
126// Special names 126// Special names
127pub const SELF_PARAM: Name = Name::new_inline_ascii(4, b"self"); 127pub const SELF_PARAM: Name = Name::new_inline_ascii(b"self");
128pub const SELF_TYPE: Name = Name::new_inline_ascii(4, b"Self"); 128pub const SELF_TYPE: Name = Name::new_inline_ascii(b"Self");
129pub const MACRO_RULES: Name = Name::new_inline_ascii(11, b"macro_rules"); 129pub const MACRO_RULES: Name = Name::new_inline_ascii(b"macro_rules");
130 130
131// Components of known path (value or mod name) 131// Components of known path (value or mod name)
132pub const STD: Name = Name::new_inline_ascii(3, b"std"); 132pub const STD: Name = Name::new_inline_ascii(b"std");
133pub const ITER: Name = Name::new_inline_ascii(4, b"iter"); 133pub const ITER: Name = Name::new_inline_ascii(b"iter");
134pub const OPS: Name = Name::new_inline_ascii(3, b"ops"); 134pub const OPS: Name = Name::new_inline_ascii(b"ops");
135pub const FUTURE: Name = Name::new_inline_ascii(6, b"future"); 135pub const FUTURE: Name = Name::new_inline_ascii(b"future");
136pub const RESULT: Name = Name::new_inline_ascii(6, b"result"); 136pub const RESULT: Name = Name::new_inline_ascii(b"result");
137pub const BOXED: Name = Name::new_inline_ascii(5, b"boxed"); 137pub const BOXED: Name = Name::new_inline_ascii(b"boxed");
138 138
139// Components of known path (type name) 139// Components of known path (type name)
140pub const INTO_ITERATOR_TYPE: Name = Name::new_inline_ascii(12, b"IntoIterator"); 140pub const INTO_ITERATOR_TYPE: Name = Name::new_inline_ascii(b"IntoIterator");
141pub const ITEM_TYPE: Name = Name::new_inline_ascii(4, b"Item"); 141pub const ITEM_TYPE: Name = Name::new_inline_ascii(b"Item");
142pub const TRY_TYPE: Name = Name::new_inline_ascii(3, b"Try"); 142pub const TRY_TYPE: Name = Name::new_inline_ascii(b"Try");
143pub const OK_TYPE: Name = Name::new_inline_ascii(2, b"Ok"); 143pub const OK_TYPE: Name = Name::new_inline_ascii(b"Ok");
144pub const FUTURE_TYPE: Name = Name::new_inline_ascii(6, b"Future"); 144pub const FUTURE_TYPE: Name = Name::new_inline_ascii(b"Future");
145pub const RESULT_TYPE: Name = Name::new_inline_ascii(6, b"Result"); 145pub const RESULT_TYPE: Name = Name::new_inline_ascii(b"Result");
146pub const OUTPUT_TYPE: Name = Name::new_inline_ascii(6, b"Output"); 146pub const OUTPUT_TYPE: Name = Name::new_inline_ascii(b"Output");
147pub const TARGET_TYPE: Name = Name::new_inline_ascii(6, b"Target"); 147pub const TARGET_TYPE: Name = Name::new_inline_ascii(b"Target");
148pub const BOX_TYPE: Name = Name::new_inline_ascii(3, b"Box"); 148pub const BOX_TYPE: Name = Name::new_inline_ascii(b"Box");
149pub const RANGE_FROM_TYPE: Name = Name::new_inline_ascii(9, b"RangeFrom"); 149pub const RANGE_FROM_TYPE: Name = Name::new_inline_ascii(b"RangeFrom");
150pub const RANGE_FULL_TYPE: Name = Name::new_inline_ascii(9, b"RangeFull"); 150pub const RANGE_FULL_TYPE: Name = Name::new_inline_ascii(b"RangeFull");
151pub const RANGE_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(14, b"RangeInclusive"); 151pub const RANGE_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(b"RangeInclusive");
152pub const RANGE_TO_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(16, b"RangeToInclusive"); 152pub const RANGE_TO_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(b"RangeToInclusive");
153pub const RANGE_TO_TYPE: Name = Name::new_inline_ascii(7, b"RangeTo"); 153pub const RANGE_TO_TYPE: Name = Name::new_inline_ascii(b"RangeTo");
154pub const RANGE_TYPE: Name = Name::new_inline_ascii(5, b"Range"); 154pub const RANGE_TYPE: Name = Name::new_inline_ascii(b"Range");
155 155
156// Builtin Macros 156// Builtin Macros
157pub const FILE_MACRO: Name = Name::new_inline_ascii(4, b"file"); 157pub const FILE_MACRO: Name = Name::new_inline_ascii(b"file");
158pub const COLUMN_MACRO: Name = Name::new_inline_ascii(6, b"column"); 158pub const COLUMN_MACRO: Name = Name::new_inline_ascii(b"column");
159pub const COMPILE_ERROR_MACRO: Name = Name::new_inline_ascii(13, b"compile_error"); 159pub const COMPILE_ERROR_MACRO: Name = Name::new_inline_ascii(b"compile_error");
160pub const LINE_MACRO: Name = Name::new_inline_ascii(4, b"line"); 160pub const LINE_MACRO: Name = Name::new_inline_ascii(b"line");
161pub const STRINGIFY_MACRO: Name = Name::new_inline_ascii(9, b"stringify"); 161pub const STRINGIFY_MACRO: Name = Name::new_inline_ascii(b"stringify");
162pub const FORMAT_ARGS_MACRO: Name = Name::new_inline_ascii(b"format_args");
163pub const FORMAT_ARGS_NL_MACRO: Name = Name::new_inline_ascii(b"format_args_nl");
162 164
163// Builtin derives 165// Builtin derives
164pub const COPY_TRAIT: Name = Name::new_inline_ascii(4, b"Copy"); 166pub const COPY_TRAIT: Name = Name::new_inline_ascii(b"Copy");
165pub const CLONE_TRAIT: Name = Name::new_inline_ascii(5, b"Clone"); 167pub const CLONE_TRAIT: Name = Name::new_inline_ascii(b"Clone");
166pub const DEFAULT_TRAIT: Name = Name::new_inline_ascii(7, b"Default"); 168pub const DEFAULT_TRAIT: Name = Name::new_inline_ascii(b"Default");
167pub const DEBUG_TRAIT: Name = Name::new_inline_ascii(5, b"Debug"); 169pub const DEBUG_TRAIT: Name = Name::new_inline_ascii(b"Debug");
168pub const HASH_TRAIT: Name = Name::new_inline_ascii(4, b"Hash"); 170pub const HASH_TRAIT: Name = Name::new_inline_ascii(b"Hash");
169pub const ORD_TRAIT: Name = Name::new_inline_ascii(3, b"Ord"); 171pub const ORD_TRAIT: Name = Name::new_inline_ascii(b"Ord");
170pub const PARTIAL_ORD_TRAIT: Name = Name::new_inline_ascii(10, b"PartialOrd"); 172pub const PARTIAL_ORD_TRAIT: Name = Name::new_inline_ascii(b"PartialOrd");
171pub const EQ_TRAIT: Name = Name::new_inline_ascii(2, b"Eq"); 173pub const EQ_TRAIT: Name = Name::new_inline_ascii(b"Eq");
172pub const PARTIAL_EQ_TRAIT: Name = Name::new_inline_ascii(9, b"PartialEq"); 174pub const PARTIAL_EQ_TRAIT: Name = Name::new_inline_ascii(b"PartialEq");