Skip to content

Commit 26d9ac6

Browse files
committed
---
yaml --- r: 228339 b: refs/heads/try c: 72483f5 h: refs/heads/master i: 228337: a37bb90 228335: 96786d2 v: v3
1 parent 42597b0 commit 26d9ac6

File tree

17 files changed

+168
-30
lines changed

17 files changed

+168
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 7131e6f378af212b86e6bc0ddbc632c3f2e5d255
4+
refs/heads/try: 72483f58e355c6ec9016cbaba4d9b8d3adbd3867
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/AUTHORS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ Santiago Rodriguez <[email protected]>
958958
Saurabh Anand <[email protected]>
959959
Scott Jenkins <[email protected]>
960960
Scott Lawrence <[email protected]>
961-
Scott Olson <scott@scott-olson.org>
961+
Scott Olson <scott@solson.me>
962962
Sean Bowe <[email protected]>
963963
Sean Chalmers <[email protected]>
964964
Sean Collins <[email protected]>

branches/try/src/doc/trpl/dining-philosophers.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ look at `main()` again:
151151
# struct Philosopher {
152152
# name: String,
153153
# }
154-
#
154+
#
155155
# impl Philosopher {
156156
# fn new(name: &str) -> Philosopher {
157157
# Philosopher {
158158
# name: name.to_string(),
159159
# }
160160
# }
161161
# }
162-
#
162+
#
163163
fn main() {
164164
let p1 = Philosopher::new("Judith Butler");
165165
let p2 = Philosopher::new("Gilles Deleuze");
@@ -197,15 +197,15 @@ a method, and then loop through all the philosophers, calling it:
197197
```rust
198198
struct Philosopher {
199199
name: String,
200-
}
200+
}
201201

202-
impl Philosopher {
202+
impl Philosopher {
203203
fn new(name: &str) -> Philosopher {
204204
Philosopher {
205205
name: name.to_string(),
206206
}
207207
}
208-
208+
209209
fn eat(&self) {
210210
println!("{} is done eating.", self.name);
211211
}
@@ -267,15 +267,15 @@ use std::thread;
267267

268268
struct Philosopher {
269269
name: String,
270-
}
270+
}
271271

272-
impl Philosopher {
272+
impl Philosopher {
273273
fn new(name: &str) -> Philosopher {
274274
Philosopher {
275275
name: name.to_string(),
276276
}
277277
}
278-
278+
279279
fn eat(&self) {
280280
println!("{} is eating.", self.name);
281281

@@ -348,9 +348,9 @@ use std::thread;
348348

349349
struct Philosopher {
350350
name: String,
351-
}
351+
}
352352

353-
impl Philosopher {
353+
impl Philosopher {
354354
fn new(name: &str) -> Philosopher {
355355
Philosopher {
356356
name: name.to_string(),
@@ -401,7 +401,7 @@ let handles: Vec<_> = philosophers.into_iter().map(|p| {
401401
While this is only five lines, they’re a dense five. Let’s break it down.
402402

403403
```rust,ignore
404-
let handles: Vec<_> =
404+
let handles: Vec<_> =
405405
```
406406

407407
We introduce a new binding, called `handles`. We’ve given it this name because
@@ -460,15 +460,15 @@ If you run this program, you’ll see that the philosophers eat out of order!
460460
We have multi-threading!
461461

462462
```text
463+
Judith Butler is eating.
463464
Gilles Deleuze is eating.
464-
Gilles Deleuze is done eating.
465+
Karl Marx is eating.
465466
Emma Goldman is eating.
466-
Emma Goldman is done eating.
467467
Michel Foucault is eating.
468-
Judith Butler is eating.
469468
Judith Butler is done eating.
470-
Karl Marx is eating.
469+
Gilles Deleuze is done eating.
471470
Karl Marx is done eating.
471+
Emma Goldman is done eating.
472472
Michel Foucault is done eating.
473473
```
474474

branches/try/src/etc/errorck.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
errcode_map = {}
2424
error_re = re.compile("(E\d\d\d\d)")
2525

26+
# In the register_long_diagnostics! macro, entries look like this:
27+
#
28+
# EXXXX: r##"
29+
# <Long diagnostic message>
30+
# "##,
31+
#
32+
# These two variables are for detecting the beginning and end of diagnostic
33+
# messages so that duplicate error codes are not reported when a code occurs
34+
# inside a diagnostic message
35+
long_diag_begin = "r##\""
36+
long_diag_end = "\"##"
37+
2638
for (dirpath, dirnames, filenames) in os.walk(src_dir):
2739
if "src/test" in dirpath or "src/llvm" in dirpath:
2840
# Short circuit for fast
@@ -35,7 +47,14 @@
3547
path = os.path.join(dirpath, filename)
3648

3749
with open(path, 'r') as f:
50+
inside_long_diag = False
3851
for line_num, line in enumerate(f, start=1):
52+
if inside_long_diag:
53+
# Skip duplicate error code checking for this line
54+
if long_diag_end in line:
55+
inside_long_diag = False
56+
continue
57+
3958
match = error_re.search(line)
4059
if match:
4160
errcode = match.group(1)
@@ -47,6 +66,9 @@
4766
else:
4867
errcode_map[errcode] = new_record
4968

69+
if long_diag_begin in line:
70+
inside_long_diag = True
71+
5072
errors = False
5173
all_errors = []
5274

branches/try/src/liballoc/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use core::raw::{TraitObject};
7171
/// The following two examples are equivalent:
7272
///
7373
/// ```
74-
/// #![feature(box_heap)]
74+
/// # #![feature(box_heap)]
7575
/// #![feature(box_syntax)]
7676
/// use std::boxed::HEAP;
7777
///
@@ -162,7 +162,7 @@ impl<T : ?Sized> Box<T> {
162162
///
163163
/// # Examples
164164
/// ```
165-
/// #![feature(box_raw)]
165+
/// # #![feature(box_raw)]
166166
/// use std::boxed;
167167
///
168168
/// let seventeen = Box::new(17u32);

branches/try/src/libcore/num/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,15 @@ macro_rules! int_impl {
459459
}
460460
}
461461

462-
/// Wrapping (modular) division. Computes `floor(self / other)`,
462+
/// Wrapping (modular) division. Computes `self / other`,
463463
/// wrapping around at the boundary of the type.
464464
///
465465
/// The only case where such wrapping can occur is when one
466466
/// divides `MIN / -1` on a signed type (where `MIN` is the
467467
/// negative minimal value for the type); this is equivalent
468468
/// to `-MIN`, a positive value that is too large to represent
469469
/// in the type. In such a case, this function returns `MIN`
470-
/// itself..
470+
/// itself.
471471
#[stable(feature = "num_wrapping", since = "1.2.0")]
472472
#[inline(always)]
473473
pub fn wrapping_div(self, rhs: Self) -> Self {
@@ -1031,15 +1031,15 @@ macro_rules! uint_impl {
10311031
}
10321032
}
10331033

1034-
/// Wrapping (modular) division. Computes `floor(self / other)`,
1034+
/// Wrapping (modular) division. Computes `self / other`,
10351035
/// wrapping around at the boundary of the type.
10361036
///
10371037
/// The only case where such wrapping can occur is when one
10381038
/// divides `MIN / -1` on a signed type (where `MIN` is the
10391039
/// negative minimal value for the type); this is equivalent
10401040
/// to `-MIN`, a positive value that is too large to represent
10411041
/// in the type. In such a case, this function returns `MIN`
1042-
/// itself..
1042+
/// itself.
10431043
#[stable(feature = "num_wrapping", since = "1.2.0")]
10441044
#[inline(always)]
10451045
pub fn wrapping_div(self, rhs: Self) -> Self {

branches/try/src/libcore/ops.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ pub trait Div<RHS=Self> {
351351
fn div(self, rhs: RHS) -> Self::Output;
352352
}
353353

354-
macro_rules! div_impl {
354+
macro_rules! div_impl_integer {
355355
($($t:ty)*) => ($(
356+
/// This operation rounds towards zero, truncating any
357+
/// fractional part of the exact result.
356358
#[stable(feature = "rust1", since = "1.0.0")]
357359
impl Div for $t {
358360
type Output = $t;
@@ -365,7 +367,23 @@ macro_rules! div_impl {
365367
)*)
366368
}
367369

368-
div_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
370+
div_impl_integer! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
371+
372+
macro_rules! div_impl_float {
373+
($($t:ty)*) => ($(
374+
#[stable(feature = "rust1", since = "1.0.0")]
375+
impl Div for $t {
376+
type Output = $t;
377+
378+
#[inline]
379+
fn div(self, other: $t) -> $t { self / other }
380+
}
381+
382+
forward_ref_binop! { impl Div, div for $t, $t }
383+
)*)
384+
}
385+
386+
div_impl_float! { f32 f64 }
369387

370388
/// The `Rem` trait is used to specify the functionality of `%`.
371389
///
@@ -407,6 +425,8 @@ pub trait Rem<RHS=Self> {
407425

408426
macro_rules! rem_impl {
409427
($($t:ty)*) => ($(
428+
/// This operation satisfies `n % d == n - (n / d) * d`. The
429+
/// result has the same sign as the left operand.
410430
#[stable(feature = "rust1", since = "1.0.0")]
411431
impl Rem for $t {
412432
type Output = $t;

branches/try/src/librustc/middle/fast_reject.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ pub fn simplify_type(tcx: &ty::ctxt,
7171
}
7272
ty::TyBox(_) => {
7373
// treat like we would treat `Box`
74-
let def_id = tcx.lang_items.owned_box().unwrap();
75-
Some(StructSimplifiedType(def_id))
74+
match tcx.lang_items.require_owned_box() {
75+
Ok(def_id) => Some(StructSimplifiedType(def_id)),
76+
Err(msg) => tcx.sess.fatal(&msg),
77+
}
7678
}
7779
ty::TyClosure(def_id, _) => {
7880
Some(ClosureSimplifiedType(def_id))

branches/try/src/librustc/middle/lang_items.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ impl LanguageItems {
9090
}
9191
}
9292

93+
pub fn require_owned_box(&self) -> Result<ast::DefId, String> {
94+
self.require(OwnedBoxLangItem)
95+
}
96+
9397
pub fn from_builtin_kind(&self, bound: ty::BuiltinBound)
9498
-> Result<ast::DefId, String>
9599
{

branches/try/src/librustc_trans/back/link.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,9 @@ fn link_args(cmd: &mut Linker,
954954
// Pass optimization flags down to the linker.
955955
cmd.optimize();
956956

957+
// Pass debuginfo flags down to the linker.
958+
cmd.debuginfo();
959+
957960
// We want to prevent the compiler from accidentally leaking in any system
958961
// libraries, so we explicitly ask gcc to not link to any libraries by
959962
// default. Note that this does not happen for windows because windows pulls

branches/try/src/librustc_trans/back/linker.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::fs;
1616
use back::archive;
1717
use session::Session;
1818
use session::config;
19+
use session::config::DebugInfoLevel::{NoDebugInfo, LimitedDebugInfo, FullDebugInfo};
1920

2021
/// Linker abstraction used by back::link to build up the command to invoke a
2122
/// linker.
@@ -39,6 +40,7 @@ pub trait Linker {
3940
fn gc_sections(&mut self, is_dylib: bool);
4041
fn position_independent_executable(&mut self);
4142
fn optimize(&mut self);
43+
fn debuginfo(&mut self);
4244
fn no_default_libraries(&mut self);
4345
fn build_dylib(&mut self, out_filename: &Path);
4446
fn args(&mut self, args: &[String]);
@@ -143,6 +145,10 @@ impl<'a> Linker for GnuLinker<'a> {
143145
}
144146
}
145147

148+
fn debuginfo(&mut self) {
149+
// Don't do anything special here for GNU-style linkers.
150+
}
151+
146152
fn no_default_libraries(&mut self) {
147153
// Unfortunately right now passing -nodefaultlibs to gcc on windows
148154
// doesn't work so hot (in terms of native dependencies). This if
@@ -265,6 +271,21 @@ impl<'a> Linker for MsvcLinker<'a> {
265271
fn optimize(&mut self) {
266272
// Needs more investigation of `/OPT` arguments
267273
}
274+
275+
fn debuginfo(&mut self) {
276+
match self.sess.opts.debuginfo {
277+
NoDebugInfo => {
278+
// Do nothing if debuginfo is disabled
279+
},
280+
LimitedDebugInfo |
281+
FullDebugInfo => {
282+
// This will cause the Microsoft linker to generate a PDB file
283+
// from the CodeView line tables in the object files.
284+
self.cmd.arg("/DEBUG");
285+
}
286+
}
287+
}
288+
268289
fn whole_archives(&mut self) {
269290
// hints not supported?
270291
}

branches/try/src/librustc_trans/trans/_match.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,8 @@ impl<'tcx> euv::Delegate<'tcx> for ReassignmentChecker {
13841384
match base_cmt.cat {
13851385
mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: vid, .. }, .. }) |
13861386
mc::cat_local(vid) => {
1387-
self.reassigned |= self.node == vid && Some(field) == self.field
1387+
self.reassigned |= self.node == vid &&
1388+
(self.field.is_none() || Some(field) == self.field)
13881389
},
13891390
_ => {}
13901391
}

branches/try/src/librustc_typeck/coherence/orphan.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
7777
self.check_def_id(item, data.principal_def_id());
7878
}
7979
ty::TyBox(..) => {
80-
self.check_def_id(item, self.tcx.lang_items.owned_box().unwrap());
80+
match self.tcx.lang_items.require_owned_box() {
81+
Ok(trait_id) => self.check_def_id(item, trait_id),
82+
Err(msg) => self.tcx.sess.span_fatal(item.span, &msg),
83+
}
8184
}
8285
ty::TyChar => {
8386
self.check_primitive_impl(def_id,

branches/try/src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
501501
},
502502
"path" | "ty" => {
503503
match *tok {
504-
Comma | FatArrow | Colon | Eq | Gt => Ok(true),
504+
Comma | FatArrow | Colon | Eq | Gt | Semi => Ok(true),
505505
Ident(i, _) if i.as_str() == "as" => Ok(true),
506506
_ => Ok(false)
507507
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test that we don't ICE when we are missing the owned_box lang item.
12+
13+
// error-pattern: requires `owned_box` lang_item
14+
15+
#![no_std]
16+
#![feature(lang_items, no_std, box_syntax)]
17+
18+
extern crate core;
19+
20+
fn main() {
21+
let x = box 1i32;
22+
}
23+
24+
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
25+
#[lang = "eh_personality"] extern fn eh_personality() {}
26+
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }

0 commit comments

Comments
 (0)