Commit 09bab38 1 parent bba4088 commit 09bab38 Copy full SHA for 09bab38
File tree 5 files changed +44
-3
lines changed
compiler/rustc_metadata/src
src/test/run-make-fulldeps/issue-83045
5 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -350,16 +350,13 @@ impl<'a> CrateLoader<'a> {
350
350
let Library { source, metadata } = lib;
351
351
let crate_root = metadata. get_root ( ) ;
352
352
let host_hash = host_lib. as_ref ( ) . map ( |lib| lib. metadata . get_root ( ) . hash ( ) ) ;
353
- self . verify_no_symbol_conflicts ( & crate_root) ?;
354
353
355
354
let private_dep =
356
355
self . sess . opts . externs . get ( & name. as_str ( ) ) . map_or ( false , |e| e. is_private_dep ) ;
357
356
358
357
// Claim this crate number and cache it
359
358
let cnum = self . cstore . alloc_new_crate_num ( ) ;
360
359
361
- self . verify_no_stable_crate_id_hash_conflicts ( & crate_root, cnum) ?;
362
-
363
360
info ! (
364
361
"register crate `{}` (cnum = {}. private_dep = {})" ,
365
362
crate_root. name( ) ,
@@ -394,6 +391,14 @@ impl<'a> CrateLoader<'a> {
394
391
None
395
392
} ;
396
393
394
+ // Perform some verification *after* resolve_crate_deps() above is
395
+ // known to have been successful. It seems that - in error cases - the
396
+ // cstore can be in a temporarily invalid state between cnum allocation
397
+ // and dependency resolution and the verification code would produce
398
+ // ICEs in that case (see #83045).
399
+ self . verify_no_symbol_conflicts ( & crate_root) ?;
400
+ self . verify_no_stable_crate_id_hash_conflicts ( & crate_root, cnum) ?;
401
+
397
402
let crate_metadata = CrateMetadata :: new (
398
403
self . sess ,
399
404
metadata,
Original file line number Diff line number Diff line change
1
+ include ../../run-make-fulldeps/tools.mk
2
+
3
+ # This test case creates a situation where the crate loader would run
4
+ # into an ICE when confronted with an invalid setup where it cannot
5
+ # find the dependency of a direct dependency.
6
+ #
7
+ # The test case makes sure that the compiler produces the expected
8
+ # error message but does not ICE immediately after.
9
+ #
10
+ # See https://github.com/rust-lang/rust/issues/83045
11
+
12
+ # This is a platform-independent issue, no need to waste time testing
13
+ # everywhere.
14
+ # only-x86_64
15
+ # only-linux
16
+
17
+ # NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib
18
+ # If we used RUSTC the additional '-L TMPDIR' option would allow rustc to
19
+ # actually find the crate.
20
+ #
21
+ # We check that we get the expected error message
22
+ # But that we do not get an ICE
23
+
24
+ all :
25
+ $(RUSTC ) --crate-name=a --crate-type=rlib a.rs --verbose
26
+ $(RUSTC ) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR ) /liba.rlib b.rs --verbose
27
+ $(BARE_RUSTC ) --out-dir $(TMPDIR ) \
28
+ --extern b=$(TMPDIR ) /libb.rlib \
29
+ --crate-type=rlib \
30
+ --edition=2018 \
31
+ c.rs 2>&1 | tee $(TMPDIR ) /output.txt || exit 0
32
+ $(CGREP ) E0463 < $(TMPDIR ) /output.txt
33
+ $(CGREP ) -v " internal compiler error" < $(TMPDIR ) /output.txt
Original file line number Diff line number Diff line change
1
+ // empty on purpose
Original file line number Diff line number Diff line change
1
+ extern crate a;
Original file line number Diff line number Diff line change
1
+ use b as _;
You can’t perform that action at this time.
0 commit comments