Skip to content

Remove error about obsolete dereferencing of newtype structs. #25523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3153,26 +3153,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
Some(&**oprnd), oprnd_t, lvalue_pref) {
Some(mt) => mt.ty,
None => {
let is_newtype = match oprnd_t.sty {
ty::ty_struct(did, substs) => {
let fields = ty::struct_fields(fcx.tcx(), did, substs);
fields.len() == 1
&& fields[0].name ==
token::special_idents::unnamed_field.name
}
_ => false
};
if is_newtype {
// This is an obsolete struct deref
span_err!(tcx.sess, expr.span, E0068,
"single-field tuple-structs can \
no longer be dereferenced");
} else {
fcx.type_error_message(expr.span, |actual| {
format!("type `{}` cannot be \
dereferenced", actual)
}, oprnd_t, None);
}
fcx.type_error_message(expr.span, |actual| {
format!("type `{}` cannot be \
dereferenced", actual)
}, oprnd_t, None);
tcx.types.err
}
}
Expand Down