Skip to content

Commit 10c2316

Browse files
committed
Auto merge of #72905 - JohnTitor:rollup-phtyo5i, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #72775 (Return early to avoid ICE) - #72795 (Add a test for `$:ident` in proc macro input) - #72822 (remove trivial calls to mk_const) - #72825 (Clarify errors and warnings about the transition to the new asm!) - #72827 (changed *nix to Unix-like) - #72880 (Clean up E0637 explanation) - #72886 (Remove allow missing_debug_implementations for MaybeUninit) - #72889 (rustc: Remove the `--passive-segments` LLD flag on wasm) - #72891 (Add associated consts MIN/MAX for Wrapping<Int>) - #72893 (test miri-unleash TLS accesses) Failed merges: r? @ghost
2 parents ad4bc33 + b7ec7bd commit 10c2316

File tree

32 files changed

+238
-87
lines changed

32 files changed

+238
-87
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ or reading the [rustc dev guide][rustcguidebuild].
2323

2424
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
2525

26-
### Building on *nix
26+
### Building on Unix-like system
2727
1. Make sure you have installed the dependencies:
2828

2929
* `g++` 5.1 or later or `clang++` 3.5 or later

src/libcore/macros/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ pub(crate) mod builtin {
13151315
#[unstable(
13161316
feature = "llvm_asm",
13171317
issue = "70173",
1318-
reason = "LLVM-style inline assembly will never be stabilized, prefer using asm! instead"
1318+
reason = "prefer using the new asm! syntax instead"
13191319
)]
13201320
#[rustc_builtin_macro]
13211321
#[macro_export]

src/libcore/mem/maybe_uninit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ use crate::mem::ManuallyDrop;
214214
/// remain `#[repr(transparent)]`. That said, `MaybeUninit<T>` will *always* guarantee that it has
215215
/// the same size, alignment, and ABI as `T`; it's just that the way `MaybeUninit` implements that
216216
/// guarantee may evolve.
217-
#[allow(missing_debug_implementations)]
218217
#[stable(feature = "maybe_uninit", since = "1.36.0")]
219218
// Lang item so we can wrap other types in it. This is useful for generators.
220219
#[lang = "maybe_uninit"]

src/libcore/num/wrapping.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,10 @@ Basic usage:
337337
#![feature(wrapping_int_impl)]
338338
use std::num::Wrapping;
339339
340-
assert_eq!(<Wrapping<", stringify!($t), ">>::min_value(), ",
341-
"Wrapping(", stringify!($t), "::min_value()));
340+
assert_eq!(<Wrapping<", stringify!($t), ">>::MIN, Wrapping(", stringify!($t), "::MIN));
342341
```"),
343342
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
344-
#[inline]
345-
pub const fn min_value() -> Self {
346-
Wrapping(<$t>::min_value())
347-
}
343+
pub const MIN: Self = Self(<$t>::MIN);
348344
}
349345

350346
doc_comment! {
@@ -358,14 +354,10 @@ Basic usage:
358354
#![feature(wrapping_int_impl)]
359355
use std::num::Wrapping;
360356
361-
assert_eq!(<Wrapping<", stringify!($t), ">>::max_value(), ",
362-
"Wrapping(", stringify!($t), "::max_value()));
357+
assert_eq!(<Wrapping<", stringify!($t), ">>::MAX, Wrapping(", stringify!($t), "::MAX));
363358
```"),
364359
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
365-
#[inline]
366-
pub const fn max_value() -> Self {
367-
Wrapping(<$t>::max_value())
368-
}
360+
pub const MAX: Self = Self(<$t>::MAX);
369361
}
370362

371363
doc_comment! {

src/librustc_builtin_macros/asm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ fn parse_args<'a>(
3333

3434
// Detect use of the legacy llvm_asm! syntax (which used to be called asm!)
3535
if p.look_ahead(1, |t| *t == token::Colon || *t == token::ModSep) {
36-
let mut err = ecx.struct_span_err(sp, "legacy asm! syntax is no longer supported");
36+
let mut err =
37+
ecx.struct_span_err(sp, "the legacy LLVM-style asm! syntax is no longer supported");
38+
err.note("consider migrating to the new asm! syntax specified in RFC 2873");
39+
err.note("alternatively, switch to llvm_asm! to keep your code working as it is");
3740

3841
// Find the span of the "asm!" so that we can offer an automatic suggestion
3942
let asm_span = sp.from_inner(InnerSpan::new(0, 4));

src/librustc_codegen_ssa/back/linker.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,9 +1010,6 @@ impl<'a> WasmLd<'a> {
10101010
// sharing memory and instantiating the module multiple times. As a
10111011
// result if it were exported then we'd just have no sharing.
10121012
//
1013-
// * `--passive-segments` - all memory segments should be passive to
1014-
// prevent each module instantiation from reinitializing memory.
1015-
//
10161013
// * `--export=__wasm_init_memory` - when using `--passive-segments` the
10171014
// linker will synthesize this function, and so we need to make sure
10181015
// that our usage of `--export` below won't accidentally cause this
@@ -1026,7 +1023,6 @@ impl<'a> WasmLd<'a> {
10261023
cmd.arg("--shared-memory");
10271024
cmd.arg("--max-memory=1073741824");
10281025
cmd.arg("--import-memory");
1029-
cmd.arg("--passive-segments");
10301026
cmd.arg("--export=__wasm_init_memory");
10311027
cmd.arg("--export=__wasm_init_tls");
10321028
cmd.arg("--export=__tls_size");

src/librustc_error_codes/error_codes/E0637.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
An underscore `_` character has been used as the identifier for a lifetime.
22

3-
Erroneous example:
3+
Erroneous code example:
4+
45
```compile_fail,E0106,E0637
56
fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
67
//^^ `'_` is a reserved lifetime name
@@ -11,13 +12,15 @@ fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
1112
}
1213
}
1314
```
15+
1416
`'_`, cannot be used as a lifetime identifier because it is a reserved for the
1517
anonymous lifetime. To fix this, use a lowercase letter such as 'a, or a series
1618
of lowercase letters such as `'foo`. For more information, see [the
1719
book][bk-no]. For more information on using the anonymous lifetime in rust
1820
nightly, see [the nightly book][bk-al].
1921

2022
Corrected example:
23+
2124
```
2225
fn longest<'a>(str1: &'a str, str2: &'a str) -> &'a str {
2326
if str1.len() > str2.len() {

src/librustc_middle/mir/interpret/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,12 @@ impl fmt::Display for UnsupportedOpInfo {
523523
match self {
524524
Unsupported(ref msg) => write!(f, "{}", msg),
525525
ReadForeignStatic(did) => {
526-
write!(f, "cannot read from foreign (extern) static {:?}", did)
526+
write!(f, "cannot read from foreign (extern) static ({:?})", did)
527527
}
528528
NoMirFor(did) => write!(f, "no MIR body is available for {:?}", did),
529529
ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
530530
ReadBytesAsPointer => write!(f, "unable to turn bytes into a pointer"),
531-
ThreadLocalStatic(did) => write!(f, "accessing thread local static {:?}", did),
531+
ThreadLocalStatic(did) => write!(f, "cannot access thread local static ({:?})", did),
532532
}
533533
}
534534
}

src/librustc_middle/ty/structural_impls.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,11 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> {
10191019
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
10201020
let ty = self.ty.fold_with(folder);
10211021
let val = self.val.fold_with(folder);
1022-
folder.tcx().mk_const(ty::Const { ty, val })
1022+
if ty != self.ty || val != self.val {
1023+
folder.tcx().mk_const(ty::Const { ty, val })
1024+
} else {
1025+
*self
1026+
}
10231027
}
10241028

10251029
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {

src/librustc_mir/transform/check_consts/ops.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ use super::ConstCx;
1212

1313
/// An operation that is not *always* allowed in a const context.
1414
pub trait NonConstOp: std::fmt::Debug {
15-
/// Whether this operation can be evaluated by miri.
16-
const IS_SUPPORTED_IN_MIRI: bool = true;
17-
1815
/// Returns the `Symbol` corresponding to the feature gate that would enable this operation,
1916
/// or `None` if such a feature gate does not exist.
2017
fn feature_gate() -> Option<Symbol> {
@@ -356,8 +353,6 @@ impl NonConstOp for StaticAccess {
356353
#[derive(Debug)]
357354
pub struct ThreadLocalAccess;
358355
impl NonConstOp for ThreadLocalAccess {
359-
const IS_SUPPORTED_IN_MIRI: bool = false;
360-
361356
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
362357
struct_span_err!(
363358
ccx.tcx.sess,

0 commit comments

Comments
 (0)