Skip to content

Commit d8c63ee

Browse files
committed
Sync from rust 365c0e1d7a614ca94cb48431dcd2bc6d3b645db1
2 parents b2a1b93 + ce02adc commit d8c63ee

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
620620
let lval = codegen_place(fx, to_place_and_rval.0);
621621
let dest_layout = lval.layout();
622622
match to_place_and_rval.1 {
623-
Rvalue::Use(ref operand) => {
623+
Rvalue::Use(ref operand, _) => {
624624
let val = codegen_operand(fx, operand);
625625
lval.write_cvalue(fx, val);
626626
}
@@ -909,7 +909,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
909909
| StatementKind::ConstEvalCounter
910910
| StatementKind::Nop
911911
| StatementKind::FakeRead(..)
912-
| StatementKind::Retag { .. }
913912
| StatementKind::PlaceMention(..)
914913
| StatementKind::BackwardIncompatibleDropHint { .. }
915914
| StatementKind::AscribeUserType(..) => {}

src/constant.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
592592
};
593593
computed_scalar_int = Some(scalar_int);
594594
}
595-
Rvalue::Use(operand) => {
595+
Rvalue::Use(operand, _) => {
596596
computed_scalar_int = mir_operand_get_const_val(fx, operand)
597597
}
598598
_ => return None,
@@ -613,7 +613,6 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
613613
| StatementKind::SetDiscriminant { .. }
614614
| StatementKind::StorageLive(_)
615615
| StatementKind::StorageDead(_)
616-
| StatementKind::Retag(_, _)
617616
| StatementKind::AscribeUserType(_, _)
618617
| StatementKind::PlaceMention(..)
619618
| StatementKind::Coverage(_)

src/debuginfo/line_info.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ fn osstr_as_utf8_bytes(path: &OsStr) -> &[u8] {
4747

4848
fn make_file_info(source_file: &SourceFile, embed_source: bool) -> Option<FileInfo> {
4949
let has_md5 = source_file.src_hash.kind == SourceFileHashAlgorithm::Md5;
50-
let has_source = embed_source && source_file.src.is_some();
50+
let has_source = embed_source
51+
&& (source_file.src.is_some() || source_file.external_src.read().get_source().is_some());
5152

5253
if !has_md5 && !has_source {
5354
return None;
@@ -62,6 +63,8 @@ fn make_file_info(source_file: &SourceFile, embed_source: bool) -> Option<FileIn
6263
if embed_source {
6364
if let Some(src) = &source_file.src {
6465
info.source = Some(LineString::String(src.as_bytes().to_vec()));
66+
} else if let Some(src) = source_file.external_src.read().get_source() {
67+
info.source = Some(LineString::String(src.as_bytes().to_vec()));
6568
}
6669
}
6770

@@ -79,19 +82,22 @@ impl DebugContext {
7982
let span = hygiene::walk_chain_collapsed(span, function_span);
8083
match tcx.sess.source_map().lookup_line(span.lo()) {
8184
Ok(SourceFileAndLine { sf: file, line }) => {
82-
let file_id = self.add_source_file(&file);
85+
let file_id = self.add_source_file(tcx, &file);
8386
let line_pos = file.lines()[line];
8487
let col = file.relative_position(span.lo()) - line_pos;
8588

8689
(file_id, u64::try_from(line).unwrap() + 1, u64::from(col.to_u32()) + 1)
8790
}
88-
Err(file) => (self.add_source_file(&file), 0, 0),
91+
Err(file) => (self.add_source_file(tcx, &file), 0, 0),
8992
}
9093
}
9194

92-
pub(crate) fn add_source_file(&mut self, source_file: &SourceFile) -> FileId {
95+
pub(crate) fn add_source_file(&mut self, tcx: TyCtxt<'_>, source_file: &SourceFile) -> FileId {
9396
let cache_key = (source_file.stable_id, source_file.src_hash);
9497
*self.created_files.entry(cache_key).or_insert_with(|| {
98+
if self.embed_source && source_file.src.is_none() {
99+
tcx.sess.source_map().ensure_source_file_source_present(source_file);
100+
}
95101
let line_program: &mut LineProgram = &mut self.dwarf.unit.line_program;
96102
let line_strings: &mut LineStringTable = &mut self.dwarf.line_strings;
97103

src/driver/aot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_codegen_ssa::back::write::produce_final_output_artifacts;
1414
use rustc_codegen_ssa::base::determine_cgu_reuse;
1515
use rustc_codegen_ssa::{CompiledModule, CompiledModules, ModuleKind};
1616
use rustc_data_structures::profiling::SelfProfilerRef;
17-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
17+
use rustc_data_structures::stable_hasher::{StableHash, StableHashCtxt, StableHasher};
1818
use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
1919
use rustc_hir::attrs::Linkage as RLinkage;
2020
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
@@ -45,8 +45,8 @@ enum OngoingModuleCodegen {
4545
Async(JoinHandle<Result<ModuleCodegenResult, String>>),
4646
}
4747

48-
impl<Hcx> HashStable<Hcx> for OngoingModuleCodegen {
49-
fn hash_stable(&self, _: &mut Hcx, _: &mut StableHasher) {
48+
impl StableHash for OngoingModuleCodegen {
49+
fn stable_hash<Hcx: StableHashCtxt>(&self, _: &mut Hcx, _: &mut StableHasher) {
5050
// do nothing
5151
}
5252
}

0 commit comments

Comments
 (0)