Skip to content

Commit 59a946e

Browse files
committed
Fix review comments
1 parent f57ed9f commit 59a946e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/shims/foreign_items.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
139139
Entry::Occupied(e) => e.into_mut(),
140140
Entry::Vacant(e) => {
141141
// Find it if it was not cached.
142+
// The is true in case of a weak definition.
142143
let mut instance_and_crate: Option<(ty::Instance<'_>, CrateNum, bool)> = None;
143144
helpers::iter_exported_symbols(tcx, |cnum, def_id| {
144145
let attrs = tcx.codegen_fn_attrs(def_id);
@@ -161,6 +162,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
161162
if let Some((original_instance, original_cnum, original_is_weak)) =
162163
instance_and_crate
163164
{
165+
// There is more than one definition with this name. What we do now
166+
// depends on whether one or both definitions are weak.
164167
match (is_weak, original_is_weak) {
165168
(false, true) => {
166169
// Original definition is a weak definition. Override it.
@@ -174,7 +177,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
174177
(true, true) | (false, false) => {
175178
// Either both definitions are non-weak or both are weak. In
176179
// either case return an error. For weak definitions we error
177-
// because it is undefined which definition would have been
180+
// because it is unspecified which definition would have been
178181
// picked by the linker.
179182

180183
// Make sure we are consistent wrt what is 'first' and 'second'.

0 commit comments

Comments
 (0)