Skip to content

Commit 1f4e317

Browse files
committed
Auto merge of #30929 - Manishearth:rollup, r=Manishearth
- Successful merges: #30591, #30781, #30836, #30864, #30896, #30898, #30908, #30921, #30925 - Failed merges:
2 parents a70a60a + 4f8d584 commit 1f4e317

Some content is hidden

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

46 files changed

+600
-224
lines changed

configure

+9-4
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,18 @@ case $CFG_CPUTYPE in
499499
CFG_CPUTYPE=aarch64
500500
;;
501501

502-
# At some point, when ppc64[le] support happens, this will need to do
503-
# something clever. For now it's safe to assume that we're only ever
504-
# interested in building 32 bit.
505-
powerpc | ppc | ppc64)
502+
powerpc | ppc)
506503
CFG_CPUTYPE=powerpc
507504
;;
508505

506+
powerpc64 | ppc64)
507+
CFG_CPUTYPE=powerpc64
508+
;;
509+
510+
powerpc64le | ppc64le)
511+
CFG_CPUTYPE=powerpc64le
512+
;;
513+
509514
x86_64 | x86-64 | x64 | amd64)
510515
CFG_CPUTYPE=x86_64
511516
;;

mk/cfg/powerpc64-unknown-linux-gnu.mk

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# powerpc64-unknown-linux-gnu configuration
2+
CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc64-linux-gnu-
3+
CC_powerpc64-unknown-linux-gnu=$(CC)
4+
CXX_powerpc64-unknown-linux-gnu=$(CXX)
5+
CPP_powerpc64-unknown-linux-gnu=$(CPP)
6+
AR_powerpc64-unknown-linux-gnu=$(AR)
7+
CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
8+
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
9+
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
15+
CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
16+
CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu :=
17+
CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu =
18+
CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu =
19+
CFG_WINDOWSY_powerpc64-unknown-linux-gnu :=
20+
CFG_UNIXY_powerpc64-unknown-linux-gnu := 1
21+
CFG_LDPATH_powerpc64-unknown-linux-gnu :=
22+
CFG_RUN_powerpc64-unknown-linux-gnu=$(2)
23+
CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2))
24+
CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# powerpc64le-unknown-linux-gnu configuration
2+
CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu-
3+
CC_powerpc64le-unknown-linux-gnu=$(CC)
4+
CXX_powerpc64le-unknown-linux-gnu=$(CXX)
5+
CPP_powerpc64le-unknown-linux-gnu=$(CPP)
6+
AR_powerpc64le-unknown-linux-gnu=$(AR)
7+
CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so
8+
CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a
9+
CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so
10+
CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS)
12+
CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
13+
CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
14+
CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
15+
CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
16+
CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu :=
17+
CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu =
18+
CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu =
19+
CFG_WINDOWSY_powerpc64le-unknown-linux-gnu :=
20+
CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1
21+
CFG_LDPATH_powerpc64le-unknown-linux-gnu :=
22+
CFG_RUN_powerpc64le-unknown-linux-gnu=$(2)
23+
CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2))
24+
CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu

src/compiletest/util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
3838
("mips", "mips"),
3939
("msp430", "msp430"),
4040
("powerpc", "powerpc"),
41+
("powerpc64", "powerpc64"),
42+
("powerpc64le", "powerpc64le"),
4143
("s390x", "systemz"),
4244
("sparc", "sparc"),
4345
("x86_64", "x86_64"),

src/doc/book/crates-and-modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
When a project starts getting large, it’s considered good software
44
engineering practice to split it up into a bunch of smaller pieces, and then
5-
fit them together. It’s also important to have a well-defined interface, so
5+
fit them together. It is also important to have a well-defined interface, so
66
that some of your functionality is private, and some is public. To facilitate
77
these kinds of things, Rust has a module system.
88

src/doc/book/getting-started.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,11 @@ Cargo checks to see if any of your project’s files have been modified, and onl
505505
rebuilds your project if they’ve changed since the last time you built it.
506506

507507
With simple projects, Cargo doesn't bring a whole lot over just using `rustc`,
508-
but it will become useful in future. With complex projects composed of multiple
509-
crates, it’s much easier to let Cargo coordinate the build. With Cargo, you can
510-
run `cargo build`, and it should work the right way.
508+
but it will become useful in future. This is especially true when you start
509+
using crates; these are synonymous with a ‘library’ or ‘package’ in other
510+
programming languages. For complex projects composed of multiple crates, it’s
511+
much easier to let Cargo coordinate the build. Using Cargo, you can run `cargo
512+
build`, and it should work the right way.
511513

512514
## Building for Release
513515

src/doc/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ The following configurations must be defined by the implementation:
20442044
production. For example, it controls the behavior of the standard library's
20452045
`debug_assert!` macro.
20462046
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
2047-
`"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`.
2047+
`"mips"`, `"powerpc"`, `"powerpc64"`, `"powerpc64le"`, `"arm"`, or `"aarch64"`.
20482048
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
20492049
`"big"`.
20502050
* `target_env = ".."` - An option provided by the compiler by default

src/liballoc_jemalloc/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ extern "C" {
5555
const MIN_ALIGN: usize = 8;
5656
#[cfg(all(any(target_arch = "x86",
5757
target_arch = "x86_64",
58-
target_arch = "aarch64")))]
58+
target_arch = "aarch64",
59+
target_arch = "powerpc64",
60+
target_arch = "powerpc64le")))]
5961
const MIN_ALIGN: usize = 16;
6062

6163
// MALLOCX_ALIGN(a) macro

src/liballoc_system/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ extern crate libc;
2929
target_arch = "arm",
3030
target_arch = "mips",
3131
target_arch = "mipsel",
32-
target_arch = "powerpc")))]
32+
target_arch = "powerpc",
33+
target_arch = "powerpc64",
34+
target_arch = "powerpc64le")))]
3335
const MIN_ALIGN: usize = 8;
3436
#[cfg(all(any(target_arch = "x86_64",
3537
target_arch = "aarch64")))]

src/librustc/lint/builtin.rs

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
1717
use lint::{LintPass, LateLintPass, LintArray};
1818

19-
// name of the future-incompatible group
20-
pub const FUTURE_INCOMPATIBLE: &'static str = "future_incompatible";
21-
2219
declare_lint! {
2320
pub CONST_ERR,
2421
Warn,

src/librustc/lint/context.rs

+37-6
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,22 @@ pub struct LintStore {
7676
/// is true if the lint group was added by a plugin.
7777
lint_groups: FnvHashMap<&'static str, (Vec<LintId>, bool)>,
7878

79+
/// Extra info for future incompatibility lints, descibing the
80+
/// issue or RFC that caused the incompatibility.
81+
future_incompatible: FnvHashMap<LintId, FutureIncompatibleInfo>,
82+
7983
/// Maximum level a lint can be
8084
lint_cap: Option<Level>,
8185
}
8286

87+
/// Extra information for a future incompatibility lint. See the call
88+
/// to `register_future_incompatible` in `librustc_lint/lib.rs` for
89+
/// guidelines.
90+
pub struct FutureIncompatibleInfo {
91+
pub id: LintId,
92+
pub reference: &'static str // e.g., a URL for an issue/PR/RFC or error code
93+
}
94+
8395
/// The targed of the `by_name` map, which accounts for renaming/deprecation.
8496
enum TargetLint {
8597
/// A direct lint target
@@ -124,6 +136,7 @@ impl LintStore {
124136
late_passes: Some(vec!()),
125137
by_name: FnvHashMap(),
126138
levels: FnvHashMap(),
139+
future_incompatible: FnvHashMap(),
127140
lint_groups: FnvHashMap(),
128141
lint_cap: None,
129142
}
@@ -183,6 +196,20 @@ impl LintStore {
183196
}
184197
}
185198

199+
pub fn register_future_incompatible(&mut self,
200+
sess: Option<&Session>,
201+
lints: Vec<FutureIncompatibleInfo>) {
202+
let ids = lints.iter().map(|f| f.id).collect();
203+
self.register_group(sess, false, "future_incompatible", ids);
204+
for info in lints {
205+
self.future_incompatible.insert(info.id, info);
206+
}
207+
}
208+
209+
pub fn future_incompatible(&self, id: LintId) -> Option<&FutureIncompatibleInfo> {
210+
self.future_incompatible.get(&id)
211+
}
212+
186213
pub fn register_group(&mut self, sess: Option<&Session>,
187214
from_plugin: bool, name: &'static str,
188215
to: Vec<LintId>) {
@@ -418,14 +445,18 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
418445
};
419446

420447
// Check for future incompatibility lints and issue a stronger warning.
421-
let future_incompat_lints = &lints.lint_groups[builtin::FUTURE_INCOMPATIBLE];
422-
let this_id = LintId::of(lint);
423-
if future_incompat_lints.0.iter().any(|&id| id == this_id) {
424-
let msg = "this lint will become a HARD ERROR in a future release!";
448+
if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) {
449+
let explanation = format!("this was previously accepted by the compiler \
450+
but is being phased out; \
451+
it will become a hard error in a future release!");
452+
let citation = format!("for more information, see {}",
453+
future_incompatible.reference);
425454
if let Some(sp) = span {
426-
err.span_note(sp, msg);
455+
err.fileline_warn(sp, &explanation);
456+
err.fileline_note(sp, &citation);
427457
} else {
428-
err.note(msg);
458+
err.warn(&explanation);
459+
err.note(&citation);
429460
}
430461
}
431462

src/librustc/lint/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use rustc_front::hir;
4141

4242
pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
4343
raw_emit_lint, check_crate, check_ast_crate, gather_attrs,
44-
raw_struct_lint, GatherNodeLevels};
44+
raw_struct_lint, GatherNodeLevels, FutureIncompatibleInfo};
4545

4646
/// Specification of a single lint.
4747
#[derive(Copy, Clone, Debug)]

src/librustc_back/target/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct Target {
8080
/// Vendor name to use for conditional compilation.
8181
pub target_vendor: String,
8282
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
83-
/// "aarch64", "mips", and "powerpc". "mips" includes "mipsel".
83+
/// "aarch64", "mips", "powerpc", "powerpc64" and "powerpc64le". "mips" includes "mipsel".
8484
pub arch: String,
8585
/// Optional settings with defaults.
8686
pub options: TargetOptions,
@@ -413,6 +413,8 @@ impl Target {
413413
mips_unknown_linux_gnu,
414414
mipsel_unknown_linux_gnu,
415415
powerpc_unknown_linux_gnu,
416+
powerpc64_unknown_linux_gnu,
417+
powerpc64le_unknown_linux_gnu,
416418
arm_unknown_linux_gnueabi,
417419
arm_unknown_linux_gnueabihf,
418420
aarch64_unknown_linux_gnu,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012-2016 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+
use target::Target;
12+
13+
pub fn target() -> Target {
14+
let mut base = super::linux_base::opts();
15+
base.pre_link_args.push("-m64".to_string());
16+
17+
Target {
18+
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
19+
target_endian: "big".to_string(),
20+
target_pointer_width: "64".to_string(),
21+
arch: "powerpc64".to_string(),
22+
target_os: "linux".to_string(),
23+
target_env: "gnu".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
options: base,
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012-2016 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+
use target::Target;
12+
13+
pub fn target() -> Target {
14+
let mut base = super::linux_base::opts();
15+
base.pre_link_args.push("-m64".to_string());
16+
17+
Target {
18+
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
19+
target_endian: "little".to_string(),
20+
target_pointer_width: "64".to_string(),
21+
arch: "powerpc64le".to_string(),
22+
target_os: "linux".to_string(),
23+
target_env: "gnu".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
options: base,
26+
}
27+
}

src/librustc_lint/lib.rs

+24-3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub use rustc::util as util;
5454

5555
use session::Session;
5656
use lint::LintId;
57+
use lint::FutureIncompatibleInfo;
5758

5859
mod bad_style;
5960
mod builtin;
@@ -144,9 +145,29 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
144145
UNUSED_MUT, UNREACHABLE_CODE, UNUSED_MUST_USE,
145146
UNUSED_UNSAFE, PATH_STATEMENTS, UNUSED_ATTRIBUTES);
146147

147-
add_lint_group!(sess, FUTURE_INCOMPATIBLE,
148-
PRIVATE_IN_PUBLIC, INVALID_TYPE_PARAM_DEFAULT,
149-
MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT);
148+
// Guidelines for creating a future incompatibility lint:
149+
//
150+
// - Create a lint defaulting to warn as normal, with ideally the same error
151+
// message you would normally give
152+
// - Add a suitable reference, typically an RFC or tracking issue. Go ahead
153+
// and include the full URL.
154+
// - Later, change lint to error
155+
// - Eventually, remove lint
156+
store.register_future_incompatible(sess, vec![
157+
FutureIncompatibleInfo {
158+
id: LintId::of(PRIVATE_IN_PUBLIC),
159+
reference: "the explanation for E0446 (`--explain E0446`)",
160+
},
161+
FutureIncompatibleInfo {
162+
id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
163+
reference: "PR 30742 <https://github.com/rust-lang/rust/pull/30724>",
164+
},
165+
FutureIncompatibleInfo {
166+
id: LintId::of(MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT),
167+
reference: "RFC 218 <https://github.com/rust-lang/rfcs/blob/\
168+
master/text/0218-empty-struct-with-braces.md>",
169+
},
170+
]);
150171

151172
// We have one lint pass defined specially
152173
store.register_late_pass(sess, false, box lint::GatherNodeLevels);

src/librustc_privacy/lib.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
329329
// This code is here instead of in visit_item so that the
330330
// crate module gets processed as well.
331331
if self.prev_level.is_some() {
332-
for export in self.export_map.get(&id).expect("module isn't found in export map") {
333-
if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) {
334-
self.update(node_id, Some(AccessLevel::Exported));
332+
if let Some(exports) = self.export_map.get(&id) {
333+
for export in exports {
334+
if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) {
335+
self.update(node_id, Some(AccessLevel::Exported));
336+
}
335337
}
336338
}
337339
}
@@ -1528,7 +1530,7 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
15281530
lint::builtin::PRIVATE_IN_PUBLIC,
15291531
node_id,
15301532
ty.span,
1531-
"private type in public interface (error E0446)".to_string()
1533+
format!("private type in public interface"),
15321534
);
15331535
}
15341536
}

src/librustc_resolve/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ use resolve_imports::Shadowable;
101101
pub mod diagnostics;
102102

103103
mod check_unused;
104-
mod record_exports;
105104
mod build_reduced_graph;
106105
mod resolve_imports;
107106

@@ -4014,9 +4013,6 @@ pub fn create_resolver<'a, 'tcx>(session: &'a Session,
40144013
resolve_imports::resolve_imports(&mut resolver);
40154014
session.abort_if_errors();
40164015

4017-
record_exports::record(&mut resolver);
4018-
session.abort_if_errors();
4019-
40204016
resolver
40214017
}
40224018

0 commit comments

Comments
 (0)