about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_passes/src/dead.rs9
-rw-r--r--library/core/tests/mem.rs2
-rw-r--r--tests/ui/lint/dead-code/offset-of-correct-param-env.rs14
3 files changed, 12 insertions, 13 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs
index 170b0b91e57..3ae5b45d330 100644
--- a/compiler/rustc_passes/src/dead.rs
+++ b/compiler/rustc_passes/src/dead.rs
@@ -255,16 +255,13 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
                     self.insert_def_id(field.did);
                     let field_ty = field.ty(self.tcx, subst);
 
-                    current_ty =
-                        self.tcx.normalize_erasing_regions(param_env, field_ty);
+                    current_ty = self.tcx.normalize_erasing_regions(param_env, field_ty);
                 }
                 // we don't need to mark tuple fields as live,
                 // but we may need to mark subfields
                 ty::Tuple(tys) => {
-                    current_ty = self.tcx.normalize_erasing_regions(
-                        param_env,
-                        tys[index.as_usize()],
-                    );
+                    current_ty =
+                        self.tcx.normalize_erasing_regions(param_env, tys[index.as_usize()]);
                 }
                 _ => span_bug!(expr.span, "named field access on non-ADT"),
             }
diff --git a/library/core/tests/mem.rs b/library/core/tests/mem.rs
index b2a7df6b2e9..2351406ddd2 100644
--- a/library/core/tests/mem.rs
+++ b/library/core/tests/mem.rs
@@ -458,4 +458,4 @@ fn offset_of_addr() {
     assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, y), ptr::addr_of!(base.y).addr());
     assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, z.0), ptr::addr_of!(base.z.0).addr());
     assert_eq!(ptr::addr_of!(base).addr() + offset_of!(Foo, z.1), ptr::addr_of!(base.z.1).addr());
-}
\ No newline at end of file
+}
diff --git a/tests/ui/lint/dead-code/offset-of-correct-param-env.rs b/tests/ui/lint/dead-code/offset-of-correct-param-env.rs
index b7444049a88..ae5d5a68e6a 100644
--- a/tests/ui/lint/dead-code/offset-of-correct-param-env.rs
+++ b/tests/ui/lint/dead-code/offset-of-correct-param-env.rs
@@ -27,14 +27,16 @@ fn test<T>() -> usize
 where
     GenericIsEqual<T>: Project<EquateParamTo = MyFieldIsNotDead>,
 {
-	// The first field of the A that we construct here is `<GenericIsEqual<T>> as Project>::EquateParamTo`.
-	// Typeck normalizes this and figures that the not_dead field is totally fine and accessible.
-	// But importantly, the normalization ends up with T, which, as we've declared in our param env is MyFieldDead.
-	// When we're in the param env of the `a` field, the where bound above is not in scope, so we don't know what T is - it's generic.
-	// We cannot access a field on T. Boom!
+    // The first field of the A that we construct here is
+    // `<GenericIsEqual<T>> as Project>::EquateParamTo`.
+    // Typeck normalizes this and figures that the not_dead field is totally fine and accessible.
+    // But importantly, the normalization ends up with T, which, as we've declared in our param
+    // env is MyFieldDead. When we're in the param env of the `a` field, the where bound above
+    // is not in scope, so we don't know what T is - it's generic.
+    // We cannot access a field on T. Boom!
     std::mem::offset_of!(A<GenericIsEqual<T>>, a.not_dead)
 }
 
 fn main() {
     test::<MyFieldIsNotDead>();
-}
\ No newline at end of file
+}