Skip to content

Commit 065f0b2

Browse files
committed
Move query out of path.
1 parent 40cb4d1 commit 065f0b2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/rustc_hir_analysis/src/coherence/orphan.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ fn do_orphan_check_impl<'tcx>(
3838
def_id: LocalDefId,
3939
) -> Result<(), ErrorGuaranteed> {
4040
let trait_def_id = trait_ref.def_id;
41-
let sp = tcx.def_span(def_id);
4241

4342
match traits::orphan_check(tcx, def_id.to_def_id()) {
4443
Ok(()) => {}
@@ -48,6 +47,7 @@ fn do_orphan_check_impl<'tcx>(
4847
bug!("{:?} is not an impl: {:?}", def_id, item);
4948
};
5049
let tr = impl_.of_trait.as_ref().unwrap();
50+
let sp = tcx.def_span(def_id);
5151

5252
emit_orphan_check_error(
5353
tcx,
@@ -237,7 +237,10 @@ fn do_orphan_check_impl<'tcx>(
237237
| ty::GeneratorWitnessMIR(..)
238238
| ty::Bound(..)
239239
| ty::Placeholder(..)
240-
| ty::Infer(..) => span_bug!(sp, "weird self type for autotrait impl"),
240+
| ty::Infer(..) => {
241+
let sp = tcx.def_span(def_id);
242+
span_bug!(sp, "weird self type for autotrait impl")
243+
}
241244

242245
ty::Error(..) => (LocalImpl::Allow, NonlocalImpl::Allow),
243246
};
@@ -256,6 +259,7 @@ fn do_orphan_check_impl<'tcx>(
256259
is one of the trait object's trait bounds",
257260
trait = tcx.def_path_str(trait_def_id),
258261
);
262+
let sp = tcx.def_span(def_id);
259263
let reported =
260264
struct_span_err!(tcx.sess, sp, E0321, "{}", msg).note(label).emit();
261265
return Err(reported);
@@ -284,6 +288,7 @@ fn do_orphan_check_impl<'tcx>(
284288
non-struct/enum type",
285289
)),
286290
} {
291+
let sp = tcx.def_span(def_id);
287292
let reported =
288293
struct_span_err!(tcx.sess, sp, E0321, "{}", msg).span_label(sp, label).emit();
289294
return Err(reported);

compiler/rustc_monomorphize/src/collector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1191,8 +1191,8 @@ impl<'v> RootCollector<'_, 'v> {
11911191
fn process_item(&mut self, id: hir::ItemId) {
11921192
match self.tcx.def_kind(id.owner_id) {
11931193
DefKind::Enum | DefKind::Struct | DefKind::Union => {
1194-
if self.tcx.generics_of(id.owner_id).count() == 0
1195-
&& self.mode == MonoItemCollectionMode::Eager
1194+
if self.mode == MonoItemCollectionMode::Eager
1195+
&& self.tcx.generics_of(id.owner_id).count() == 0
11961196
{
11971197
debug!("RootCollector: ADT drop-glue for `{id:?}`",);
11981198

0 commit comments

Comments
 (0)