Skip to content

Commit c9852e2

Browse files
committed
Auto merge of #31882 - Manishearth:rollup, r=Manishearth
- Successful merges: #31362, #31793, #31800, #31809, #31818, #31827, #31831, #31835, #31837, #31846 - Failed merges:
2 parents f6f050d + e584a49 commit c9852e2

File tree

26 files changed

+441
-192
lines changed

26 files changed

+441
-192
lines changed

mk/cfg/arm-unknown-linux-gnueabi.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
88
CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
99
CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
11-
CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS)
12-
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS)
11+
CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
12+
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
1313
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
1414
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
1515
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=

mk/cfg/arm-unknown-linux-gnueabihf.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so
88
CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).a
99
CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
11-
CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS)
12-
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS)
11+
CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv6 -marm
12+
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv6 -marm
1313
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
1414
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
1515
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=

src/doc/book/patterns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ struct Person {
303303
}
304304

305305
let name = "Steve".to_string();
306-
let mut x: Option<Person> = Some(Person { name: Some(name) });
306+
let x: Option<Person> = Some(Person { name: Some(name) });
307307
match x {
308308
Some(Person { name: ref a @ Some(_), .. }) => println!("{:?}", a),
309309
_ => {}

src/librustc/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern crate getopts;
5151
extern crate graphviz;
5252
extern crate libc;
5353
extern crate rbml;
54-
extern crate rustc_llvm;
54+
pub extern crate rustc_llvm as llvm;
5555
extern crate rustc_back;
5656
extern crate rustc_front;
5757
extern crate rustc_data_structures;
@@ -66,8 +66,6 @@ extern crate serialize as rustc_serialize; // used by deriving
6666
#[cfg(test)]
6767
extern crate test;
6868

69-
pub use rustc_llvm as llvm;
70-
7169
#[macro_use]
7270
mod macros;
7371

src/librustc/lint/builtin.rs

+7
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ declare_lint! {
124124
"detect private items in public interfaces not caught by the old implementation"
125125
}
126126

127+
declare_lint! {
128+
pub INACCESSIBLE_EXTERN_CRATE,
129+
Warn,
130+
"use of inaccessible extern crate erroneously allowed"
131+
}
132+
127133
declare_lint! {
128134
pub INVALID_TYPE_PARAM_DEFAULT,
129135
Warn,
@@ -167,6 +173,7 @@ impl LintPass for HardwiredLints {
167173
TRIVIAL_CASTS,
168174
TRIVIAL_NUMERIC_CASTS,
169175
PRIVATE_IN_PUBLIC,
176+
INACCESSIBLE_EXTERN_CRATE,
170177
INVALID_TYPE_PARAM_DEFAULT,
171178
MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT,
172179
CONST_ERR,

src/librustc/middle/lang_items.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,13 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
184184
// Check for duplicates.
185185
match self.items.items[item_index] {
186186
Some(original_def_id) if original_def_id != item_def_id => {
187+
let cstore = &self.session.cstore;
187188
span_err!(self.session, span, E0152,
188-
"duplicate entry for `{}`", LanguageItems::item_name(item_index));
189+
"duplicate entry for `{}`, first definition found in `{}`",
190+
LanguageItems::item_name(item_index),
191+
cstore.crate_name(item_def_id.krate));
189192
}
190-
Some(_) | None => {
193+
_ => {
191194
// OK.
192195
}
193196
}

src/librustc/session/config.rs

+117-64
Original file line numberDiff line numberDiff line change
@@ -749,24 +749,20 @@ pub fn build_target_config(opts: &Options, sp: &Handler) -> Config {
749749
}
750750
}
751751

752-
/// Returns the "short" subset of the stable rustc command line options.
753-
pub fn short_optgroups() -> Vec<getopts::OptGroup> {
754-
rustc_short_optgroups().into_iter()
755-
.filter(|g|g.is_stable())
756-
.map(|g|g.opt_group)
757-
.collect()
758-
}
759-
760-
/// Returns all of the stable rustc command line options.
761-
pub fn optgroups() -> Vec<getopts::OptGroup> {
762-
rustc_optgroups().into_iter()
763-
.filter(|g|g.is_stable())
764-
.map(|g|g.opt_group)
765-
.collect()
766-
}
767-
768752
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
769-
pub enum OptionStability { Stable, Unstable }
753+
pub enum OptionStability {
754+
Stable,
755+
756+
// FIXME: historically there were some options which were either `-Z` or
757+
// required the `-Z unstable-options` flag, which were all intended
758+
// to be unstable. Unfortunately we didn't actually gate usage of
759+
// these options on the stable compiler, so we still allow them there
760+
// today. There are some warnings printed out about this in the
761+
// driver.
762+
UnstableButNotReally,
763+
764+
Unstable,
765+
}
770766

771767
#[derive(Clone, PartialEq, Eq)]
772768
pub struct RustcOptGroup {
@@ -783,9 +779,17 @@ impl RustcOptGroup {
783779
RustcOptGroup { opt_group: g, stability: OptionStability::Stable }
784780
}
785781

782+
#[allow(dead_code)] // currently we have no "truly unstable" options
786783
fn unstable(g: getopts::OptGroup) -> RustcOptGroup {
787784
RustcOptGroup { opt_group: g, stability: OptionStability::Unstable }
788785
}
786+
787+
fn unstable_bnr(g: getopts::OptGroup) -> RustcOptGroup {
788+
RustcOptGroup {
789+
opt_group: g,
790+
stability: OptionStability::UnstableButNotReally,
791+
}
792+
}
789793
}
790794

791795
// The `opt` local module holds wrappers around the `getopts` API that
@@ -807,69 +811,102 @@ mod opt {
807811

808812
fn stable(g: getopts::OptGroup) -> R { RustcOptGroup::stable(g) }
809813
fn unstable(g: getopts::OptGroup) -> R { RustcOptGroup::unstable(g) }
814+
fn unstable_bnr(g: getopts::OptGroup) -> R { RustcOptGroup::unstable_bnr(g) }
810815

811-
// FIXME (pnkfelix): We default to stable since the current set of
812-
// options is defacto stable. However, it would be good to revise the
813-
// code so that a stable option is the thing that takes extra effort
814-
// to encode.
815-
816-
pub fn opt(a: S, b: S, c: S, d: S) -> R { stable(getopts::optopt(a, b, c, d)) }
817-
pub fn multi(a: S, b: S, c: S, d: S) -> R { stable(getopts::optmulti(a, b, c, d)) }
818-
pub fn flag(a: S, b: S, c: S) -> R { stable(getopts::optflag(a, b, c)) }
819-
pub fn flagopt(a: S, b: S, c: S, d: S) -> R { stable(getopts::optflagopt(a, b, c, d)) }
820-
pub fn flagmulti(a: S, b: S, c: S) -> R { stable(getopts::optflagmulti(a, b, c)) }
816+
pub fn opt_s(a: S, b: S, c: S, d: S) -> R {
817+
stable(getopts::optopt(a, b, c, d))
818+
}
819+
pub fn multi_s(a: S, b: S, c: S, d: S) -> R {
820+
stable(getopts::optmulti(a, b, c, d))
821+
}
822+
pub fn flag_s(a: S, b: S, c: S) -> R {
823+
stable(getopts::optflag(a, b, c))
824+
}
825+
pub fn flagopt_s(a: S, b: S, c: S, d: S) -> R {
826+
stable(getopts::optflagopt(a, b, c, d))
827+
}
828+
pub fn flagmulti_s(a: S, b: S, c: S) -> R {
829+
stable(getopts::optflagmulti(a, b, c))
830+
}
821831

832+
pub fn opt(a: S, b: S, c: S, d: S) -> R {
833+
unstable(getopts::optopt(a, b, c, d))
834+
}
835+
pub fn multi(a: S, b: S, c: S, d: S) -> R {
836+
unstable(getopts::optmulti(a, b, c, d))
837+
}
838+
pub fn flag(a: S, b: S, c: S) -> R {
839+
unstable(getopts::optflag(a, b, c))
840+
}
841+
pub fn flagopt(a: S, b: S, c: S, d: S) -> R {
842+
unstable(getopts::optflagopt(a, b, c, d))
843+
}
844+
pub fn flagmulti(a: S, b: S, c: S) -> R {
845+
unstable(getopts::optflagmulti(a, b, c))
846+
}
822847

823-
pub fn opt_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optopt(a, b, c, d)) }
824-
pub fn multi_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optmulti(a, b, c, d)) }
825-
pub fn flag_u(a: S, b: S, c: S) -> R { unstable(getopts::optflag(a, b, c)) }
826-
pub fn flagopt_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optflagopt(a, b, c, d)) }
827-
pub fn flagmulti_u(a: S, b: S, c: S) -> R { unstable(getopts::optflagmulti(a, b, c)) }
848+
// Do not use these functions for any new options added to the compiler, all
849+
// new options should use the `*_u` variants above to be truly unstable.
850+
pub fn opt_ubnr(a: S, b: S, c: S, d: S) -> R {
851+
unstable_bnr(getopts::optopt(a, b, c, d))
852+
}
853+
pub fn multi_ubnr(a: S, b: S, c: S, d: S) -> R {
854+
unstable_bnr(getopts::optmulti(a, b, c, d))
855+
}
856+
pub fn flag_ubnr(a: S, b: S, c: S) -> R {
857+
unstable_bnr(getopts::optflag(a, b, c))
858+
}
859+
pub fn flagopt_ubnr(a: S, b: S, c: S, d: S) -> R {
860+
unstable_bnr(getopts::optflagopt(a, b, c, d))
861+
}
862+
pub fn flagmulti_ubnr(a: S, b: S, c: S) -> R {
863+
unstable_bnr(getopts::optflagmulti(a, b, c))
864+
}
828865
}
829866

830867
/// Returns the "short" subset of the rustc command line options,
831868
/// including metadata for each option, such as whether the option is
832869
/// part of the stable long-term interface for rustc.
833870
pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
834871
vec![
835-
opt::flag("h", "help", "Display this message"),
836-
opt::multi("", "cfg", "Configure the compilation environment", "SPEC"),
837-
opt::multi("L", "", "Add a directory to the library search path",
872+
opt::flag_s("h", "help", "Display this message"),
873+
opt::multi_s("", "cfg", "Configure the compilation environment", "SPEC"),
874+
opt::multi_s("L", "", "Add a directory to the library search path",
838875
"[KIND=]PATH"),
839-
opt::multi("l", "", "Link the generated crate(s) to the specified native
876+
opt::multi_s("l", "", "Link the generated crate(s) to the specified native
840877
library NAME. The optional KIND can be one of,
841878
static, dylib, or framework. If omitted, dylib is
842879
assumed.", "[KIND=]NAME"),
843-
opt::multi("", "crate-type", "Comma separated list of types of crates
880+
opt::multi_s("", "crate-type", "Comma separated list of types of crates
844881
for the compiler to emit",
845882
"[bin|lib|rlib|dylib|staticlib]"),
846-
opt::opt("", "crate-name", "Specify the name of the crate being built",
883+
opt::opt_s("", "crate-name", "Specify the name of the crate being built",
847884
"NAME"),
848-
opt::multi("", "emit", "Comma separated list of types of output for \
885+
opt::multi_s("", "emit", "Comma separated list of types of output for \
849886
the compiler to emit",
850887
"[asm|llvm-bc|llvm-ir|obj|link|dep-info]"),
851-
opt::multi("", "print", "Comma separated list of compiler information to \
888+
opt::multi_s("", "print", "Comma separated list of compiler information to \
852889
print on stdout",
853890
"[crate-name|file-names|sysroot|target-list]"),
854-
opt::flagmulti("g", "", "Equivalent to -C debuginfo=2"),
855-
opt::flagmulti("O", "", "Equivalent to -C opt-level=2"),
856-
opt::opt("o", "", "Write output to <filename>", "FILENAME"),
857-
opt::opt("", "out-dir", "Write output to compiler-chosen filename \
891+
opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"),
892+
opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"),
893+
opt::opt_s("o", "", "Write output to <filename>", "FILENAME"),
894+
opt::opt_s("", "out-dir", "Write output to compiler-chosen filename \
858895
in <dir>", "DIR"),
859-
opt::opt("", "explain", "Provide a detailed explanation of an error \
896+
opt::opt_s("", "explain", "Provide a detailed explanation of an error \
860897
message", "OPT"),
861-
opt::flag("", "test", "Build a test harness"),
862-
opt::opt("", "target", "Target triple for which the code is compiled", "TARGET"),
863-
opt::multi("W", "warn", "Set lint warnings", "OPT"),
864-
opt::multi("A", "allow", "Set lint allowed", "OPT"),
865-
opt::multi("D", "deny", "Set lint denied", "OPT"),
866-
opt::multi("F", "forbid", "Set lint forbidden", "OPT"),
867-
opt::multi("", "cap-lints", "Set the most restrictive lint level. \
898+
opt::flag_s("", "test", "Build a test harness"),
899+
opt::opt_s("", "target", "Target triple for which the code is compiled", "TARGET"),
900+
opt::multi_s("W", "warn", "Set lint warnings", "OPT"),
901+
opt::multi_s("A", "allow", "Set lint allowed", "OPT"),
902+
opt::multi_s("D", "deny", "Set lint denied", "OPT"),
903+
opt::multi_s("F", "forbid", "Set lint forbidden", "OPT"),
904+
opt::multi_s("", "cap-lints", "Set the most restrictive lint level. \
868905
More restrictive lints are capped at this \
869906
level", "LEVEL"),
870-
opt::multi("C", "codegen", "Set a codegen option", "OPT[=VALUE]"),
871-
opt::flag("V", "version", "Print version info and exit"),
872-
opt::flag("v", "verbose", "Use verbose output"),
907+
opt::multi_s("C", "codegen", "Set a codegen option", "OPT[=VALUE]"),
908+
opt::flag_s("V", "version", "Print version info and exit"),
909+
opt::flag_s("v", "verbose", "Use verbose output"),
873910
]
874911
}
875912

@@ -879,31 +916,41 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
879916
pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
880917
let mut opts = rustc_short_optgroups();
881918
opts.extend_from_slice(&[
882-
opt::multi("", "extern", "Specify where an external rust library is \
919+
opt::multi_s("", "extern", "Specify where an external rust library is \
883920
located",
884921
"NAME=PATH"),
885-
opt::opt("", "sysroot", "Override the system root", "PATH"),
886-
opt::multi("Z", "", "Set internal debugging options", "FLAG"),
887-
opt::opt_u("", "error-format", "How errors and other messages are produced", "human|json"),
888-
opt::opt("", "color", "Configure coloring of output:
922+
opt::opt_s("", "sysroot", "Override the system root", "PATH"),
923+
opt::multi_ubnr("Z", "", "Set internal debugging options", "FLAG"),
924+
opt::opt_ubnr("", "error-format",
925+
"How errors and other messages are produced",
926+
"human|json"),
927+
opt::opt_s("", "color", "Configure coloring of output:
889928
auto = colorize, if output goes to a tty (default);
890929
always = always colorize output;
891930
never = never colorize output", "auto|always|never"),
892931

893-
opt::flagopt_u("", "pretty",
932+
opt::flagopt_ubnr("", "pretty",
894933
"Pretty-print the input instead of compiling;
895934
valid types are: `normal` (un-annotated source),
896935
`expanded` (crates expanded), or
897936
`expanded,identified` (fully parenthesized, AST nodes with IDs).",
898937
"TYPE"),
899-
opt::flagopt_u("", "unpretty",
938+
opt::flagopt_ubnr("", "unpretty",
900939
"Present the input source, unstable (and less-pretty) variants;
901940
valid types are any of the types for `--pretty`, as well as:
902941
`flowgraph=<nodeid>` (graphviz formatted flowgraph for node),
903942
`everybody_loops` (all function bodies replaced with `loop {}`),
904943
`hir` (the HIR), `hir,identified`, or
905944
`hir,typed` (HIR with types for each node).",
906945
"TYPE"),
946+
947+
// new options here should **not** use the `_ubnr` functions, all new
948+
// unstable options should use the short variants to indicate that they
949+
// are truly unstable. All `_ubnr` flags are just that way because they
950+
// were so historically.
951+
//
952+
// You may also wish to keep this comment at the bottom of this list to
953+
// ensure that others see it.
907954
]);
908955
opts
909956
}
@@ -1242,15 +1289,21 @@ impl fmt::Display for CrateType {
12421289
#[cfg(test)]
12431290
mod tests {
12441291
use middle::cstore::DummyCrateStore;
1245-
use session::config::{build_configuration, optgroups, build_session_options};
1292+
use session::config::{build_configuration, build_session_options};
12461293
use session::build_session;
12471294

12481295
use std::rc::Rc;
1249-
use getopts::getopts;
1296+
use getopts::{getopts, OptGroup};
12501297
use syntax::attr;
12511298
use syntax::attr::AttrMetaMethods;
12521299
use syntax::diagnostics;
12531300

1301+
fn optgroups() -> Vec<OptGroup> {
1302+
super::rustc_optgroups().into_iter()
1303+
.map(|a| a.opt_group)
1304+
.collect()
1305+
}
1306+
12541307
// When the user supplies --test we should implicitly supply --cfg test
12551308
#[test]
12561309
fn test_switch_implies_cfg_test() {

0 commit comments

Comments
 (0)