Skip to content

Commit

Permalink
Auto merge of #30929 - Manishearth:rollup, r=Manishearth
Browse files Browse the repository at this point in the history
- Successful merges: #30591, #30781, #30836, #30864, #30896, #30898, #30908, #30921, #30925
- Failed merges:
  • Loading branch information
bors committed Jan 15, 2016
2 parents a70a60a + 4f8d584 commit 1f4e317
Show file tree
Hide file tree
Showing 46 changed files with 600 additions and 224 deletions.
13 changes: 9 additions & 4 deletions configure
Expand Up @@ -499,13 +499,18 @@ case $CFG_CPUTYPE in
CFG_CPUTYPE=aarch64
;;

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

powerpc64 | ppc64)
CFG_CPUTYPE=powerpc64
;;

powerpc64le | ppc64le)
CFG_CPUTYPE=powerpc64le
;;

x86_64 | x86-64 | x64 | amd64)
CFG_CPUTYPE=x86_64
;;
Expand Down
24 changes: 24 additions & 0 deletions mk/cfg/powerpc64-unknown-linux-gnu.mk
@@ -0,0 +1,24 @@
# powerpc64-unknown-linux-gnu configuration
CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc64-linux-gnu-
CC_powerpc64-unknown-linux-gnu=$(CC)
CXX_powerpc64-unknown-linux-gnu=$(CXX)
CPP_powerpc64-unknown-linux-gnu=$(CPP)
AR_powerpc64-unknown-linux-gnu=$(AR)
CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu :=
CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu =
CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu =
CFG_WINDOWSY_powerpc64-unknown-linux-gnu :=
CFG_UNIXY_powerpc64-unknown-linux-gnu := 1
CFG_LDPATH_powerpc64-unknown-linux-gnu :=
CFG_RUN_powerpc64-unknown-linux-gnu=$(2)
CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2))
CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu
24 changes: 24 additions & 0 deletions mk/cfg/powerpc64le-unknown-linux-gnu.mk
@@ -0,0 +1,24 @@
# powerpc64le-unknown-linux-gnu configuration
CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu-
CC_powerpc64le-unknown-linux-gnu=$(CC)
CXX_powerpc64le-unknown-linux-gnu=$(CXX)
CPP_powerpc64le-unknown-linux-gnu=$(CPP)
AR_powerpc64le-unknown-linux-gnu=$(AR)
CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so
CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a
CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS)
CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64
CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu :=
CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu =
CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu =
CFG_WINDOWSY_powerpc64le-unknown-linux-gnu :=
CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1
CFG_LDPATH_powerpc64le-unknown-linux-gnu :=
CFG_RUN_powerpc64le-unknown-linux-gnu=$(2)
CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2))
CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu
2 changes: 2 additions & 0 deletions src/compiletest/util.rs
Expand Up @@ -38,6 +38,8 @@ const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
("mips", "mips"),
("msp430", "msp430"),
("powerpc", "powerpc"),
("powerpc64", "powerpc64"),
("powerpc64le", "powerpc64le"),
("s390x", "systemz"),
("sparc", "sparc"),
("x86_64", "x86_64"),
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/crates-and-modules.md
Expand Up @@ -2,7 +2,7 @@

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

Expand Down
8 changes: 5 additions & 3 deletions src/doc/book/getting-started.md
Expand Up @@ -505,9 +505,11 @@ Cargo checks to see if any of your project’s files have been modified, and onl
rebuilds your project if they’ve changed since the last time you built it.

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

## Building for Release

Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Expand Up @@ -2044,7 +2044,7 @@ The following configurations must be defined by the implementation:
production. For example, it controls the behavior of the standard library's
`debug_assert!` macro.
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
`"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`.
`"mips"`, `"powerpc"`, `"powerpc64"`, `"powerpc64le"`, `"arm"`, or `"aarch64"`.
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
`"big"`.
* `target_env = ".."` - An option provided by the compiler by default
Expand Down
4 changes: 3 additions & 1 deletion src/liballoc_jemalloc/lib.rs
Expand Up @@ -55,7 +55,9 @@ extern "C" {
const MIN_ALIGN: usize = 8;
#[cfg(all(any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64")))]
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "powerpc64le")))]
const MIN_ALIGN: usize = 16;

// MALLOCX_ALIGN(a) macro
Expand Down
4 changes: 3 additions & 1 deletion src/liballoc_system/lib.rs
Expand Up @@ -29,7 +29,9 @@ extern crate libc;
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc")))]
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "powerpc64le")))]
const MIN_ALIGN: usize = 8;
#[cfg(all(any(target_arch = "x86_64",
target_arch = "aarch64")))]
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/lint/builtin.rs
Expand Up @@ -16,9 +16,6 @@

use lint::{LintPass, LateLintPass, LintArray};

// name of the future-incompatible group
pub const FUTURE_INCOMPATIBLE: &'static str = "future_incompatible";

declare_lint! {
pub CONST_ERR,
Warn,
Expand Down
43 changes: 37 additions & 6 deletions src/librustc/lint/context.rs
Expand Up @@ -76,10 +76,22 @@ pub struct LintStore {
/// is true if the lint group was added by a plugin.
lint_groups: FnvHashMap<&'static str, (Vec<LintId>, bool)>,

/// Extra info for future incompatibility lints, descibing the
/// issue or RFC that caused the incompatibility.
future_incompatible: FnvHashMap<LintId, FutureIncompatibleInfo>,

/// Maximum level a lint can be
lint_cap: Option<Level>,
}

/// Extra information for a future incompatibility lint. See the call
/// to `register_future_incompatible` in `librustc_lint/lib.rs` for
/// guidelines.
pub struct FutureIncompatibleInfo {
pub id: LintId,
pub reference: &'static str // e.g., a URL for an issue/PR/RFC or error code
}

/// The targed of the `by_name` map, which accounts for renaming/deprecation.
enum TargetLint {
/// A direct lint target
Expand Down Expand Up @@ -124,6 +136,7 @@ impl LintStore {
late_passes: Some(vec!()),
by_name: FnvHashMap(),
levels: FnvHashMap(),
future_incompatible: FnvHashMap(),
lint_groups: FnvHashMap(),
lint_cap: None,
}
Expand Down Expand Up @@ -183,6 +196,20 @@ impl LintStore {
}
}

pub fn register_future_incompatible(&mut self,
sess: Option<&Session>,
lints: Vec<FutureIncompatibleInfo>) {
let ids = lints.iter().map(|f| f.id).collect();
self.register_group(sess, false, "future_incompatible", ids);
for info in lints {
self.future_incompatible.insert(info.id, info);
}
}

pub fn future_incompatible(&self, id: LintId) -> Option<&FutureIncompatibleInfo> {
self.future_incompatible.get(&id)
}

pub fn register_group(&mut self, sess: Option<&Session>,
from_plugin: bool, name: &'static str,
to: Vec<LintId>) {
Expand Down Expand Up @@ -418,14 +445,18 @@ pub fn raw_struct_lint<'a>(sess: &'a Session,
};

// Check for future incompatibility lints and issue a stronger warning.
let future_incompat_lints = &lints.lint_groups[builtin::FUTURE_INCOMPATIBLE];
let this_id = LintId::of(lint);
if future_incompat_lints.0.iter().any(|&id| id == this_id) {
let msg = "this lint will become a HARD ERROR in a future release!";
if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) {
let explanation = format!("this was previously accepted by the compiler \
but is being phased out; \
it will become a hard error in a future release!");
let citation = format!("for more information, see {}",
future_incompatible.reference);
if let Some(sp) = span {
err.span_note(sp, msg);
err.fileline_warn(sp, &explanation);
err.fileline_note(sp, &citation);
} else {
err.note(msg);
err.warn(&explanation);
err.note(&citation);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/mod.rs
Expand Up @@ -41,7 +41,7 @@ use rustc_front::hir;

pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
raw_emit_lint, check_crate, check_ast_crate, gather_attrs,
raw_struct_lint, GatherNodeLevels};
raw_struct_lint, GatherNodeLevels, FutureIncompatibleInfo};

/// Specification of a single lint.
#[derive(Copy, Clone, Debug)]
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_back/target/mod.rs
Expand Up @@ -80,7 +80,7 @@ pub struct Target {
/// Vendor name to use for conditional compilation.
pub target_vendor: String,
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
/// "aarch64", "mips", and "powerpc". "mips" includes "mipsel".
/// "aarch64", "mips", "powerpc", "powerpc64" and "powerpc64le". "mips" includes "mipsel".
pub arch: String,
/// Optional settings with defaults.
pub options: TargetOptions,
Expand Down Expand Up @@ -413,6 +413,8 @@ impl Target {
mips_unknown_linux_gnu,
mipsel_unknown_linux_gnu,
powerpc_unknown_linux_gnu,
powerpc64_unknown_linux_gnu,
powerpc64le_unknown_linux_gnu,
arm_unknown_linux_gnueabi,
arm_unknown_linux_gnueabihf,
aarch64_unknown_linux_gnu,
Expand Down
27 changes: 27 additions & 0 deletions src/librustc_back/target/powerpc64_unknown_linux_gnu.rs
@@ -0,0 +1,27 @@
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use target::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();
base.pre_link_args.push("-m64".to_string());

Target {
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
target_pointer_width: "64".to_string(),
arch: "powerpc64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
options: base,
}
}
27 changes: 27 additions & 0 deletions src/librustc_back/target/powerpc64le_unknown_linux_gnu.rs
@@ -0,0 +1,27 @@
// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use target::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();
base.pre_link_args.push("-m64".to_string());

Target {
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
arch: "powerpc64le".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
options: base,
}
}
27 changes: 24 additions & 3 deletions src/librustc_lint/lib.rs
Expand Up @@ -54,6 +54,7 @@ pub use rustc::util as util;

use session::Session;
use lint::LintId;
use lint::FutureIncompatibleInfo;

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

add_lint_group!(sess, FUTURE_INCOMPATIBLE,
PRIVATE_IN_PUBLIC, INVALID_TYPE_PARAM_DEFAULT,
MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT);
// Guidelines for creating a future incompatibility lint:
//
// - Create a lint defaulting to warn as normal, with ideally the same error
// message you would normally give
// - Add a suitable reference, typically an RFC or tracking issue. Go ahead
// and include the full URL.
// - Later, change lint to error
// - Eventually, remove lint
store.register_future_incompatible(sess, vec![
FutureIncompatibleInfo {
id: LintId::of(PRIVATE_IN_PUBLIC),
reference: "the explanation for E0446 (`--explain E0446`)",
},
FutureIncompatibleInfo {
id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
reference: "PR 30742 <https://github.com/rust-lang/rust/pull/30724>",
},
FutureIncompatibleInfo {
id: LintId::of(MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT),
reference: "RFC 218 <https://github.com/rust-lang/rfcs/blob/\
master/text/0218-empty-struct-with-braces.md>",
},
]);

// We have one lint pass defined specially
store.register_late_pass(sess, false, box lint::GatherNodeLevels);
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_privacy/lib.rs
Expand Up @@ -329,9 +329,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
// This code is here instead of in visit_item so that the
// crate module gets processed as well.
if self.prev_level.is_some() {
for export in self.export_map.get(&id).expect("module isn't found in export map") {
if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) {
self.update(node_id, Some(AccessLevel::Exported));
if let Some(exports) = self.export_map.get(&id) {
for export in exports {
if let Some(node_id) = self.tcx.map.as_local_node_id(export.def_id) {
self.update(node_id, Some(AccessLevel::Exported));
}
}
}
}
Expand Down Expand Up @@ -1528,7 +1530,7 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
lint::builtin::PRIVATE_IN_PUBLIC,
node_id,
ty.span,
"private type in public interface (error E0446)".to_string()
format!("private type in public interface"),
);
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_resolve/lib.rs
Expand Up @@ -101,7 +101,6 @@ use resolve_imports::Shadowable;
pub mod diagnostics;

mod check_unused;
mod record_exports;
mod build_reduced_graph;
mod resolve_imports;

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

record_exports::record(&mut resolver);
session.abort_if_errors();

resolver
}

Expand Down

0 comments on commit 1f4e317

Please sign in to comment.