Skip to content

Commit 6806927

Browse files
committed
some bugfixes
1 parent 7a66bfe commit 6806927

File tree

9 files changed

+28
-29
lines changed

9 files changed

+28
-29
lines changed

compiler/rustc_codegen_ssa/src/back/lto.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_data_structures::{fx::FxHashMap, memmap::Mmap};
55
use std::ffi::CString;
66
use std::sync::Arc;
77

8-
use rustc_data_structures::memmap::Mmap;
98
use rustc_errors::FatalError;
109

1110
use super::write::CodegenContext;

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn generate_lto_work<B: ExtraBackendMethods>(
424424
} else {
425425
if !autodiff.is_empty() {
426426
let dcx = cgcx.create_dcx();
427-
dcx.emit_fatal(AutodiffWithoutLto{});
427+
dcx.handle().emit_fatal(AutodiffWithoutLto{});
428428
}
429429
assert!(needs_fat_lto.is_empty());
430430
let (lto_modules, copy_jobs) = B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules)

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
use rustc_middle::ty::typetree_from;
2-
use rustc_ast::expand::typetree::{TypeTree, FncTree};
3-
41
use std::cmp;
52
use std::collections::BTreeSet;
63
use std::time::{Duration, Instant};

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,9 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
781781
0 => return AutoDiffAttrs::inactive(),
782782
1 => attrs.get(0).unwrap(),
783783
_ => {
784-
tcx.sess
784+
tcx.dcx()
785785
.struct_span_err(attrs[1].span, msg_once)
786-
.span_label(attrs[1].span, "more than one")
786+
.with_note("more than one")
787787
.emit();
788788
return AutoDiffAttrs::inactive();
789789
}
@@ -797,19 +797,19 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
797797
}
798798

799799
let [mode, input_activities @ .., ret_activity] = &list[..] else {
800-
tcx.sess
800+
tcx.dcx()
801801
.struct_span_err(attr.span, msg_once)
802-
.span_label(attr.span, "Implementation bug in autodiff_attrs. Please report this!")
802+
.with_note("Implementation bug in autodiff_attrs. Please report this!")
803803
.emit();
804804
return AutoDiffAttrs::inactive();
805805
};
806806
let mode = if let NestedMetaItem::MetaItem(MetaItem { path: ref p1, .. }) = mode {
807807
p1.segments.first().unwrap().ident
808808
} else {
809809
let msg = "autodiff attribute must contain autodiff mode";
810-
tcx.sess
810+
tcx.dcx()
811811
.struct_span_err(attr.span, msg)
812-
.span_label(attr.span, "empty argument list")
812+
.with_note("empty argument list")
813813
.emit();
814814
return AutoDiffAttrs::inactive();
815815
};
@@ -822,9 +822,9 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
822822
"ForwardFirst" => DiffMode::ForwardFirst,
823823
"ReverseFirst" => DiffMode::ReverseFirst,
824824
_ => {
825-
tcx.sess
825+
tcx.dcx()
826826
.struct_span_err(attr.span, msg_mode)
827-
.span_label(attr.span, "invalid mode")
827+
.with_note("invalid mode")
828828
.emit();
829829
return AutoDiffAttrs::inactive();
830830
}
@@ -835,9 +835,9 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
835835
p1.segments.first().unwrap().ident
836836
} else {
837837
let msg = "autodiff attribute must contain the return activity";
838-
tcx.sess
838+
tcx.dcx()
839839
.struct_span_err(attr.span, msg)
840-
.span_label(attr.span, "missing return activity")
840+
.with_note("missing return activity")
841841
.emit();
842842
return AutoDiffAttrs::inactive();
843843
};
@@ -847,9 +847,9 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
847847
let ret_activity = match DiffActivity::from_str(ret_symbol.as_str()) {
848848
Ok(x) => x,
849849
Err(_) => {
850-
tcx.sess
850+
tcx.dcx()
851851
.struct_span_err(attr.span, msg_unknown_ret_activity)
852-
.span_label(attr.span, "invalid return activity")
852+
.with_note("invalid return activity")
853853
.emit();
854854
return AutoDiffAttrs::inactive();
855855
}
@@ -862,19 +862,19 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
862862
let arg_symbol = if let NestedMetaItem::MetaItem(MetaItem { path: ref p2, .. }) = arg {
863863
p2.segments.first().unwrap().ident
864864
} else {
865-
tcx.sess
865+
tcx.dcx()
866866
.struct_span_err(attr.span, msg_arg_activity)
867-
.span_label(attr.span, "Implementation bug, please report this!")
867+
.with_note("Implementation bug, please report this!")
868868
.emit();
869869
return AutoDiffAttrs::inactive();
870870
};
871871

872872
match DiffActivity::from_str(arg_symbol.as_str()) {
873873
Ok(arg_activity) => arg_activities.push(arg_activity),
874874
Err(_) => {
875-
tcx.sess
875+
tcx.dcx()
876876
.struct_span_err(attr.span, msg_unknown_ret_activity)
877-
.span_label(attr.span, "invalid input activity")
877+
.with_note("invalid input activity")
878878
.emit();
879879
return AutoDiffAttrs::inactive();
880880
}
@@ -889,9 +889,9 @@ fn autodiff_attrs(tcx: TyCtxt<'_>, id: DefId) -> AutoDiffAttrs {
889889
msg = format!("Invalid return activity {} for {} mode", ret_activity, mode);
890890
}
891891
if msg != "".to_string() {
892-
tcx.sess
892+
tcx.dcx()
893893
.struct_span_err(attr.span, msg)
894-
.span_label(attr.span, "invalid activity")
894+
.with_note("invalid activity")
895895
.emit();
896896
return AutoDiffAttrs::inactive();
897897
}

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
15391539
align,
15401540
bx.const_usize(copy_bytes),
15411541
MemFlags::empty(),
1542+
None,
15421543
);
15431544
// ...and then load it with the ABI type.
15441545
let cast_ty = bx.cast_backend_type(cast);

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use tracing::trace;
12
use rustc_middle::ty::typetree_from;
23
use rustc_ast::expand::typetree::{TypeTree, FncTree};
3-
use crate::rustc_middle::ty::layout::HasTyCtxt;
4+
use rustc_middle::ty::layout::HasTyCtxt;
45

56
use rustc_middle::ty::{self, Ty, TyCtxt};
67
use rustc_middle::{bug, span_bug};
@@ -42,6 +43,7 @@ fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
4243
bx.memmove(dst, align, src, align, size, flags, Some(fnc_tree));
4344
} else {
4445
bx.memcpy(dst, align, src, align, size, flags, Some(fnc_tree));
46+
}
4547
}
4648

4749
fn memset_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ pub trait BuilderMethods<'a, 'tcx>:
339339
temp.val.store_with_flags(self, dst.with_type(layout), flags);
340340
} else if !layout.is_zst() {
341341
let bytes = self.const_usize(layout.size.bytes());
342-
self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags);
342+
self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags, None);
343343
}
344344
}
345345

compiler/rustc_monomorphize/src/partitioning.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
//! source-level module, functions from the same module will be available for
9393
//! inlining, even when they are not marked `#[inline]`.
9494
95+
use tracing::trace;
9596
use std::cmp;
9697
use std::collections::hash_map::Entry;
9798
use std::fs::{self, File};
@@ -100,7 +101,7 @@ use std::path::{Path, PathBuf};
100101

101102
use rustc_ast::expand::autodiff_attrs::{AutoDiffItem, AutoDiffAttrs};
102103
use rustc_middle::ty::{
103-
self, visit::TypeVisitableExt, InstanceDef, ParamEnv, TyCtxt,
104+
self, visit::TypeVisitableExt, ParamEnv, TyCtxt,
104105
fnc_typetrees
105106
};
106107
use rustc_symbol_mangling::symbol_name_for_instance_in_crate;
@@ -121,8 +122,7 @@ use rustc_middle::mir::mono::{
121122
Visibility,
122123
};
123124
use rustc_middle::ty::print::{characteristic_def_id_of_type, with_no_trimmed_paths};
124-
use rustc_middle::ty::visit::TypeVisitableExt;
125-
use rustc_middle::ty::{self, InstanceKind, TyCtxt};
125+
use rustc_middle::ty::InstanceKind;
126126
use rustc_middle::util::Providers;
127127
use rustc_session::config::{DumpMonoStatsFormat, SwitchWithOptPath};
128128
use rustc_session::CodegenUnits;

compiler/rustc_resolve/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ pub struct Resolver<'a, 'tcx> {
11361136
node_id_to_def_id: NodeMap<Feed<'tcx, LocalDefId>>,
11371137
def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,
11381138

1139-
autodiff_map: Default::default(),
1139+
autodiff_map: FxHashMap<LocalDefId, LocalDefId>,
11401140

11411141
/// Indices of unnamed struct or variant fields with unresolved attributes.
11421142
placeholder_field_indices: FxHashMap<NodeId, usize>,

0 commit comments

Comments
 (0)