File tree 3 files changed +21
-4
lines changed
compiler/rustc_metadata/src
tests/run-make/issue-83045
3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -148,11 +148,15 @@ impl CStore {
148
148
assert_eq ! ( self . metas. len( ) , self . stable_crate_ids. len( ) ) ;
149
149
let num = CrateNum :: new ( self . stable_crate_ids . len ( ) ) ;
150
150
if let Some ( & existing) = self . stable_crate_ids . get ( & root. stable_crate_id ( ) ) {
151
- let crate_name0 = root. name ( ) ;
152
- if let Some ( crate_name1) = self . metas [ existing] . as_ref ( ) . map ( |data| data. name ( ) ) {
151
+ // Check for (potential) conflicts with the local crate
152
+ if existing == LOCAL_CRATE {
153
+ Err ( CrateError :: SymbolConflictsCurrent ( root. name ( ) ) )
154
+ } else if let Some ( crate_name1) = self . metas [ existing] . as_ref ( ) . map ( |data| data. name ( ) )
155
+ {
156
+ let crate_name0 = root. name ( ) ;
153
157
Err ( CrateError :: StableCrateIdCollision ( crate_name0, crate_name1) )
154
158
} else {
155
- Err ( CrateError :: SymbolConflictsCurrent ( crate_name0 ) )
159
+ Err ( CrateError :: NotFound ( root . name ( ) ) )
156
160
}
157
161
} else {
158
162
self . metas . push ( None ) ;
Original file line number Diff line number Diff line change @@ -961,6 +961,7 @@ pub(crate) enum CrateError {
961
961
DlSym ( String ) ,
962
962
LocatorCombined ( Box < CombinedLocatorError > ) ,
963
963
NonDylibPlugin ( Symbol ) ,
964
+ NotFound ( Symbol ) ,
964
965
}
965
966
966
967
enum MetadataError < ' a > {
@@ -1131,6 +1132,18 @@ impl CrateError {
1131
1132
CrateError :: NonDylibPlugin ( crate_name) => {
1132
1133
sess. emit_err ( errors:: NoDylibPlugin { span, crate_name } ) ;
1133
1134
}
1135
+ CrateError :: NotFound ( crate_name) => {
1136
+ sess. emit_err ( errors:: CannotFindCrate {
1137
+ span,
1138
+ crate_name,
1139
+ add_info : String :: new ( ) ,
1140
+ missing_core,
1141
+ current_crate : sess. opts . crate_name . clone ( ) . unwrap_or ( "<unknown>" . to_string ( ) ) ,
1142
+ is_nightly_build : sess. is_nightly_build ( ) ,
1143
+ profiler_runtime : Symbol :: intern ( & sess. opts . unstable_opts . profiler_runtime ) ,
1144
+ locator_triple : sess. opts . target_triple . clone ( ) ,
1145
+ } ) ;
1146
+ }
1134
1147
}
1135
1148
}
1136
1149
}
Original file line number Diff line number Diff line change 29
29
--crate-type=rlib \
30
30
--edition=2018 \
31
31
c.rs 2>&1 | tee $(TMPDIR ) /output.txt || exit 0
32
- $(CGREP ) E0519 < $(TMPDIR ) /output.txt
32
+ $(CGREP ) E0463 < $(TMPDIR ) /output.txt
33
33
$(CGREP ) -v " internal compiler error" < $(TMPDIR ) /output.txt
You can’t perform that action at this time.
0 commit comments