Skip to content

Commit

Permalink
Auto merge of #55710 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 11 pull requests

Successful merges:

 - #55490 (resolve: Fix ICE in macro import error recovery)
 - #55597 (std: Enable usage of `thread_local!` through imports)
 - #55601 (Fix tracking issue numbers for some unstable features)
 - #55621 (Add precision for create_dir function)
 - #55644 (ci: Add Dockerfile for dist-powerpcspe-linux)
 - #55664 (Make "all possible cases" help message uniform with existing help messages)
 - #55689 (miri: binary_op_val -> binary_op_imm)
 - #55694 (Fixes #31076)
 - #55696 (NLL Diagnostic Review 3: Missing errors for borrows of union fields)
 - #55700 (Update ui tests with respect to NLL)
 - #55703 (Update `configure --help` (via configure.py) to reflect decoupling of debug+optimize)
  • Loading branch information
bors committed Nov 6, 2018
2 parents 24e66c2 + 8589ca0 commit f90aab7
Show file tree
Hide file tree
Showing 79 changed files with 775 additions and 410 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def v(*args):
options.append(Option(*args, value=True))


o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code (use `--disable-optimize` for that)")
o("docs", "build.docs", "build standard library documentation")
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
Expand Down
26 changes: 26 additions & 0 deletions src/ci/docker/disabled/dist-powerpcspe-linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
file \
curl \
ca-certificates \
python2.7 \
git \
cmake \
sudo \
gdb \
xz-utils \
g++-powerpc-linux-gnuspe \
libssl-dev \
pkg-config


COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV HOSTS=powerpc-unknown-linux-gnuspe

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
6 changes: 2 additions & 4 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
return true;
}

// (To be) stable attribute for #[lang = "panic_impl"]
if attr::contains_name(attrs, "panic_implementation") ||
attr::contains_name(attrs, "panic_handler")
{
// Stable attribute for #[lang = "panic_impl"]
if attr::contains_name(attrs, "panic_handler") {
return true;
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
if let Some(value) = attribute.value_str() {
return Some((value, attribute.span));
}
} else if attribute.check_name("panic_implementation") ||
attribute.check_name("panic_handler")
{
} else if attribute.check_name("panic_handler") {
return Some((Symbol::intern("panic_impl"), attribute.span))
} else if attribute.check_name("alloc_error_handler") {
return Some((Symbol::intern("oom"), attribute.span))
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,25 +506,25 @@ pub enum BorrowKind {
/// implicit closure bindings. It is needed when the closure is
/// borrowing or mutating a mutable referent, e.g.:
///
/// let x: &mut isize = ...;
/// let y = || *x += 5;
/// let x: &mut isize = ...;
/// let y = || *x += 5;
///
/// If we were to try to translate this closure into a more explicit
/// form, we'd encounter an error with the code as written:
///
/// struct Env { x: & &mut isize }
/// let x: &mut isize = ...;
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
/// struct Env { x: & &mut isize }
/// let x: &mut isize = ...;
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
///
/// This is then illegal because you cannot mutate an `&mut` found
/// in an aliasable location. To solve, you'd have to translate with
/// an `&mut` borrow:
///
/// struct Env { x: & &mut isize }
/// let x: &mut isize = ...;
/// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
/// struct Env { x: & &mut isize }
/// let x: &mut isize = ...;
/// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
///
/// Now the assignment to `**env.x` is legal, but creating a
/// mutable pointer to `x` is not because `x` is not mutable. We
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
is non-empty",
pat_ty));
span_help!(&mut err, scrut.span,
"Please ensure that all possible cases are being handled; \
possibly adding wildcards or more match arms.");
"ensure that all possible cases are being handled, \
possibly by adding wildcards or more match arms");
err.emit();
}
// If the type *is* uninhabited, it's vacuously exhaustive
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
"unchecked_shr" => BinOp::Shr,
_ => bug!("Already checked for int ops")
};
let (val, overflowed) = self.binary_op_val(bin_op, l, r)?;
let (val, overflowed) = self.binary_op_imm(bin_op, l, r)?;
if overflowed {
let layout = self.layout_of(substs.type_at(0))?;
let r_val = r.to_scalar()?.to_bits(layout.size)?;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/interpret/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
right: ImmTy<'tcx, M::PointerTag>,
dest: PlaceTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx> {
let (val, overflowed) = self.binary_op_val(op, left, right)?;
let (val, overflowed) = self.binary_op_imm(op, left, right)?;
let val = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
self.write_immediate(val, dest)
}
Expand All @@ -42,7 +42,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
right: ImmTy<'tcx, M::PointerTag>,
dest: PlaceTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx> {
let (val, _overflowed) = self.binary_op_val(op, left, right)?;
let (val, _overflowed) = self.binary_op_imm(op, left, right)?;
self.write_scalar(val, dest)
}
}
Expand Down Expand Up @@ -283,9 +283,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
}

/// Convenience wrapper that's useful when keeping the layout together with the
/// value.
/// immediate value.
#[inline]
pub fn binary_op_val(
pub fn binary_op_imm(
&self,
bin_op: mir::BinOp,
left: ImmTy<'tcx, M::PointerTag>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/monomorphize/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ fn mono_item_visibility(
//
// * First is weak lang items. These are basically mechanisms for
// libcore to forward-reference symbols defined later in crates like
// the standard library or `#[panic_implementation]` definitions. The
// the standard library or `#[panic_handler]` definitions. The
// definition of these weak lang items needs to be referenceable by
// libcore, so we're no longer a candidate for internalization.
// Removal of these functions can't be done by LLVM but rather must be
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
})?;
trace!("const evaluating {:?} for {:?} and {:?}", op, left, right);
let (val, overflow) = self.use_ecx(source_info, |this| {
this.ecx.binary_op_val(op, l, r)
this.ecx.binary_op_imm(op, l, r)
})?;
let val = if let Rvalue::CheckedBinaryOp(..) = *rvalue {
Immediate::ScalarPair(
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
return Err(Determinacy::Determined);
}
}
Def::Err => {
return Err(Determinacy::Determined);
}
_ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"),
}

Expand Down
10 changes: 8 additions & 2 deletions src/librustc_typeck/check/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// Trait must have a method named `m_name` and it should not have
// type parameters or early-bound regions.
let tcx = self.tcx;
let method_item =
self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
let method_item = match self.associated_item(trait_def_id, m_name, Namespace::Value) {
Some(method_item) => method_item,
None => {
tcx.sess.delay_span_bug(span,
"operator trait does not have corresponding operator method");
return None;
}
};
let def_id = method_item.def_id;
let generics = tcx.generics_of(def_id);
assert_eq!(generics.params.len(), 0);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
}
}

// Check that a function marked as `#[panic_implementation]` has signature `fn(&PanicInfo) -> !`
// Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) {
if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
Expand Down
7 changes: 7 additions & 0 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1755,12 +1755,19 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
///
/// [changes]: ../io/index.html#platform-specific-behavior
///
/// **NOTE**: If a parent of the given path doesn't exist, this function will
/// return an error. To create a directory and all its missing parents at the
/// same time, use the [`create_dir_all`] function.
///
/// # Errors
///
/// This function will return an error in the following situations, but is not
/// limited to just these cases:
///
/// * User lacks permissions to create directory at `path`.
/// * A parent of the given path doesn't exist. (To create a directory and all
/// its missing parents at the same time, use the [`create_dir_all`]
/// function.)
/// * `path` already exists.
///
/// # Examples
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ macro_rules! thread_local {

// process multiple declarations
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => (
__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
thread_local!($($rest)*);
$crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
$crate::thread_local!($($rest)*);
);

// handle a single declaration
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => (
__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
$crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
);
}

Expand Down Expand Up @@ -202,7 +202,7 @@ macro_rules! __thread_local_inner {
};
($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => {
$(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
$crate::__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
}
}

Expand Down
27 changes: 8 additions & 19 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ declare_features! (
(active, abi_thiscall, "1.19.0", None, None),

// Allows a test to fail without failing the whole suite
(active, allow_fail, "1.19.0", Some(42219), None),
(active, allow_fail, "1.19.0", Some(46488), None),

// Allows unsized tuple coercion.
(active, unsized_tuple_coercion, "1.20.0", Some(42877), None),
Expand All @@ -376,7 +376,7 @@ declare_features! (
(active, non_exhaustive, "1.22.0", Some(44109), None),

// `crate` as visibility modifier, synonymous to `pub(crate)`
(active, crate_visibility_modifier, "1.23.0", Some(45388), None),
(active, crate_visibility_modifier, "1.23.0", Some(53120), None),

// extern types
(active, extern_types, "1.23.0", Some(43467), None),
Expand All @@ -391,13 +391,13 @@ declare_features! (
(active, generic_associated_types, "1.23.0", Some(44265), None),

// `extern` in paths
(active, extern_in_paths, "1.23.0", Some(44660), None),
(active, extern_in_paths, "1.23.0", Some(55600), None),

// Use `?` as the Kleene "at most one" operator
(active, macro_at_most_once_rep, "1.25.0", Some(48075), None),

// Infer static outlives requirements; RFC 2093
(active, infer_static_outlives_requirements, "1.26.0", Some(44493), None),
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),

// Multiple patterns with `|` in `if let` and `while let`
(active, if_while_or_patterns, "1.26.0", Some(48215), None),
Expand Down Expand Up @@ -448,9 +448,6 @@ declare_features! (
// Integer match exhaustiveness checking
(active, exhaustive_integer_patterns, "1.30.0", Some(50907), None),

// RFC 2070: #[panic_implementation] / #[panic_handler]
(active, panic_implementation, "1.28.0", Some(44489), None),

// #[doc(keyword = "...")]
(active, doc_keyword, "1.28.0", Some(51315), None),

Expand All @@ -466,7 +463,7 @@ declare_features! (
(active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)),

// Support for arbitrary delimited token streams in non-macro attributes
(active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None),
(active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None),

// Allows `use x::y;` to resolve through `self::x`, not just `::x`
(active, uniform_paths, "1.30.0", Some(53130), None),
Expand Down Expand Up @@ -503,7 +500,7 @@ declare_features! (
(active, underscore_const_names, "1.31.0", Some(54912), None),

// `extern crate foo as bar;` puts `bar` into extern prelude.
(active, extern_crate_item_prelude, "1.31.0", Some(54658), None),
(active, extern_crate_item_prelude, "1.31.0", Some(55599), None),

// `reason = ` in lint attributes and `expect` lint attribute
(active, lint_reasons, "1.31.0", Some(54503), None),
Expand Down Expand Up @@ -541,6 +538,8 @@ declare_features! (
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
(removed, proc_macro_gen, "1.27.0", Some(54727), None,
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
(removed, panic_implementation, "1.28.0", Some(44489), None,
Some("subsumed by `#[panic_handler]`")),
);

declare_features! (
Expand Down Expand Up @@ -1160,16 +1159,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
"infer 'static lifetime requirements",
cfg_fn!(infer_static_outlives_requirements))),

// RFC 2070 (deprecated attribute name)
("panic_implementation",
Normal,
Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\
#issuecomment-415140224",
Some("replace this attribute with `#[panic_handler]`")),
"panic_implementation",
"this attribute was renamed to `panic_handler`",
cfg_fn!(panic_implementation))),

// RFC 2070
("panic_handler", Normal, Ungated),

Expand Down
4 changes: 1 addition & 3 deletions src/test/run-make/wasm-symbols-not-imported/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#![crate_type = "cdylib"]

#![feature(panic_implementation)]
#![no_std]

use core::panic::PanicInfo;
Expand All @@ -20,7 +18,7 @@ pub extern fn foo() {
panic!()
}

#[panic_implementation]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags:-C panic=abort

#![deny(deprecated)]
#![feature(panic_implementation)]
#![no_std]

use core::panic::PanicInfo;
extern crate std;

#[panic_implementation]
fn panic(info: &PanicInfo) -> ! {
loop {}
}
std::thread_local!(static A: usize = 30);

fn main() {}
fn main() {
}
Loading

0 comments on commit f90aab7

Please sign in to comment.