Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
This commit is contained in:
commit
a41a6925ba
140 changed files with 354 additions and 415 deletions
|
@ -292,7 +292,7 @@ impl<'a> CrateLoader<'a> {
|
|||
// `source` stores paths which are normalized which may be different
|
||||
// from the strings on the command line.
|
||||
let source = self.cstore.get_crate_data(cnum).cdata.source();
|
||||
if let Some(entry) = self.sess.opts.externs.get(&name.as_str()) {
|
||||
if let Some(entry) = self.sess.opts.externs.get(name.as_str()) {
|
||||
// Only use `--extern crate_name=path` here, not `--extern crate_name`.
|
||||
if let Some(mut files) = entry.files() {
|
||||
if files.any(|l| {
|
||||
|
@ -381,7 +381,7 @@ impl<'a> CrateLoader<'a> {
|
|||
let host_hash = host_lib.as_ref().map(|lib| lib.metadata.get_root().hash());
|
||||
|
||||
let private_dep =
|
||||
self.sess.opts.externs.get(&name.as_str()).map_or(false, |e| e.is_private_dep);
|
||||
self.sess.opts.externs.get(name.as_str()).map_or(false, |e| e.is_private_dep);
|
||||
|
||||
// Claim this crate number and cache it
|
||||
let cnum = self.cstore.alloc_new_crate_num();
|
||||
|
@ -997,7 +997,7 @@ impl<'a> CrateLoader<'a> {
|
|||
);
|
||||
let name = match orig_name {
|
||||
Some(orig_name) => {
|
||||
validate_crate_name(self.sess, &orig_name.as_str(), Some(item.span));
|
||||
validate_crate_name(self.sess, orig_name.as_str(), Some(item.span));
|
||||
orig_name
|
||||
}
|
||||
None => item.ident.name,
|
||||
|
|
|
@ -315,7 +315,7 @@ impl<'a> CrateLocator<'a> {
|
|||
exact_paths: if hash.is_none() {
|
||||
sess.opts
|
||||
.externs
|
||||
.get(&crate_name.as_str())
|
||||
.get(crate_name.as_str())
|
||||
.into_iter()
|
||||
.filter_map(|entry| entry.files())
|
||||
.flatten()
|
||||
|
@ -976,7 +976,8 @@ impl CrateError {
|
|||
let candidates = libraries
|
||||
.iter()
|
||||
.map(|lib| {
|
||||
let crate_name = &lib.metadata.get_root().name().as_str();
|
||||
let crate_name = lib.metadata.get_root().name();
|
||||
let crate_name = crate_name.as_str();
|
||||
let mut paths = lib.source.paths();
|
||||
|
||||
// This `unwrap()` should be okay because there has to be at least one
|
||||
|
@ -1174,7 +1175,7 @@ impl CrateError {
|
|||
} else if crate_name
|
||||
== Symbol::intern(&sess.opts.debugging_opts.profiler_runtime)
|
||||
{
|
||||
err.note(&"the compiler may have been built without the profiler runtime");
|
||||
err.note("the compiler may have been built without the profiler runtime");
|
||||
} else if crate_name.as_str().starts_with("rustc_") {
|
||||
err.help(
|
||||
"maybe you need to install the missing components with: \
|
||||
|
|
|
@ -67,7 +67,7 @@ impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
|||
Some(name) => name,
|
||||
None => continue, // skip like historical compilers
|
||||
};
|
||||
lib.kind = match &*kind.as_str() {
|
||||
lib.kind = match kind.as_str() {
|
||||
"static" => NativeLibKind::Static { bundle: None, whole_archive: None },
|
||||
"static-nobundle" => {
|
||||
sess.struct_span_warn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue