Skip to content

Commit d766468

Browse files
committed
---
yaml --- r: 219475 b: refs/heads/snap-stage3 c: cb260e5 h: refs/heads/master i: 219473: 9ad7e39 219471: 96c3a9d v: v3
1 parent ac0a137 commit d766468

Some content is hidden

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

61 files changed

+452
-1197
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: ecfcd2a305dfe360f4fbf1776a49d7fc04de3322
3+
refs/heads/snap-stage3: cb260e5e9b43922d74cef1ed784f24a5f38d8633
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# The Rust Programming Language
22

3-
Rust is a fast systems programming language that guarantees
4-
memory safety and offers painless concurrency ([no data races]).
5-
It does not employ a garbage collector and has minimal runtime overhead.
3+
Rust is a systems programming language that is fast, memory safe and
4+
multithreaded, but does not employ a garbage collector or otherwise
5+
impose significant runtime overhead.
66

77
This repo contains the code for `rustc`, the Rust compiler, as well
88
as standard libraries, tools and documentation for Rust.
99

10-
[no data races]: http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html
11-
1210
## Quick Start
1311

1412
Read ["Installing Rust"] from [The Book].

branches/snap-stage3/mk/docs.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
7777

7878
D := $(S)src/doc
7979

80-
DOC_TARGETS := trpl style error-index
80+
# FIXME (#25705) eventually may want to put error-index target back here.
81+
DOC_TARGETS := trpl style
8182
COMPILER_DOC_TARGETS :=
8283
DOC_L10N_TARGETS :=
8384

branches/snap-stage3/mk/reconfig.mk

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ endif
3232

3333
Makefile config.mk: config.stamp
3434

35-
ifeq ($(SREL),)
36-
SREL_ROOT := ./
37-
else
38-
SREL_ROOT := $(SREL)
39-
endif
40-
4135
config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
4236
@$(call E, cfg: reconfiguring)
43-
$(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS)
37+
$(SREL)configure $(CFG_CONFIGURE_ARGS)

branches/snap-stage3/src/error-index-generator/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern crate serialize as rustc_serialize;
1717
use std::collections::BTreeMap;
1818
use std::fs::{read_dir, File};
1919
use std::io::{Read, Write};
20-
use std::env;
2120
use std::path::Path;
2221
use std::error::Error;
2322

@@ -107,8 +106,7 @@ r##"<!DOCTYPE html>
107106
}
108107

109108
fn main_with_result() -> Result<(), Box<Error>> {
110-
let build_arch = try!(env::var("CFG_BUILD"));
111-
let metadata_dir = get_metadata_dir(&build_arch);
109+
let metadata_dir = get_metadata_dir();
112110
let err_map = try!(load_all_errors(&metadata_dir));
113111
try!(render_error_page(&err_map, Path::new("doc/error-index.html")));
114112
Ok(())

branches/snap-stage3/src/libcore/num/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,14 +1372,13 @@ macro_rules! from_str_float_impl {
13721372
/// This function accepts strings such as
13731373
///
13741374
/// * '3.14'
1375-
/// * '+3.14', equivalent to '3.14'
13761375
/// * '-3.14'
13771376
/// * '2.5E10', or equivalently, '2.5e10'
13781377
/// * '2.5E-10'
13791378
/// * '.' (understood as 0)
13801379
/// * '5.'
13811380
/// * '.5', or, equivalently, '0.5'
1382-
/// * '+inf', 'inf', '-inf', 'NaN'
1381+
/// * 'inf', '-inf', 'NaN'
13831382
///
13841383
/// Leading and trailing whitespace represent an error.
13851384
///

branches/snap-stage3/src/libcore/ptr.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,6 @@ impl<T: ?Sized> PartialOrd for *mut T {
512512
#[unstable(feature = "unique", reason = "needs an RFC to flesh out design")]
513513
pub struct Unique<T: ?Sized> {
514514
pointer: NonZero<*const T>,
515-
// NOTE: this marker has no consequences for variance, but is necessary
516-
// for dropck to understand that we logically own a `T`.
517-
//
518-
// For details, see:
519-
// https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md#phantom-data
520515
_marker: PhantomData<T>,
521516
}
522517

branches/snap-stage3/src/librustc/lint/context.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ use self::TargetLint::*;
2828
use middle::privacy::ExportedItems;
2929
use middle::ty::{self, Ty};
3030
use session::{early_error, Session};
31+
use session::config::UnstableFeatures;
3132
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass, LintPassObject};
32-
use lint::{Default, CommandLine, Node, Allow, Warn, Deny, Forbid};
33+
use lint::{Default, CommandLine, Node, Allow, Warn, Deny, Forbid, ReleaseChannel};
3334
use lint::builtin;
3435
use util::nodemap::FnvHashMap;
3536

@@ -207,6 +208,23 @@ impl LintStore {
207208
}
208209
}
209210
}
211+
212+
fn maybe_stage_features(&mut self, sess: &Session) {
213+
let lvl = match sess.opts.unstable_features {
214+
UnstableFeatures::Default => return,
215+
UnstableFeatures::Disallow => Forbid,
216+
UnstableFeatures::Cheat => Allow
217+
};
218+
match self.by_name.get("unstable_features") {
219+
Some(&Id(lint_id)) => if self.get_level_source(lint_id).0 != Forbid {
220+
self.set_level(lint_id, (lvl, ReleaseChannel))
221+
},
222+
Some(&Renamed(_, lint_id)) => if self.get_level_source(lint_id).0 != Forbid {
223+
self.set_level(lint_id, (lvl, ReleaseChannel))
224+
},
225+
None => unreachable!()
226+
}
227+
}
210228
}
211229

212230
/// Context for lint checking.
@@ -290,6 +308,7 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
290308

291309
let name = lint.name_lower();
292310
let mut def = None;
311+
let mut note = None;
293312
let msg = match source {
294313
Default => {
295314
format!("{}, #[{}({})] on by default", msg,
@@ -306,6 +325,12 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
306325
def = Some(src);
307326
msg.to_string()
308327
}
328+
ReleaseChannel => {
329+
let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)");
330+
note = Some(format!("this feature may not be used in the {} release channel",
331+
release_channel));
332+
msg.to_string()
333+
}
309334
};
310335

311336
// For purposes of printing, we can treat forbid as deny.
@@ -319,6 +344,10 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
319344
_ => sess.bug("impossible level in raw_emit_lint"),
320345
}
321346

347+
if let Some(note) = note {
348+
sess.note(&note[..]);
349+
}
350+
322351
if let Some(span) = def {
323352
sess.span_note(span, "lint level defined here");
324353
}
@@ -660,6 +689,9 @@ impl LintPass for GatherNodeLevels {
660689
pub fn check_crate(tcx: &ty::ctxt,
661690
exported_items: &ExportedItems) {
662691

692+
// If this is a feature-staged build of rustc then flip several lints to 'forbid'
693+
tcx.sess.lint_store.borrow_mut().maybe_stage_features(&tcx.sess);
694+
663695
let krate = tcx.map.krate();
664696
let mut cx = Context::new(tcx, krate, exported_items);
665697

branches/snap-stage3/src/librustc/lint/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ pub enum LintSource {
247247

248248
/// Lint level was set by a command-line flag.
249249
CommandLine,
250+
251+
/// Lint level was set by the release channel.
252+
ReleaseChannel
250253
}
251254

252255
pub type LevelSource = (Level, LintSource);

branches/snap-stage3/src/librustc/session/config.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use syntax::attr::AttrMetaMethods;
3232
use syntax::diagnostic::{ColorConfig, Auto, Always, Never, SpanHandler};
3333
use syntax::parse;
3434
use syntax::parse::token::InternedString;
35-
use syntax::feature_gate::UnstableFeatures;
3635

3736
use getopts;
3837
use std::collections::HashMap;
@@ -120,6 +119,21 @@ pub struct Options {
120119
pub unstable_features: UnstableFeatures
121120
}
122121

122+
#[derive(Clone, Copy)]
123+
pub enum UnstableFeatures {
124+
/// Hard errors for unstable features are active, as on
125+
/// beta/stable channels.
126+
Disallow,
127+
/// Use the default lint levels
128+
Default,
129+
/// Errors are bypassed for bootstrapping. This is required any time
130+
/// during the build that feature-related lints are set to warn or above
131+
/// because the build turns on warnings-as-errors and uses lots of unstable
132+
/// features. As a result, this this is always required for building Rust
133+
/// itself.
134+
Cheat
135+
}
136+
123137
#[derive(Clone, PartialEq, Eq)]
124138
pub enum PrintRequest {
125139
FileNames,
@@ -1060,7 +1074,7 @@ pub fn get_unstable_features_setting() -> UnstableFeatures {
10601074
match (disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
10611075
(_, Some(ref s), Some(ref p)) if s == p => UnstableFeatures::Cheat,
10621076
(true, _, _) => UnstableFeatures::Disallow,
1063-
(false, _, _) => UnstableFeatures::Allow
1077+
(false, _, _) => UnstableFeatures::Default
10641078
}
10651079
}
10661080

branches/snap-stage3/src/librustc_driver/driver.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
528528
let features =
529529
syntax::feature_gate::check_crate(sess.codemap(),
530530
&sess.parse_sess.span_diagnostic,
531-
&krate, &attributes,
532-
sess.opts.unstable_features);
531+
&krate, &attributes);
533532
*sess.features.borrow_mut() = features;
534533
sess.abort_if_errors();
535534
});
@@ -559,8 +558,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
559558
let features =
560559
syntax::feature_gate::check_crate(sess.codemap(),
561560
&sess.parse_sess.span_diagnostic,
562-
&krate, &attributes,
563-
sess.opts.unstable_features);
561+
&krate, &attributes);
564562
*sess.features.borrow_mut() = features;
565563
sess.abort_if_errors();
566564
});

branches/snap-stage3/src/librustc_driver/test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use syntax::codemap;
3535
use syntax::codemap::{Span, CodeMap, DUMMY_SP};
3636
use syntax::diagnostic::{Level, RenderSpan, Bug, Fatal, Error, Warning, Note, Help};
3737
use syntax::parse::token;
38-
use syntax::feature_gate::UnstableFeatures;
3938

4039
struct Env<'a, 'tcx: 'a> {
4140
infcx: &'a infer::InferCtxt<'a, 'tcx>,
@@ -103,7 +102,6 @@ fn test_env<F>(source_string: &str,
103102
let mut options =
104103
config::basic_options();
105104
options.debugging_opts.verbose = true;
106-
options.unstable_features = UnstableFeatures::Allow;
107105
let codemap =
108106
CodeMap::new();
109107
let diagnostic_handler =

branches/snap-stage3/src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ pub struct UnstableFeatures;
22132213
declare_lint! {
22142214
UNSTABLE_FEATURES,
22152215
Allow,
2216-
"enabling unstable features (deprecated. do not use)"
2216+
"enabling unstable features"
22172217
}
22182218

22192219
impl LintPass for UnstableFeatures {

branches/snap-stage3/src/librustc_llvm/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,18 +2252,6 @@ pub fn get_param(llfn: ValueRef, index: c_uint) -> ValueRef {
22522252
}
22532253
}
22542254

2255-
pub fn get_params(llfn: ValueRef) -> Vec<ValueRef> {
2256-
unsafe {
2257-
let num_params = LLVMCountParams(llfn);
2258-
let mut params = Vec::with_capacity(num_params as usize);
2259-
for idx in 0..num_params {
2260-
params.push(LLVMGetParam(llfn, idx));
2261-
}
2262-
2263-
params
2264-
}
2265-
}
2266-
22672255
#[allow(missing_copy_implementations)]
22682256
pub enum RustString_opaque {}
22692257
pub type RustStringRef = *mut RustString_opaque;

branches/snap-stage3/src/librustc_trans/trans/_match.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -828,11 +828,19 @@ fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
828828
None,
829829
&format!("comparison of `{}`", rhs_t),
830830
StrEqFnLangItem);
831-
let lhs_data = Load(cx, expr::get_dataptr(cx, lhs));
832-
let lhs_len = Load(cx, expr::get_len(cx, lhs));
833-
let rhs_data = Load(cx, expr::get_dataptr(cx, rhs));
834-
let rhs_len = Load(cx, expr::get_len(cx, rhs));
835-
callee::trans_lang_call(cx, did, &[lhs_data, lhs_len, rhs_data, rhs_len], None, debug_loc)
831+
let t = ty::mk_str_slice(cx.tcx(), cx.tcx().mk_region(ty::ReStatic), ast::MutImmutable);
832+
// The comparison function gets the slices by value, so we have to make copies here. Even
833+
// if the function doesn't write through the pointer, things like lifetime intrinsics
834+
// require that we do this properly
835+
let lhs_arg = alloc_ty(cx, t, "lhs");
836+
let rhs_arg = alloc_ty(cx, t, "rhs");
837+
memcpy_ty(cx, lhs_arg, lhs, t);
838+
memcpy_ty(cx, rhs_arg, rhs, t);
839+
let res = callee::trans_lang_call(cx, did, &[lhs_arg, rhs_arg], None, debug_loc);
840+
call_lifetime_end(res.bcx, lhs_arg);
841+
call_lifetime_end(res.bcx, rhs_arg);
842+
843+
res
836844
}
837845

838846
let _icx = push_ctxt("compare_values");

branches/snap-stage3/src/librustc_trans/trans/asm.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,32 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
4545
output_types.push(type_of::type_of(bcx.ccx(), out_datum.ty));
4646
let val = out_datum.val;
4747
if is_rw {
48-
bcx = callee::trans_arg_datum(bcx,
49-
expr_ty(bcx, &**out),
50-
out_datum,
51-
cleanup::CustomScope(temp_scope),
52-
callee::DontAutorefArg,
53-
&mut ext_inputs);
48+
ext_inputs.push(unpack_result!(bcx, {
49+
callee::trans_arg_datum(bcx,
50+
expr_ty(bcx, &**out),
51+
out_datum,
52+
cleanup::CustomScope(temp_scope),
53+
callee::DontAutorefArg)
54+
}));
5455
ext_constraints.push(i.to_string());
5556
}
5657
val
5758

5859
}).collect::<Vec<_>>();
5960

6061
// Now the input operands
61-
let mut inputs = Vec::new();
62-
for &(ref c, ref input) in &ia.inputs {
62+
let mut inputs = ia.inputs.iter().map(|&(ref c, ref input)| {
6363
constraints.push((*c).clone());
6464

6565
let in_datum = unpack_datum!(bcx, expr::trans(bcx, &**input));
66-
bcx = callee::trans_arg_datum(bcx,
66+
unpack_result!(bcx, {
67+
callee::trans_arg_datum(bcx,
6768
expr_ty(bcx, &**input),
6869
in_datum,
6970
cleanup::CustomScope(temp_scope),
70-
callee::DontAutorefArg,
71-
&mut inputs);
72-
}
71+
callee::DontAutorefArg)
72+
})
73+
}).collect::<Vec<_>>();
7374
inputs.push_all(&ext_inputs[..]);
7475

7576
// no failure occurred preparing operands, no need to cleanup

0 commit comments

Comments
 (0)