You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#156370 - qaijuang:eii-dylib-default-override, r=bjorn3
Reject linked dylib EII default overrides
This PR rejects explicit EII implementations that would override a default implementation already selected through a linked dylib.
The check is intentionally split:
- rustc_passes keeps the early, format-independent checks for missing impls and duplicate explicit impls.
- rustc_codegen_ssa checks the default-vs-explicit conflict during linking, using the dependency formats selected for the final artifact.
Fixesrust-lang#156320.
#[diag("multiple implementations of `#[{$name}]`")]
175
+
pubstructDuplicateEiiImpls{
176
+
pubname:Symbol,
177
+
178
+
#[primary_span]
179
+
#[label("first implemented here in crate `{$first_crate}`")]
180
+
pubfirst_span:Span,
181
+
pubfirst_crate:Symbol,
182
+
183
+
#[label("also implemented here in crate `{$second_crate}`")]
184
+
pubsecond_span:Span,
185
+
pubsecond_crate:Symbol,
186
+
187
+
#[note("in addition to these two, { $num_additional_crates ->
188
+
[one] another implementation was found in crate {$additional_crate_names}
189
+
*[other] more implementations were also found in the following crates: {$additional_crate_names}
190
+
}")]
191
+
pubadditional_crates:Option<()>,
192
+
193
+
pubnum_additional_crates:usize,
194
+
pubadditional_crate_names:String,
195
+
196
+
#[help(
197
+
"an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
#[diag("multiple implementations of `#[{$name}]`")]
1109
-
pub(crate)structDuplicateEiiImpls{
1110
-
pubname:Symbol,
1111
-
1112
-
#[primary_span]
1113
-
#[label("first implemented here in crate `{$first_crate}`")]
1114
-
pubfirst_span:Span,
1115
-
pubfirst_crate:Symbol,
1116
-
1117
-
#[label("also implemented here in crate `{$second_crate}`")]
1118
-
pubsecond_span:Span,
1119
-
pubsecond_crate:Symbol,
1120
-
1121
-
#[note("in addition to these two, { $num_additional_crates ->
1122
-
[one] another implementation was found in crate {$additional_crate_names}
1123
-
*[other] more implementations were also found in the following crates: {$additional_crate_names}
1124
-
}")]
1125
-
pubadditional_crates:Option<()>,
1126
-
1127
-
pubnum_additional_crates:usize,
1128
-
pubadditional_crate_names:String,
1129
-
1130
-
#[help(
1131
-
"an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
1132
-
)]
1133
-
pubhelp:(),
1134
-
}
1135
-
1136
1107
#[derive(Diagnostic)]
1137
1108
#[diag("function doesn't have a default implementation")]
0 commit comments