Skip to content

Commit c1ec5bb

Browse files
committed
---
yaml --- r: 278003 b: refs/heads/auto c: 237eb72 h: refs/heads/master i: 278001: 243cc7f 277999: a573c2b
1 parent 4133cac commit c1ec5bb

File tree

193 files changed

+2748
-3844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+2748
-3844
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 51a3a8f5230e6c77b4ecea397742fcf51ff5b749
11+
refs/heads/auto: 237eb7285e5c2d47e4cfdb75116d9ad8e296a6f8
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/doc/book/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ we’ll talk about Cargo, Rust’s build system and package manager.
88

99
The first step to using Rust is to install it. Generally speaking, you’ll need
1010
an Internet connection to run the commands in this section, as we’ll be
11-
downloading Rust from the Internet.
11+
downloading Rust from the internet.
1212

1313
We’ll be showing off a number of commands using a terminal, and those lines all
1414
start with `$`. We don't need to type in the `$`s, they are there to indicate
@@ -399,13 +399,13 @@ Let’s convert the Hello World program to Cargo. To Cargo-fy a project, you nee
399399
to do three things:
400400

401401
1. Put your source file in the right directory.
402-
2. Get rid of the old executable (`main.exe` on Windows, `main` everywhere
403-
else).
402+
2. Get rid of the old executable (`main.exe` on Windows, `main` everywhere else)
403+
and make a new one.
404404
3. Make a Cargo configuration file.
405405

406406
Let's get started!
407407

408-
### Creating a Source Directory and Removing the Old Executable
408+
### Creating a new Executable and Source Directory
409409

410410
First, go back to your terminal, move to your *hello_world* directory, and
411411
enter the following commands:

branches/auto/src/libcollections/fmt.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
//! precision := count | '*'
334334
//! type := identifier | ''
335335
//! count := parameter | integer
336-
//! parameter := argument '$'
336+
//! parameter := integer '$'
337337
//! ```
338338
//!
339339
//! # Formatting Parameters
@@ -403,12 +403,11 @@
403403
//! println!("Hello {:5}!", "x");
404404
//! println!("Hello {:1$}!", "x", 5);
405405
//! println!("Hello {1:0$}!", 5, "x");
406-
//! println!("Hello {:width$}!", "x", width = 5);
407406
//! ```
408407
//!
409408
//! Referring to an argument with the dollar syntax does not affect the "next
410-
//! argument" counter, so it's usually a good idea to refer to arguments by
411-
//! position, or use named arguments.
409+
//! argument" counter, so it's usually a good idea to refer to all arguments by
410+
//! their position explicitly.
412411
//!
413412
//! ## Precision
414413
//!
@@ -427,7 +426,7 @@
427426
//!
428427
//! the integer `N` itself is the precision.
429428
//!
430-
//! 2. An integer or name followed by dollar sign `.N$`:
429+
//! 2. An integer followed by dollar sign `.N$`:
431430
//!
432431
//! use format *argument* `N` (which must be a `usize`) as the precision.
433432
//!
@@ -457,10 +456,6 @@
457456
//! // Hello {next arg (x)} is {arg 2 (0.01) with precision
458457
//! // specified in its predecessor (5)}
459458
//! println!("Hello {} is {2:.*}", "x", 5, 0.01);
460-
//!
461-
//! // Hello {next arg (x)} is {arg "number" (0.01) with precision specified
462-
//! // in arg "prec" (5)}
463-
//! println!("Hello {} is {number:.prec$}", "x", prec = 5, number = 0.01);
464459
//! ```
465460
//!
466461
//! All print the same thing:

branches/auto/src/libcore/intrinsics.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ extern "rust-intrinsic" {
192192

193193
/// The size of a type in bytes.
194194
///
195-
/// More specifically, this is the offset in bytes between successive
196-
/// items of the same type, including alignment padding.
195+
/// This is the exact number of bytes in memory taken up by a
196+
/// value of the given type. In other words, a memset of this size
197+
/// would *exactly* overwrite a value. When laid out in vectors
198+
/// and structures there may be additional padding between
199+
/// elements.
197200
pub fn size_of<T>() -> usize;
198201

199202
/// Moves a value to an uninitialized memory location.

branches/auto/src/libcore/mem.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ pub use intrinsics::transmute;
110110
/// }
111111
/// }
112112
/// ```
113+
#[inline]
113114
#[stable(feature = "rust1", since = "1.0.0")]
114115
pub fn forget<T>(t: T) {
115116
unsafe { intrinsics::forget(t) }
116117
}
117118

118119
/// Returns the size of a type in bytes.
119120
///
120-
/// More specifically, this is the offset in bytes between successive
121-
/// items of the same type, including alignment padding.
122-
///
123121
/// # Examples
124122
///
125123
/// ```

branches/auto/src/librustc/diagnostics.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,7 @@ fn foo(x: u8) -> u8 {
635635
```
636636
637637
It is advisable to find out what the unhandled cases are and check for them,
638-
returning an appropriate value or panicking if necessary. Check if you need
639-
to remove a semicolon from the last expression, like in this case:
640-
641-
```ignore
642-
fn foo(x: u8) -> u8 {
643-
inner(2*x + 1);
644-
}
645-
```
646-
647-
The semicolon discards the return value of `inner`, instead of returning
648-
it from `foo`.
638+
returning an appropriate value or panicking if necessary.
649639
"##,
650640

651641
E0270: r##"
@@ -1579,5 +1569,5 @@ register_diagnostics! {
15791569
E0490, // a value of type `..` is borrowed for too long
15801570
E0491, // in type `..`, reference has a longer lifetime than the data it...
15811571
E0495, // cannot infer an appropriate lifetime due to conflicting requirements
1582-
E0525, // expected a closure that implements `..` but this closure only implements `..`
1572+
E0524, // expected a closure that implements `..` but this closure only implements `..`
15831573
}

branches/auto/src/librustc/infer/error_reporting.rs

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ pub trait ErrorReporting<'tcx> {
249249
terr: &TypeError<'tcx>)
250250
-> DiagnosticBuilder<'tcx>;
251251

252-
fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<(String, String)>;
252+
fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String>;
253253

254254
fn expected_found_str<T: fmt::Display + Resolvable<'tcx> + TypeFoldable<'tcx>>(
255255
&self,
256256
exp_found: &ty::error::ExpectedFound<T>)
257-
-> Option<(String, String)>;
257+
-> Option<String>;
258258

259259
fn report_concrete_failure(&self,
260260
origin: SubregionOrigin<'tcx>,
@@ -535,7 +535,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
535535
trace: TypeTrace<'tcx>,
536536
terr: &TypeError<'tcx>)
537537
-> DiagnosticBuilder<'tcx> {
538-
let (expected, found) = match self.values_str(&trace.values) {
538+
let expected_found_str = match self.values_str(&trace.values) {
539539
Some(v) => v,
540540
None => {
541541
return self.tcx.sess.diagnostic().struct_dummy(); /* derived error */
@@ -548,17 +548,18 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
548548
false
549549
};
550550

551+
let expected_found_str = if is_simple_error {
552+
expected_found_str
553+
} else {
554+
format!("{} ({})", expected_found_str, terr)
555+
};
556+
551557
let mut err = struct_span_err!(self.tcx.sess,
552558
trace.origin.span(),
553559
E0308,
554-
"{}",
555-
trace.origin);
556-
557-
if !is_simple_error {
558-
err = err.note_expected_found(&"type", &expected, &found);
559-
}
560-
561-
err = err.span_label(trace.origin.span(), &terr);
560+
"{}: {}",
561+
trace.origin,
562+
expected_found_str);
562563

563564
self.check_and_note_conflicting_crates(&mut err, terr, trace.origin.span());
564565

@@ -573,7 +574,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
573574
},
574575
_ => ()
575576
}
576-
577577
err
578578
}
579579

@@ -631,7 +631,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
631631

632632
/// Returns a string of the form "expected `{}`, found `{}`", or None if this is a derived
633633
/// error.
634-
fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<(String, String)> {
634+
fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String> {
635635
match *values {
636636
infer::Types(ref exp_found) => self.expected_found_str(exp_found),
637637
infer::TraitRefs(ref exp_found) => self.expected_found_str(exp_found),
@@ -642,7 +642,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
642642
fn expected_found_str<T: fmt::Display + Resolvable<'tcx> + TypeFoldable<'tcx>>(
643643
&self,
644644
exp_found: &ty::error::ExpectedFound<T>)
645-
-> Option<(String, String)>
645+
-> Option<String>
646646
{
647647
let expected = exp_found.expected.resolve(self);
648648
if expected.references_error() {
@@ -654,7 +654,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
654654
return None;
655655
}
656656

657-
Some((format!("{}", expected), format!("{}", found)))
657+
Some(format!("expected `{}`, found `{}`",
658+
expected,
659+
found))
658660
}
659661

660662
fn report_generic_bound_failure(&self,
@@ -682,9 +684,10 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
682684
E0309,
683685
"{} may not live long enough",
684686
labeled_user_string);
685-
err.help(&format!("consider adding an explicit lifetime bound `{}: {}`...",
686-
bound_kind,
687-
sub));
687+
err.fileline_help(origin.span(),
688+
&format!("consider adding an explicit lifetime bound `{}: {}`...",
689+
bound_kind,
690+
sub));
688691
err
689692
}
690693

@@ -695,9 +698,10 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
695698
E0310,
696699
"{} may not live long enough",
697700
labeled_user_string);
698-
err.help(&format!("consider adding an explicit lifetime \
699-
bound `{}: 'static`...",
700-
bound_kind));
701+
err.fileline_help(origin.span(),
702+
&format!("consider adding an explicit lifetime \
703+
bound `{}: 'static`...",
704+
bound_kind));
701705
err
702706
}
703707

@@ -708,8 +712,9 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
708712
E0311,
709713
"{} may not live long enough",
710714
labeled_user_string);
711-
err.help(&format!("consider adding an explicit lifetime bound for `{}`",
712-
bound_kind));
715+
err.fileline_help(origin.span(),
716+
&format!("consider adding an explicit lifetime bound for `{}`",
717+
bound_kind));
713718
self.tcx.note_and_explain_region(
714719
&mut err,
715720
&format!("{} must be valid for ", labeled_user_string),
@@ -1746,11 +1751,11 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
17461751
};
17471752

17481753
match self.values_str(&trace.values) {
1749-
Some((expected, found)) => {
1754+
Some(values_str) => {
17501755
err.span_note(
17511756
trace.origin.span(),
1752-
&format!("...so that {} (expected {}, found {})",
1753-
desc, expected, found));
1757+
&format!("...so that {} ({})",
1758+
desc, values_str));
17541759
}
17551760
None => {
17561761
// Really should avoid printing this error at

branches/auto/src/librustc/lint/context.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,17 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
456456
it will become a hard error in a future release!");
457457
let citation = format!("for more information, see {}",
458458
future_incompatible.reference);
459-
err.warn(&explanation);
460-
err.note(&citation);
459+
if let Some(sp) = span {
460+
err.fileline_warn(sp, &explanation);
461+
err.fileline_note(sp, &citation);
462+
} else {
463+
err.warn(&explanation);
464+
err.note(&citation);
465+
}
461466
}
462467

463468
if let Some(span) = def {
464-
let explanation = "lint level defined here";
465-
err.span_note(span, &explanation);
469+
err.span_note(span, "lint level defined here");
466470
}
467471

468472
err
@@ -538,7 +542,7 @@ pub trait LintContext: Sized {
538542
let mut err = self.lookup(lint, Some(span), msg);
539543
if self.current_level(lint) != Level::Allow {
540544
if note_span == span {
541-
err.note(note);
545+
err.fileline_note(note_span, note);
542546
} else {
543547
err.span_note(note_span, note);
544548
}

branches/auto/src/librustc/session/config.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ pub enum OptLevel {
4848
No, // -O0
4949
Less, // -O1
5050
Default, // -O2
51-
Aggressive, // -O3
52-
Size, // -Os
53-
SizeMin, // -Oz
51+
Aggressive // -O3
5452
}
5553

5654
#[derive(Clone, Copy, PartialEq)]
@@ -569,8 +567,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
569567
debuginfo: Option<usize> = (None, parse_opt_uint,
570568
"debug info emission level, 0 = no debug info, 1 = line tables only, \
571569
2 = full debug info with variable and type information"),
572-
opt_level: Option<String> = (None, parse_opt_string,
573-
"optimize with possible levels 0-3, s, or z"),
570+
opt_level: Option<usize> = (None, parse_opt_uint,
571+
"optimize with possible levels 0-3"),
574572
debug_assertions: Option<bool> = (None, parse_opt_bool,
575573
"explicitly enable the cfg(debug_assertions) directive"),
576574
inline_threshold: Option<usize> = (None, parse_opt_uint,
@@ -1127,20 +1125,13 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
11271125
}
11281126
OptLevel::Default
11291127
} else {
1130-
match (cg.opt_level.as_ref().map(String::as_ref),
1131-
nightly_options::is_nightly_build()) {
1132-
(None, _) => OptLevel::No,
1133-
(Some("0"), _) => OptLevel::No,
1134-
(Some("1"), _) => OptLevel::Less,
1135-
(Some("2"), _) => OptLevel::Default,
1136-
(Some("3"), _) => OptLevel::Aggressive,
1137-
(Some("s"), true) => OptLevel::Size,
1138-
(Some("z"), true) => OptLevel::SizeMin,
1139-
(Some("s"), false) | (Some("z"), false) => {
1140-
early_error(error_format, &format!("the optimizations s or z are only \
1141-
accepted on the nightly compiler"));
1142-
},
1143-
(Some(arg), _) => {
1128+
match cg.opt_level {
1129+
None => OptLevel::No,
1130+
Some(0) => OptLevel::No,
1131+
Some(1) => OptLevel::Less,
1132+
Some(2) => OptLevel::Default,
1133+
Some(3) => OptLevel::Aggressive,
1134+
Some(arg) => {
11441135
early_error(error_format, &format!("optimization level needs to be \
11451136
between 0-3 (instead was `{}`)",
11461137
arg));
@@ -1313,7 +1304,7 @@ pub mod nightly_options {
13131304
is_nightly_build() && matches.opt_strs("Z").iter().any(|x| *x == "unstable-options")
13141305
}
13151306

1316-
pub fn is_nightly_build() -> bool {
1307+
fn is_nightly_build() -> bool {
13171308
match get_unstable_features_setting() {
13181309
UnstableFeatures::Allow | UnstableFeatures::Cheat => true,
13191310
_ => false,

branches/auto/src/librustc/session/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ pub fn early_error(output: config::ErrorOutputType, msg: &str) -> ! {
567567
}
568568
config::ErrorOutputType::Json => Box::new(JsonEmitter::basic()),
569569
};
570-
emitter.emit(&MultiSpan::new(), msg, None, errors::Level::Fatal);
570+
emitter.emit(None, msg, None, errors::Level::Fatal);
571571
panic!(errors::FatalError);
572572
}
573573

@@ -578,7 +578,7 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) {
578578
}
579579
config::ErrorOutputType::Json => Box::new(JsonEmitter::basic()),
580580
};
581-
emitter.emit(&MultiSpan::new(), msg, None, errors::Level::Warning);
581+
emitter.emit(None, msg, None, errors::Level::Warning);
582582
}
583583

584584
// Err(0) means compilation was stopped, but no errors were found.

0 commit comments

Comments
 (0)