diff options
| author | klensy <klensy@users.noreply.github.com> | 2022-04-05 15:52:53 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2022-04-08 11:45:57 +0300 |
| commit | d0cc98689e3db7841c54c0ad1104dea87f811ff5 (patch) | |
| tree | 9b577f2fe457711704db64063c5fd64d43b61850 /compiler/rustc_builtin_macros/src | |
| parent | f262ca12aac76152c4b46cefcf8300f0249a5eb2 (diff) | |
| download | rust-d0cc98689e3db7841c54c0ad1104dea87f811ff5.tar.gz rust-d0cc98689e3db7841c54c0ad1104dea87f811ff5.zip | |
check_doc_keyword: don't alloc string for emptiness check
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/compile_error.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/env.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/source_util.rs | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_builtin_macros/src/compile_error.rs b/compiler/rustc_builtin_macros/src/compile_error.rs index 990b8829569..72397aa2500 100644 --- a/compiler/rustc_builtin_macros/src/compile_error.rs +++ b/compiler/rustc_builtin_macros/src/compile_error.rs @@ -13,7 +13,7 @@ pub fn expand_compile_error<'cx>( return DummyResult::any(sp); }; - cx.span_err(sp, &var); + cx.span_err(sp, var.as_str()); DummyResult::any(sp) } diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs index 66ee93ce3c9..b8828fa671a 100644 --- a/compiler/rustc_builtin_macros/src/env.rs +++ b/compiler/rustc_builtin_macros/src/env.rs @@ -21,8 +21,8 @@ pub fn expand_option_env<'cx>( }; let sp = cx.with_def_site_ctxt(sp); - let value = env::var(&var.as_str()).ok().as_deref().map(Symbol::intern); - cx.sess.parse_sess.env_depinfo.borrow_mut().insert((Symbol::intern(&var), value)); + let value = env::var(var.as_str()).ok().as_deref().map(Symbol::intern); + cx.sess.parse_sess.env_depinfo.borrow_mut().insert((var, value)); let e = match value { None => { let lt = cx.lifetime(sp, Ident::new(kw::StaticLifetime, sp)); diff --git a/compiler/rustc_builtin_macros/src/source_util.rs b/compiler/rustc_builtin_macros/src/source_util.rs index be628c9202c..41871f303b0 100644 --- a/compiler/rustc_builtin_macros/src/source_util.rs +++ b/compiler/rustc_builtin_macros/src/source_util.rs @@ -104,7 +104,7 @@ pub fn expand_include<'cx>( return DummyResult::any(sp); }; // The file will be added to the code map by the parser - let file = match resolve_path(cx, file, sp) { + let file = match resolve_path(cx, file.as_str(), sp) { Ok(f) => f, Err(mut err) => { err.emit(); @@ -173,7 +173,7 @@ pub fn expand_include_str( let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_str!") else { return DummyResult::any(sp); }; - let file = match resolve_path(cx, file, sp) { + let file = match resolve_path(cx, file.as_str(), sp) { Ok(f) => f, Err(mut err) => { err.emit(); @@ -207,7 +207,7 @@ pub fn expand_include_bytes( let Some(file) = get_single_str_from_tts(cx, sp, tts, "include_bytes!") else { return DummyResult::any(sp); }; - let file = match resolve_path(cx, file, sp) { + let file = match resolve_path(cx, file.as_str(), sp) { Ok(f) => f, Err(mut err) => { err.emit(); |
