From f8f776fee9ad540c117f71aed62c5648a4927bf1 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 25 Apr 2022 21:34:40 +0100 Subject: [PATCH] Update export_symbols --- rust-version | 2 +- src/bin/miri.rs | 13 +++++++++++-- src/shims/foreign_items.rs | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/rust-version b/rust-version index 7cc913cf867..685628ac99d 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -51ea9bb29b07d76c5a7167d054b54f4eb7f5b44e +18b53cefdf7456bf68937b08e377b7e622a115c2 diff --git a/src/bin/miri.rs b/src/bin/miri.rs index e4d0af43131..8a89d7f6410 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -22,7 +22,9 @@ use rustc_errors::emitter::{ColorConfig, HumanReadableErrorType}; use rustc_hir::{self as hir, def_id::LOCAL_CRATE, Node}; use rustc_interface::interface::Config; use rustc_middle::{ - middle::exported_symbols::{ExportedSymbol, SymbolExportLevel}, + middle::exported_symbols::{ + ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, + }, ty::{query::ExternProviders, TyCtxt}, }; use rustc_session::{config::ErrorOutputType, search_paths::PathKind, CtfeBacktrace}; @@ -130,7 +132,14 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls { && tcx.codegen_fn_attrs(local_def_id).contains_extern_indicator()) .then_some(( ExportedSymbol::NonGeneric(local_def_id.to_def_id()), - SymbolExportLevel::C, + // Some dummy `SymbolExportInfo` here. We only use + // `exported_symbols` in shims/foreign_items.rs and the export info + // is ignored. + SymbolExportInfo { + level: SymbolExportLevel::C, + kind: SymbolExportKind::Text, + used: false, + }, )) }), ) diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 7b457e9ed79..ef88c550ecb 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -157,9 +157,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx (linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1)) }), ) { - // We can ignore `_export_level` here: we are a Rust crate, and everything is exported + // We can ignore `_export_info` here: we are a Rust crate, and everything is exported // from a Rust crate. - for &(symbol, _export_level) in tcx.exported_symbols(cnum) { + for &(symbol, _export_info) in tcx.exported_symbols(cnum) { if let ExportedSymbol::NonGeneric(def_id) = symbol { let attrs = tcx.codegen_fn_attrs(def_id); let symbol_name = if let Some(export_name) = attrs.export_name {