Skip to content

Commit 588ff71

Browse files
committed
---
yaml --- r: 227723 b: refs/heads/try c: 058a0f0 h: refs/heads/master i: 227721: 5f65e28 227719: c3673e4 v: v3
1 parent cec2d90 commit 588ff71

Some content is hidden

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

66 files changed

+482
-1259
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: a38e7585fc29289581e6cefcdf9e201c3d58ed14
4+
refs/heads/try: 058a0f0b0bb1c39d620f7ce1d81150141c6a6341
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/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/try/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/try/src/doc/trpl/ffi.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -530,37 +530,3 @@ The `extern` makes this function adhere to the C calling convention, as
530530
discussed above in "[Foreign Calling
531531
Conventions](ffi.html#foreign-calling-conventions)". The `no_mangle`
532532
attribute turns off Rust's name mangling, so that it is easier to link to.
533-
534-
# FFI and panics
535-
536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
549-
550-
```rust
551-
use std::thread;
552-
553-
#[no_mangle]
554-
pub extern fn oh_no() -> i32 {
555-
let h = thread::spawn(|| {
556-
panic!("Oops!");
557-
});
558-
559-
match h.join() {
560-
Ok(_) => 1,
561-
Err(_) => 0,
562-
}
563-
}
564-
# fn main() {}
565-
```
566-

branches/try/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/try/src/libcore/num/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,13 +1372,14 @@ macro_rules! from_str_float_impl {
13721372
/// This function accepts strings such as
13731373
///
13741374
/// * '3.14'
1375+
/// * '+3.14', equivalent to '3.14'
13751376
/// * '-3.14'
13761377
/// * '2.5E10', or equivalently, '2.5e10'
13771378
/// * '2.5E-10'
13781379
/// * '.' (understood as 0)
13791380
/// * '5.'
13801381
/// * '.5', or, equivalently, '0.5'
1381-
/// * 'inf', '-inf', 'NaN'
1382+
/// * '+inf', 'inf', '-inf', 'NaN'
13821383
///
13831384
/// Leading and trailing whitespace represent an error.
13841385
///

branches/try/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/try/src/liblibc/lib.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5493,17 +5493,17 @@ pub mod funcs {
54935493
pub fn dup2(src: c_int, dst: c_int) -> c_int;
54945494
#[link_name = "_execv"]
54955495
pub fn execv(prog: *const c_char,
5496-
argv: *mut *const c_char) -> intptr_t;
5496+
argv: *const *const c_char) -> intptr_t;
54975497
#[link_name = "_execve"]
5498-
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5499-
envp: *mut *const c_char)
5498+
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5499+
envp: *const *const c_char)
55005500
-> c_int;
55015501
#[link_name = "_execvp"]
55025502
pub fn execvp(c: *const c_char,
5503-
argv: *mut *const c_char) -> c_int;
5503+
argv: *const *const c_char) -> c_int;
55045504
#[link_name = "_execvpe"]
5505-
pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
5506-
envp: *mut *const c_char) -> c_int;
5505+
pub fn execvpe(c: *const c_char, argv: *const *const c_char,
5506+
envp: *const *const c_char) -> c_int;
55075507
#[link_name = "_getcwd"]
55085508
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
55095509
#[link_name = "_getpid"]
@@ -5687,12 +5687,12 @@ pub mod funcs {
56875687
pub fn dup(fd: c_int) -> c_int;
56885688
pub fn dup2(src: c_int, dst: c_int) -> c_int;
56895689
pub fn execv(prog: *const c_char,
5690-
argv: *mut *const c_char) -> c_int;
5691-
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5692-
envp: *mut *const c_char)
5690+
argv: *const *const c_char) -> c_int;
5691+
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5692+
envp: *const *const c_char)
56935693
-> c_int;
56945694
pub fn execvp(c: *const c_char,
5695-
argv: *mut *const c_char) -> c_int;
5695+
argv: *const *const c_char) -> c_int;
56965696
pub fn fork() -> pid_t;
56975697
pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
56985698
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
@@ -5702,7 +5702,9 @@ pub mod funcs {
57025702
pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
57035703
-> c_int;
57045704
pub fn getlogin() -> *mut c_char;
5705-
pub fn getopt(argc: c_int, argv: *mut *const c_char,
5705+
// GNU getopt(3) modifies its arguments despite the
5706+
// char * const [] prototype; see the manpage.
5707+
pub fn getopt(argc: c_int, argv: *mut *mut c_char,
57065708
optstr: *const c_char) -> c_int;
57075709
pub fn getpgrp() -> pid_t;
57085710
pub fn getpid() -> pid_t;
@@ -5752,19 +5754,19 @@ pub mod funcs {
57525754
pub fn dup(fd: c_int) -> c_int;
57535755
pub fn dup2(src: c_int, dst: c_int) -> c_int;
57545756
pub fn execv(prog: *const c_char,
5755-
argv: *mut *const c_char) -> c_int;
5756-
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5757-
envp: *mut *const c_char)
5757+
argv: *const *const c_char) -> c_int;
5758+
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5759+
envp: *const *const c_char)
57585760
-> c_int;
57595761
pub fn execvp(c: *const c_char,
5760-
argv: *mut *const c_char) -> c_int;
5762+
argv: *const *const c_char) -> c_int;
57615763
pub fn fork() -> pid_t;
57625764
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
57635765
pub fn getegid() -> gid_t;
57645766
pub fn geteuid() -> uid_t;
57655767
pub fn getgid() -> gid_t;
57665768
pub fn getlogin() -> *mut c_char;
5767-
pub fn getopt(argc: c_int, argv: *mut *const c_char,
5769+
pub fn getopt(argc: c_int, argv: *const *const c_char,
57685770
optstr: *const c_char) -> c_int;
57695771
pub fn getuid() -> uid_t;
57705772
pub fn getsid(pid: pid_t) -> pid_t;

branches/try/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/try/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/try/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/try/src/librustc_driver/driver.rs

Lines changed: 9 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
});
@@ -780,11 +778,18 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
780778
pub fn phase_6_link_output(sess: &Session,
781779
trans: &trans::CrateTranslation,
782780
outputs: &OutputFilenames) {
781+
let old_path = env::var_os("PATH").unwrap_or(OsString::new());
782+
let mut new_path = sess.host_filesearch(PathKind::All).get_tools_search_paths();
783+
new_path.extend(env::split_paths(&old_path));
784+
env::set_var("PATH", &env::join_paths(&new_path).unwrap());
785+
783786
time(sess.time_passes(), "linking", (), |_|
784787
link::link_binary(sess,
785788
trans,
786789
outputs,
787790
&trans.link.crate_name));
791+
792+
env::set_var("PATH", &old_path);
788793
}
789794

790795
fn escape_dep_filename(filename: &str) -> String {

branches/try/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 =

0 commit comments

Comments
 (0)