Skip to content

Commit ad600fe

Browse files
committed
---
yaml --- r: 214463 b: refs/heads/beta c: d0fc35f h: refs/heads/master i: 214461: 23d35c9 214459: e06ef03 214455: c1ff8d8 214447: 2aeecde 214431: 0b3579a 214399: 60cae4f v: v3
1 parent 7d8bff7 commit ad600fe

File tree

5 files changed

+24
-40
lines changed

5 files changed

+24
-40
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 0cc99f9cc9b59518f618a2c3f5011000e60f922e
26+
refs/heads/beta: d0fc35f394ca9b7a4bb87866ed15c1ee742ffae6
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 8c0aa6d64ebab528f7eb182812007155d6044972
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc/middle/const_eval.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -34,7 +34,7 @@ use std::borrow::{Cow, IntoCow};
3434
use std::num::wrapping::OverflowingOps;
3535
use std::cmp::Ordering;
3636
use std::collections::hash_map::Entry::Vacant;
37-
use std::{i8, i16, i32, i64, u8, u16, u32, u64};
37+
use std::{i8, i16, i32, i64};
3838
use std::rc::Rc;
3939

4040
fn lookup_const<'a>(tcx: &'a ty::ctxt, e: &Expr) -> Option<&'a Expr> {
@@ -461,16 +461,6 @@ pub fn const_uint_checked_neg<'a>(
461461
Ok(const_uint((!a).wrapping_add(1)))
462462
}
463463

464-
fn const_uint_not(a: u64, opt_ety: Option<UintTy>) -> const_val {
465-
let mask = match opt_ety {
466-
Some(UintTy::U8) => u8::MAX as u64,
467-
Some(UintTy::U16) => u16::MAX as u64,
468-
Some(UintTy::U32) => u32::MAX as u64,
469-
None | Some(UintTy::U64) => u64::MAX,
470-
};
471-
const_uint(!a & mask)
472-
}
473-
474464
macro_rules! overflow_checking_body {
475465
($a:ident, $b:ident, $ety:ident, $overflowing_op:ident,
476466
lhs: $to_8_lhs:ident $to_16_lhs:ident $to_32_lhs:ident,
@@ -687,7 +677,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
687677
ast::ExprUnary(ast::UnNot, ref inner) => {
688678
match try!(eval_const_expr_partial(tcx, &**inner, ety)) {
689679
const_int(i) => const_int(!i),
690-
const_uint(i) => const_uint_not(i, expr_uint_type),
680+
const_uint(i) => const_uint(!i),
691681
const_bool(b) => const_bool(!b),
692682
const_str(_) => signal!(e, NotOnString),
693683
const_float(_) => signal!(e, NotOnFloat),

branches/beta/src/librustc_typeck/check/mod.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,10 +3153,26 @@ 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-
fcx.type_error_message(expr.span, |actual| {
3157-
format!("type `{}` cannot be \
3158-
dereferenced", actual)
3159-
}, oprnd_t, 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+
}
31603176
tcx.types.err
31613177
}
31623178
}

branches/beta/src/libsyntax/feature_gate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
258258
("no_builtins", Whitelisted),
259259
("no_mangle", Whitelisted),
260260
("no_stack_check", Whitelisted),
261-
("packed", Whitelisted),
262261
("static_assert", Gated("static_assert",
263262
"`#[static_assert]` is an experimental feature, and has a poor API")),
264263
("no_debug", Whitelisted),

branches/beta/src/test/run-pass/issue-23968-const-not-overflow.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)