Skip to content

Commit e4d56b7

Browse files
committed
Auto merge of #25523 - nham:remove_E0068, r=alexcrichton
A built-in feature enabling the dereferencing of newtype structs was removed in PR #11188, and this error (E0068) was added at the same time to warn of its removal. It seems to make sense to remove the error now, given that the obsolete feature it is warning about was removed nearly a year and a half ago.
2 parents 1c44801 + f47cb0e commit e4d56b7

File tree

1 file changed

+4
-20
lines changed
  • src/librustc_typeck/check

1 file changed

+4
-20
lines changed

src/librustc_typeck/check/mod.rs

+4-20
Original file line numberDiff line numberDiff line change
@@ -3153,26 +3153,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
31533153
Some(&**oprnd), oprnd_t, lvalue_pref) {
31543154
Some(mt) => mt.ty,
31553155
None => {
3156-
let is_newtype = match oprnd_t.sty {
3157-
ty::ty_struct(did, substs) => {
3158-
let fields = ty::struct_fields(fcx.tcx(), did, substs);
3159-
fields.len() == 1
3160-
&& fields[0].name ==
3161-
token::special_idents::unnamed_field.name
3162-
}
3163-
_ => false
3164-
};
3165-
if is_newtype {
3166-
// This is an obsolete struct deref
3167-
span_err!(tcx.sess, expr.span, E0068,
3168-
"single-field tuple-structs can \
3169-
no longer be dereferenced");
3170-
} else {
3171-
fcx.type_error_message(expr.span, |actual| {
3172-
format!("type `{}` cannot be \
3173-
dereferenced", actual)
3174-
}, oprnd_t, None);
3175-
}
3156+
fcx.type_error_message(expr.span, |actual| {
3157+
format!("type `{}` cannot be \
3158+
dereferenced", actual)
3159+
}, oprnd_t, None);
31763160
tcx.types.err
31773161
}
31783162
}

0 commit comments

Comments
 (0)