Skip to content

Commit 7b8044c

Browse files
committed
---
yaml --- r: 273689 b: refs/heads/beta c: 7b69ad9 h: refs/heads/master i: 273687: 42d969c
1 parent 877ecc6 commit 7b8044c

File tree

10 files changed

+42
-68
lines changed

10 files changed

+42
-68
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: deee0f73da885a71ebf9c8d29213c663dba467b9
26+
refs/heads/beta: 7b69ad91585cebb50a1b6cae0d8d9a3ac83d78ff
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
123123
test rustc_lint rustc_front
124124

125125

126-
TOOL_DEPS_compiletest := test getopts log
126+
TOOL_DEPS_compiletest := test getopts
127127
TOOL_DEPS_rustdoc := rustdoc
128128
TOOL_DEPS_rustc := rustc_driver
129129
TOOL_DEPS_rustbook := std rustdoc

branches/beta/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ endif
493493
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
494494
$$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib
495495
LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
496-
$$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(CFG_BUILD))
496+
$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
497497

498498
HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
499499
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))

branches/beta/src/librustc/ty/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,6 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
12021202
}
12031203
}
12041204

1205-
/// Construct a parameter environment given an item, impl item, or trait item
12061205
pub fn for_item(cx: &'a TyCtxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> {
12071206
match cx.map.find(id) {
12081207
Some(ast_map::NodeImplItem(ref impl_item)) => {
@@ -1342,7 +1341,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
13421341
}
13431342
_ => {
13441343
cx.sess.span_bug(item.span,
1345-
"ParameterEnvironment::for_item():
1344+
"ParameterEnvironment::from_item():
13461345
can't create a parameter \
13471346
environment for this kind of item")
13481347
}
@@ -1353,7 +1352,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
13531352
ParameterEnvironment::for_item(cx, cx.map.get_parent(id))
13541353
}
13551354
_ => {
1356-
cx.sess.bug(&format!("ParameterEnvironment::for_item(): \
1355+
cx.sess.bug(&format!("ParameterEnvironment::from_item(): \
13571356
`{}` is not an item",
13581357
cx.map.node_to_string(id)))
13591358
}

branches/beta/src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
199199
("associated_type_defaults", "1.2.0", Some(29661), Active),
200200

201201
// Allows macros to appear in the type position.
202-
("type_macros", "1.3.0", Some(27336), Active),
202+
("type_macros", "1.3.0", Some(27245), Active),
203203

204204
// allow `repr(simd)`, and importing the various simd intrinsics
205205
("repr_simd", "1.4.0", Some(27731), Active),

branches/beta/src/libsyntax_ext/deriving/generic/mod.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ use syntax::ptr::P;
209209

210210
use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
211211

212-
use deriving;
213-
214212
pub mod ty;
215213

216214
pub struct TraitDef<'a> {
@@ -383,6 +381,22 @@ fn find_type_parameters(ty: &ast::Ty, ty_param_names: &[ast::Name]) -> Vec<P<ast
383381
visitor.types
384382
}
385383

384+
/// Replacement for expr_unreachable which generates intrinsics::unreachable()
385+
/// instead of unreachable!()
386+
fn expr_unreachable_intrinsic(cx: &ExtCtxt, sp: Span) -> P<Expr> {
387+
let path = cx.std_path(&["intrinsics", "unreachable"]);
388+
let call = cx.expr_call_global(
389+
sp, path, vec![]);
390+
let unreachable = cx.expr_block(P(ast::Block {
391+
stmts: vec![],
392+
expr: Some(call),
393+
id: ast::DUMMY_NODE_ID,
394+
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
395+
span: sp }));
396+
397+
unreachable
398+
}
399+
386400
impl<'a> TraitDef<'a> {
387401
pub fn expand(&self,
388402
cx: &mut ExtCtxt,
@@ -1265,11 +1279,15 @@ impl<'a> MethodDef<'a> {
12651279

12661280
let mut first_ident = None;
12671281
for (&ident, self_arg) in vi_idents.iter().zip(&self_args) {
1268-
let self_addr = cx.expr_addr_of(sp, self_arg.clone());
1269-
let variant_value = deriving::call_intrinsic(cx,
1270-
sp,
1271-
"discriminant_value",
1272-
vec![self_addr]);
1282+
let path = cx.std_path(&["intrinsics", "discriminant_value"]);
1283+
let call = cx.expr_call_global(
1284+
sp, path, vec![cx.expr_addr_of(sp, self_arg.clone())]);
1285+
let variant_value = cx.expr_block(P(ast::Block {
1286+
stmts: vec![],
1287+
expr: Some(call),
1288+
id: ast::DUMMY_NODE_ID,
1289+
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
1290+
span: sp }));
12731291

12741292
let target_ty = cx.ty_ident(sp, cx.ident_of(target_type_name));
12751293
let variant_disr = cx.expr_cast(sp, variant_value, target_ty);
@@ -1297,9 +1315,7 @@ impl<'a> MethodDef<'a> {
12971315
//Since we know that all the arguments will match if we reach the match expression we
12981316
//add the unreachable intrinsics as the result of the catch all which should help llvm
12991317
//in optimizing it
1300-
match_arms.push(cx.arm(sp,
1301-
vec![cx.pat_wild(sp)],
1302-
deriving::call_intrinsic(cx, sp, "unreachable", vec![])));
1318+
match_arms.push(cx.arm(sp, vec![cx.pat_wild(sp)], expr_unreachable_intrinsic(cx, sp)));
13031319

13041320
// Final wrinkle: the self_args are expressions that deref
13051321
// down to desired l-values, but we cannot actually deref
@@ -1375,7 +1391,7 @@ impl<'a> MethodDef<'a> {
13751391
// derive Debug on such a type could here generate code
13761392
// that needs the feature gate enabled.)
13771393

1378-
deriving::call_intrinsic(cx, sp, "unreachable", vec![])
1394+
expr_unreachable_intrinsic(cx, sp)
13791395
}
13801396
else {
13811397

branches/beta/src/libsyntax_ext/deriving/hash.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
8181

8282
let fields = match *substr.fields {
8383
Struct(_, ref fs) => fs,
84-
EnumMatching(_, _, ref fs) => {
85-
let variant_value = deriving::call_intrinsic(cx,
86-
trait_span,
87-
"discriminant_value",
88-
vec![cx.expr_self(trait_span)]);
84+
EnumMatching(index, variant, ref fs) => {
85+
// Determine the discriminant. We will feed this value to the byte
86+
// iteration function.
87+
let discriminant = match variant.node.disr_expr {
88+
Some(ref d) => d.clone(),
89+
None => cx.expr_usize(trait_span, index)
90+
};
8991

90-
stmts.push(call_hash(trait_span, variant_value));
92+
stmts.push(call_hash(trait_span, discriminant));
9193

9294
fs
9395
}

branches/beta/src/libsyntax_ext/deriving/mod.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use syntax::ext::build::AstBuilder;
1818
use syntax::feature_gate;
1919
use syntax::codemap::Span;
2020
use syntax::parse::token::{intern, intern_and_get_ident};
21-
use syntax::ptr::P;
2221

2322
macro_rules! pathvec {
2423
($($x:ident)::+) => (
@@ -272,19 +271,3 @@ fn hygienic_type_parameter(item: &Annotatable, base: &str) -> String {
272271
typaram
273272
}
274273

275-
/// Constructs an expression that calls an intrinsic
276-
fn call_intrinsic(cx: &ExtCtxt,
277-
span: Span,
278-
intrinsic: &str,
279-
args: Vec<P<ast::Expr>>) -> P<ast::Expr> {
280-
let path = cx.std_path(&["intrinsics", intrinsic]);
281-
let call = cx.expr_call_global(span, path, args);
282-
283-
cx.expr_block(P(ast::Block {
284-
stmts: vec![],
285-
expr: Some(call),
286-
id: ast::DUMMY_NODE_ID,
287-
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
288-
span: span }))
289-
}
290-

branches/beta/src/test/compile-fail/type-macros-fail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ macro_rules! Id {
1414

1515
struct Foo<T> {
1616
x: Id!(T)
17-
//~^ ERROR: type macros are experimental (see issue #27336)
17+
//~^ ERROR: type macros are experimental (see issue #27245)
1818
}
1919

2020
fn main() {

branches/beta/src/test/run-pass/deriving-hash.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![feature(hash_default)]
1313

1414
use std::hash::{Hash, SipHasher, Hasher};
15-
use std::mem::size_of;
1615

1716
#[derive(Hash)]
1817
struct Person {
@@ -25,30 +24,12 @@ struct Person {
2524
#[derive(Hash)] struct __H__H;
2625
#[derive(Hash)] enum Collision<__H> { __H { __H__H: __H } }
2726

28-
#[derive(Hash)]
29-
enum E { A=1, B }
30-
3127
fn hash<T: Hash>(t: &T) -> u64 {
3228
let mut s = SipHasher::new_with_keys(0, 0);
3329
t.hash(&mut s);
3430
s.finish()
3531
}
3632

37-
struct FakeHasher<'a>(&'a mut Vec<u8>);
38-
impl<'a> Hasher for FakeHasher<'a> {
39-
fn finish(&self) -> u64 {
40-
unimplemented!()
41-
}
42-
43-
fn write(&mut self, bytes: &[u8]) {
44-
self.0.extend(bytes);
45-
}
46-
}
47-
48-
fn fake_hash(v: &mut Vec<u8>, e: E) {
49-
e.hash(&mut FakeHasher(v));
50-
}
51-
5233
fn main() {
5334
let person1 = Person {
5435
id: 5,
@@ -62,11 +43,4 @@ fn main() {
6243
};
6344
assert_eq!(hash(&person1), hash(&person1));
6445
assert!(hash(&person1) != hash(&person2));
65-
66-
// test #21714
67-
let mut va = vec![];
68-
let mut vb = vec![];
69-
fake_hash(&mut va, E::A);
70-
fake_hash(&mut vb, E::B);
71-
assert!(va != vb);
7246
}

0 commit comments

Comments
 (0)