Skip to content

Commit f90aab7

Browse files
committed
Auto merge of #55710 - kennytm:rollup, r=kennytm
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)
2 parents 24e66c2 + 8589ca0 commit f90aab7

File tree

79 files changed

+775
-410
lines changed

Some content is hidden

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

79 files changed

+775
-410
lines changed

src/bootstrap/configure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def v(*args):
4040
options.append(Option(*args, value=True))
4141

4242

43-
o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
43+
o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code (use `--disable-optimize` for that)")
4444
o("docs", "build.docs", "build standard library documentation")
4545
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
4646
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python2.7 \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils \
15+
g++-powerpc-linux-gnuspe \
16+
libssl-dev \
17+
pkg-config
18+
19+
20+
COPY scripts/sccache.sh /scripts/
21+
RUN sh /scripts/sccache.sh
22+
23+
ENV HOSTS=powerpc-unknown-linux-gnuspe
24+
25+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
26+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

src/librustc/middle/dead.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,8 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
291291
return true;
292292
}
293293

294-
// (To be) stable attribute for #[lang = "panic_impl"]
295-
if attr::contains_name(attrs, "panic_implementation") ||
296-
attr::contains_name(attrs, "panic_handler")
297-
{
294+
// Stable attribute for #[lang = "panic_impl"]
295+
if attr::contains_name(attrs, "panic_handler") {
298296
return true;
299297
}
300298

src/librustc/middle/lang_items.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
204204
if let Some(value) = attribute.value_str() {
205205
return Some((value, attribute.span));
206206
}
207-
} else if attribute.check_name("panic_implementation") ||
208-
attribute.check_name("panic_handler")
209-
{
207+
} else if attribute.check_name("panic_handler") {
210208
return Some((Symbol::intern("panic_impl"), attribute.span))
211209
} else if attribute.check_name("alloc_error_handler") {
212210
return Some((Symbol::intern("oom"), attribute.span))

src/librustc/mir/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -506,25 +506,25 @@ pub enum BorrowKind {
506506
/// implicit closure bindings. It is needed when the closure is
507507
/// borrowing or mutating a mutable referent, e.g.:
508508
///
509-
/// let x: &mut isize = ...;
510-
/// let y = || *x += 5;
509+
/// let x: &mut isize = ...;
510+
/// let y = || *x += 5;
511511
///
512512
/// If we were to try to translate this closure into a more explicit
513513
/// form, we'd encounter an error with the code as written:
514514
///
515-
/// struct Env { x: & &mut isize }
516-
/// let x: &mut isize = ...;
517-
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
518-
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
515+
/// struct Env { x: & &mut isize }
516+
/// let x: &mut isize = ...;
517+
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
518+
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
519519
///
520520
/// This is then illegal because you cannot mutate an `&mut` found
521521
/// in an aliasable location. To solve, you'd have to translate with
522522
/// an `&mut` borrow:
523523
///
524-
/// struct Env { x: & &mut isize }
525-
/// let x: &mut isize = ...;
526-
/// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
527-
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
524+
/// struct Env { x: & &mut isize }
525+
/// let x: &mut isize = ...;
526+
/// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
527+
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
528528
///
529529
/// Now the assignment to `**env.x` is legal, but creating a
530530
/// mutable pointer to `x` is not because `x` is not mutable. We

src/librustc_mir/hair/pattern/check_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
238238
is non-empty",
239239
pat_ty));
240240
span_help!(&mut err, scrut.span,
241-
"Please ensure that all possible cases are being handled; \
242-
possibly adding wildcards or more match arms.");
241+
"ensure that all possible cases are being handled, \
242+
possibly by adding wildcards or more match arms");
243243
err.emit();
244244
}
245245
// If the type *is* uninhabited, it's vacuously exhaustive

src/librustc_mir/interpret/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
140140
"unchecked_shr" => BinOp::Shr,
141141
_ => bug!("Already checked for int ops")
142142
};
143-
let (val, overflowed) = self.binary_op_val(bin_op, l, r)?;
143+
let (val, overflowed) = self.binary_op_imm(bin_op, l, r)?;
144144
if overflowed {
145145
let layout = self.layout_of(substs.type_at(0))?;
146146
let r_val = r.to_scalar()?.to_bits(layout.size)?;

src/librustc_mir/interpret/operator.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
2828
right: ImmTy<'tcx, M::PointerTag>,
2929
dest: PlaceTy<'tcx, M::PointerTag>,
3030
) -> EvalResult<'tcx> {
31-
let (val, overflowed) = self.binary_op_val(op, left, right)?;
31+
let (val, overflowed) = self.binary_op_imm(op, left, right)?;
3232
let val = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
3333
self.write_immediate(val, dest)
3434
}
@@ -42,7 +42,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
4242
right: ImmTy<'tcx, M::PointerTag>,
4343
dest: PlaceTy<'tcx, M::PointerTag>,
4444
) -> EvalResult<'tcx> {
45-
let (val, _overflowed) = self.binary_op_val(op, left, right)?;
45+
let (val, _overflowed) = self.binary_op_imm(op, left, right)?;
4646
self.write_scalar(val, dest)
4747
}
4848
}
@@ -283,9 +283,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
283283
}
284284

285285
/// Convenience wrapper that's useful when keeping the layout together with the
286-
/// value.
286+
/// immediate value.
287287
#[inline]
288-
pub fn binary_op_val(
288+
pub fn binary_op_imm(
289289
&self,
290290
bin_op: mir::BinOp,
291291
left: ImmTy<'tcx, M::PointerTag>,

src/librustc_mir/monomorphize/partitioning.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ fn mono_item_visibility(
511511
//
512512
// * First is weak lang items. These are basically mechanisms for
513513
// libcore to forward-reference symbols defined later in crates like
514-
// the standard library or `#[panic_implementation]` definitions. The
514+
// the standard library or `#[panic_handler]` definitions. The
515515
// definition of these weak lang items needs to be referenceable by
516516
// libcore, so we're no longer a candidate for internalization.
517517
// Removal of these functions can't be done by LLVM but rather must be

src/librustc_mir/transform/const_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
455455
})?;
456456
trace!("const evaluating {:?} for {:?} and {:?}", op, left, right);
457457
let (val, overflow) = self.use_ecx(source_info, |this| {
458-
this.ecx.binary_op_val(op, l, r)
458+
this.ecx.binary_op_imm(op, l, r)
459459
})?;
460460
let val = if let Rvalue::CheckedBinaryOp(..) = *rvalue {
461461
Immediate::ScalarPair(

src/librustc_resolve/macros.rs

+3
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
449449
return Err(Determinacy::Determined);
450450
}
451451
}
452+
Def::Err => {
453+
return Err(Determinacy::Determined);
454+
}
452455
_ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"),
453456
}
454457

src/librustc_typeck/check/method/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
289289
// Trait must have a method named `m_name` and it should not have
290290
// type parameters or early-bound regions.
291291
let tcx = self.tcx;
292-
let method_item =
293-
self.associated_item(trait_def_id, m_name, Namespace::Value).unwrap();
292+
let method_item = match self.associated_item(trait_def_id, m_name, Namespace::Value) {
293+
Some(method_item) => method_item,
294+
None => {
295+
tcx.sess.delay_span_bug(span,
296+
"operator trait does not have corresponding operator method");
297+
return None;
298+
}
299+
};
294300
let def_id = method_item.def_id;
295301
let generics = tcx.generics_of(def_id);
296302
assert_eq!(generics.params.len(), 0);

src/librustc_typeck/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
11671167
}
11681168
}
11691169

1170-
// Check that a function marked as `#[panic_implementation]` has signature `fn(&PanicInfo) -> !`
1170+
// Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
11711171
if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
11721172
if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) {
11731173
if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {

src/libstd/fs.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1755,12 +1755,19 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
17551755
///
17561756
/// [changes]: ../io/index.html#platform-specific-behavior
17571757
///
1758+
/// **NOTE**: If a parent of the given path doesn't exist, this function will
1759+
/// return an error. To create a directory and all its missing parents at the
1760+
/// same time, use the [`create_dir_all`] function.
1761+
///
17581762
/// # Errors
17591763
///
17601764
/// This function will return an error in the following situations, but is not
17611765
/// limited to just these cases:
17621766
///
17631767
/// * User lacks permissions to create directory at `path`.
1768+
/// * A parent of the given path doesn't exist. (To create a directory and all
1769+
/// its missing parents at the same time, use the [`create_dir_all`]
1770+
/// function.)
17641771
/// * `path` already exists.
17651772
///
17661773
/// # Examples

src/libstd/thread/local.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ macro_rules! thread_local {
146146

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

153153
// handle a single declaration
154154
($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => (
155-
__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
155+
$crate::__thread_local_inner!($(#[$attr])* $vis $name, $t, $init);
156156
);
157157
}
158158

@@ -202,7 +202,7 @@ macro_rules! __thread_local_inner {
202202
};
203203
($(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => {
204204
$(#[$attr])* $vis const $name: $crate::thread::LocalKey<$t> =
205-
__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
205+
$crate::__thread_local_inner!(@key $(#[$attr])* $vis $name, $t, $init);
206206
}
207207
}
208208

src/libsyntax/feature_gate.rs

+8-19
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ declare_features! (
349349
(active, abi_thiscall, "1.19.0", None, None),
350350

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

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

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

381381
// extern types
382382
(active, extern_types, "1.23.0", Some(43467), None),
@@ -391,13 +391,13 @@ declare_features! (
391391
(active, generic_associated_types, "1.23.0", Some(44265), None),
392392

393393
// `extern` in paths
394-
(active, extern_in_paths, "1.23.0", Some(44660), None),
394+
(active, extern_in_paths, "1.23.0", Some(55600), None),
395395

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

399399
// Infer static outlives requirements; RFC 2093
400-
(active, infer_static_outlives_requirements, "1.26.0", Some(44493), None),
400+
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
401401

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

451-
// RFC 2070: #[panic_implementation] / #[panic_handler]
452-
(active, panic_implementation, "1.28.0", Some(44489), None),
453-
454451
// #[doc(keyword = "...")]
455452
(active, doc_keyword, "1.28.0", Some(51315), None),
456453

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

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

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

505502
// `extern crate foo as bar;` puts `bar` into extern prelude.
506-
(active, extern_crate_item_prelude, "1.31.0", Some(54658), None),
503+
(active, extern_crate_item_prelude, "1.31.0", Some(55599), None),
507504

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

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

1163-
// RFC 2070 (deprecated attribute name)
1164-
("panic_implementation",
1165-
Normal,
1166-
Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\
1167-
#issuecomment-415140224",
1168-
Some("replace this attribute with `#[panic_handler]`")),
1169-
"panic_implementation",
1170-
"this attribute was renamed to `panic_handler`",
1171-
cfg_fn!(panic_implementation))),
1172-
11731162
// RFC 2070
11741163
("panic_handler", Normal, Ungated),
11751164

src/test/run-make/wasm-symbols-not-imported/foo.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// except according to those terms.
1010

1111
#![crate_type = "cdylib"]
12-
13-
#![feature(panic_implementation)]
1412
#![no_std]
1513

1614
use core::panic::PanicInfo;
@@ -20,7 +18,7 @@ pub extern fn foo() {
2018
panic!()
2119
}
2220

23-
#[panic_implementation]
21+
#[panic_handler]
2422
fn panic(_info: &PanicInfo) -> ! {
2523
loop {}
2624
}

src/test/ui/panic-implementation/panic-implementation-deprecated.rs renamed to src/test/run-pass/thread-local-not-in-prelude.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags:-C panic=abort
12-
13-
#![deny(deprecated)]
14-
#![feature(panic_implementation)]
1511
#![no_std]
1612

17-
use core::panic::PanicInfo;
13+
extern crate std;
1814

19-
#[panic_implementation]
20-
fn panic(info: &PanicInfo) -> ! {
21-
loop {}
22-
}
15+
std::thread_local!(static A: usize = 30);
2316

24-
fn main() {}
17+
fn main() {
18+
}

0 commit comments

Comments
 (0)