diff --git a/Cargo.lock b/Cargo.lock
index 2096a3dfff9ea..905f523aa53d6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -404,9 +404,9 @@ version = "0.1.0"
[[package]]
name = "cc"
-version = "1.0.54"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
+checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
dependencies = [
"jobserver",
]
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index cceb794165059..e8ec575ea3746 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -9,6 +9,7 @@
//! ensure that they're always in place if needed.
use std::env;
+use std::env::consts::EXE_EXTENSION;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io;
@@ -252,8 +253,14 @@ impl Step for Llvm {
// FIXME: if the llvm root for the build triple is overridden then we
// should use llvm-tblgen from there, also should verify that it
// actually exists most of the time in normal installs of LLVM.
- let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen");
- cfg.define("CMAKE_CROSSCOMPILING", "True").define("LLVM_TABLEGEN", &host);
+ let host_bin = builder.llvm_out(builder.config.build).join("bin");
+ cfg.define("CMAKE_CROSSCOMPILING", "True");
+ cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
+ cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
+ cfg.define(
+ "LLVM_CONFIG_PATH",
+ host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
+ );
if target.contains("netbsd") {
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
@@ -262,8 +269,6 @@ impl Step for Llvm {
} else if target.contains("windows") {
cfg.define("CMAKE_SYSTEM_NAME", "Windows");
}
-
- cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
}
if let Some(ref suffix) = builder.config.llvm_version_suffix {
@@ -431,6 +436,9 @@ fn configure_cmake(
cflags.push_str(" -miphoneos-version-min=10.0");
}
}
+ if builder.config.llvm_clang_cl.is_some() {
+ cflags.push_str(&format!(" --target={}", target))
+ }
cfg.define("CMAKE_C_FLAGS", cflags);
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
if builder.config.llvm_static_stdcpp && !target.contains("msvc") && !target.contains("netbsd") {
@@ -439,6 +447,9 @@ fn configure_cmake(
if let Some(ref s) = builder.config.llvm_cxxflags {
cxxflags.push_str(&format!(" {}", s));
}
+ if builder.config.llvm_clang_cl.is_some() {
+ cxxflags.push_str(&format!(" --target={}", target))
+ }
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
if let Some(ar) = builder.ar(target) {
if ar.is_absolute() {
@@ -484,7 +495,7 @@ impl Step for Lld {
run.builder.ensure(Lld { target: run.target });
}
- /// Compile LLVM for `target`.
+ /// Compile LLD for `target`.
fn run(self, builder: &Builder<'_>) -> PathBuf {
if builder.config.dry_run {
return PathBuf::from("lld-out-dir-test-gen");
@@ -521,6 +532,7 @@ impl Step for Lld {
// can't build on a system where your paths require `\` on Windows, but
// there's probably a lot of reasons you can't do that other than this.
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");
+
cfg.out_dir(&out_dir)
.profile("Release")
.env("LLVM_CONFIG_REAL", &llvm_config)
@@ -543,7 +555,10 @@ impl Step for Lld {
if target != builder.config.build {
cfg.env("LLVM_CONFIG_SHIM_REPLACE", &builder.config.build)
.env("LLVM_CONFIG_SHIM_REPLACE_WITH", &target)
- .define("LLVM_TABLEGEN_EXE", llvm_config.with_file_name("llvm-tblgen"));
+ .define(
+ "LLVM_TABLEGEN_EXE",
+ llvm_config.with_file_name("llvm-tblgen").with_extension(EXE_EXTENSION),
+ );
}
// Explicitly set C++ standard, because upstream doesn't do so
@@ -595,8 +610,8 @@ impl Step for TestHelpers {
}
// We may have found various cross-compilers a little differently due to our
- // extra configuration, so inform gcc of these compilers. Note, though, that
- // on MSVC we still need gcc's detection of env vars (ugh).
+ // extra configuration, so inform cc of these compilers. Note, though, that
+ // on MSVC we still need cc's detection of env vars (ugh).
if !target.contains("msvc") {
if let Some(ar) = builder.ar(target) {
cfg.archiver(ar);
diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis
index 1611d8660ef65..874550da8b0c9 100644
--- a/src/etc/natvis/intrinsic.natvis
+++ b/src/etc/natvis/intrinsic.natvis
@@ -21,4 +21,128 @@
+
+ ()
+
+
+ ({__0})
+
+ - __0
+
+
+
+ ({__0}, {__1})
+
+ - __0
+ - __1
+
+
+
+ ({__0}, {__1}, {__2})
+
+ - __0
+ - __1
+ - __2
+
+
+
+ ({__0}, {__1}, {__2}, {__3})
+
+ - __0
+ - __1
+ - __2
+ - __3
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+ - __6
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+ - __6
+ - __7
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+ - __6
+ - __7
+ - __8
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9})
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+ - __6
+ - __7
+ - __8
+ - __9
+
+
+
+ ({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9}, ...)
+
+ - __0
+ - __1
+ - __2
+ - __3
+ - __4
+ - __5
+ - __6
+ - __7
+ - __8
+ - __9
+ ...
+
+
diff --git a/src/libcore/benches/ascii.rs b/src/libcore/benches/ascii.rs
index 76ccd3ddb6fd8..05dd7adff1fbb 100644
--- a/src/libcore/benches/ascii.rs
+++ b/src/libcore/benches/ascii.rs
@@ -1,3 +1,5 @@
+mod is_ascii;
+
// Lower-case ASCII 'a' is the first byte that has its highest bit set
// after wrap-adding 0x1F:
//
diff --git a/src/libcore/benches/ascii/is_ascii.rs b/src/libcore/benches/ascii/is_ascii.rs
new file mode 100644
index 0000000000000..729b0a04eb6ba
--- /dev/null
+++ b/src/libcore/benches/ascii/is_ascii.rs
@@ -0,0 +1,82 @@
+use super::{LONG, MEDIUM, SHORT};
+use test::black_box;
+use test::Bencher;
+
+macro_rules! benches {
+ ($( fn $name: ident($arg: ident: &[u8]) $body: block )+) => {
+ benches!(mod short SHORT[..] $($name $arg $body)+);
+ benches!(mod medium MEDIUM[..] $($name $arg $body)+);
+ benches!(mod long LONG[..] $($name $arg $body)+);
+ // Ensure we benchmark cases where the functions are called with strings
+ // that are not perfectly aligned or have a length which is not a
+ // multiple of size_of::() (or both)
+ benches!(mod unaligned_head MEDIUM[1..] $($name $arg $body)+);
+ benches!(mod unaligned_tail MEDIUM[..(MEDIUM.len() - 1)] $($name $arg $body)+);
+ benches!(mod unaligned_both MEDIUM[1..(MEDIUM.len() - 1)] $($name $arg $body)+);
+ };
+
+ (mod $mod_name: ident $input: ident [$range: expr] $($name: ident $arg: ident $body: block)+) => {
+ mod $mod_name {
+ use super::*;
+ $(
+ #[bench]
+ fn $name(bencher: &mut Bencher) {
+ bencher.bytes = $input[$range].len() as u64;
+ let mut vec = $input.as_bytes().to_vec();
+ bencher.iter(|| {
+ let $arg: &[u8] = &black_box(&mut vec)[$range];
+ black_box($body)
+ })
+ }
+ )+
+ }
+ };
+}
+
+benches! {
+ fn case00_libcore(bytes: &[u8]) {
+ bytes.is_ascii()
+ }
+
+ fn case01_iter_all(bytes: &[u8]) {
+ bytes.iter().all(|b| b.is_ascii())
+ }
+
+ fn case02_align_to(bytes: &[u8]) {
+ is_ascii_align_to(bytes)
+ }
+
+ fn case03_align_to_unrolled(bytes: &[u8]) {
+ is_ascii_align_to_unrolled(bytes)
+ }
+}
+
+// These are separate since it's easier to debug errors if they don't go through
+// macro expansion first.
+fn is_ascii_align_to(bytes: &[u8]) -> bool {
+ if bytes.len() < core::mem::size_of::() {
+ return bytes.iter().all(|b| b.is_ascii());
+ }
+ // SAFETY: transmuting a sequence of `u8` to `usize` is always fine
+ let (head, body, tail) = unsafe { bytes.align_to::() };
+ head.iter().all(|b| b.is_ascii())
+ && body.iter().all(|w| !contains_nonascii(*w))
+ && tail.iter().all(|b| b.is_ascii())
+}
+
+fn is_ascii_align_to_unrolled(bytes: &[u8]) -> bool {
+ if bytes.len() < core::mem::size_of::() {
+ return bytes.iter().all(|b| b.is_ascii());
+ }
+ // SAFETY: transmuting a sequence of `u8` to `[usize; 2]` is always fine
+ let (head, body, tail) = unsafe { bytes.align_to::<[usize; 2]>() };
+ head.iter().all(|b| b.is_ascii())
+ && body.iter().all(|w| !contains_nonascii(w[0] | w[1]))
+ && tail.iter().all(|b| b.is_ascii())
+}
+
+#[inline]
+fn contains_nonascii(v: usize) -> bool {
+ const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
+ (NONASCII_MASK & v) != 0
+}
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index b3e43cd799405..540a8cfb290b3 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1285,7 +1285,9 @@ extern "rust-intrinsic" {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_transmute", issue = "53605")]
+ // NOTE: While this makes the intrinsic const stable, we have some custom code in const fn
+ // checks that prevent its use within `const fn`.
+ #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
pub fn transmute(e: T) -> U;
/// Returns `true` if the actual type given as `T` requires drop
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 692d91bd61ddf..820c0a49e7f03 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -140,7 +140,7 @@
#![feature(rtm_target_feature)]
#![feature(f16c_target_feature)]
#![feature(hexagon_target_feature)]
-#![feature(const_transmute)]
+#![cfg_attr(not(bootstrap), feature(const_fn_transmute))]
#![feature(abi_unadjusted)]
#![feature(adx_target_feature)]
#![feature(maybe_uninit_slice)]
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index e7a2d7adedea0..bed8495993f43 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -2795,7 +2795,7 @@ impl [u8] {
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[inline]
pub fn is_ascii(&self) -> bool {
- self.iter().all(|b| b.is_ascii())
+ is_ascii(self)
}
/// Checks that two slices are an ASCII case-insensitive match.
@@ -2843,6 +2843,106 @@ impl [u8] {
}
}
+/// Returns `true` if any byte in the word `v` is nonascii (>= 128). Snarfed
+/// from `../str/mod.rs`, which does something similar for utf8 validation.
+#[inline]
+fn contains_nonascii(v: usize) -> bool {
+ const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize;
+ (NONASCII_MASK & v) != 0
+}
+
+/// Optimized ASCII test that will use usize-at-a-time operations instead of
+/// byte-at-a-time operations (when possible).
+///
+/// The algorithm we use here is pretty simple. If `s` is too short, we just
+/// check each byte and be done with it. Otherwise:
+///
+/// - Read the first word with an unaligned load.
+/// - Align the pointer, read subsequent words until end with aligned loads.
+/// - If there's a tail, the last `usize` from `s` with an unaligned load.
+///
+/// If any of these loads produces something for which `contains_nonascii`
+/// (above) returns true, then we know the answer is false.
+#[inline]
+fn is_ascii(s: &[u8]) -> bool {
+ const USIZE_SIZE: usize = mem::size_of::();
+
+ let len = s.len();
+ let align_offset = s.as_ptr().align_offset(USIZE_SIZE);
+
+ // If we wouldn't gain anything from the word-at-a-time implementation, fall
+ // back to a scalar loop.
+ //
+ // We also do this for architectures where `size_of::()` isn't
+ // sufficient alignment for `usize`, because it's a weird edge case.
+ if len < USIZE_SIZE || len < align_offset || USIZE_SIZE < mem::align_of::() {
+ return s.iter().all(|b| b.is_ascii());
+ }
+
+ // We always read the first word unaligned, which means `align_offset` is
+ // 0, we'd read the same value again for the aligned read.
+ let offset_to_aligned = if align_offset == 0 { USIZE_SIZE } else { align_offset };
+
+ let start = s.as_ptr();
+ // SAFETY: We verify `len < USIZE_SIZE` above.
+ let first_word = unsafe { (start as *const usize).read_unaligned() };
+
+ if contains_nonascii(first_word) {
+ return false;
+ }
+ // We checked this above, somewhat implicitly. Note that `offset_to_aligned`
+ // is either `align_offset` or `USIZE_SIZE`, both of are explicitly checked
+ // above.
+ debug_assert!(offset_to_aligned <= len);
+
+ // word_ptr is the (properly aligned) usize ptr we use to read the middle chunk of the slice.
+ let mut word_ptr = unsafe { start.add(offset_to_aligned) as *const usize };
+
+ // `byte_pos` is the byte index of `word_ptr`, used for loop end checks.
+ let mut byte_pos = offset_to_aligned;
+
+ // Paranoia check about alignment, since we're about to do a bunch of
+ // unaligned loads. In practice this should be impossible barring a bug in
+ // `align_offset` though.
+ debug_assert_eq!((word_ptr as usize) % mem::align_of::(), 0);
+
+ while byte_pos <= len - USIZE_SIZE {
+ debug_assert!(
+ // Sanity check that the read is in bounds
+ (word_ptr as usize + USIZE_SIZE) <= (start.wrapping_add(len) as usize) &&
+ // And that our assumptions about `byte_pos` hold.
+ (word_ptr as usize) - (start as usize) == byte_pos
+ );
+
+ // Safety: We know `word_ptr` is properly aligned (because of
+ // `align_offset`), and we know that we have enough bytes between `word_ptr` and the end
+ let word = unsafe { word_ptr.read() };
+ if contains_nonascii(word) {
+ return false;
+ }
+
+ byte_pos += USIZE_SIZE;
+ // SAFETY: We know that `byte_pos <= len - USIZE_SIZE`, which means that
+ // after this `add`, `word_ptr` will be at most one-past-the-end.
+ word_ptr = unsafe { word_ptr.add(1) };
+ }
+
+ // If we have anything left over, it should be at-most 1 usize worth of bytes,
+ // which we check with a read_unaligned.
+ if byte_pos == len {
+ return true;
+ }
+
+ // Sanity check to ensure there really is only one `usize` left. This should
+ // be guaranteed by our loop condition.
+ debug_assert!(byte_pos < len && len - byte_pos < USIZE_SIZE);
+
+ // SAFETY: This relies on `len >= USIZE_SIZE`, which we check at the start.
+ let last_word = unsafe { (start.add(len - USIZE_SIZE) as *const usize).read_unaligned() };
+
+ !contains_nonascii(last_word)
+}
+
#[stable(feature = "rust1", since = "1.0.0")]
impl ops::Index for [T]
where
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 0014501d2c4d0..003ed7df36e2a 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -4348,7 +4348,7 @@ impl str {
// We can treat each byte as character here: all multibyte characters
// start with a byte that is not in the ascii range, so we will stop
// there already.
- self.bytes().all(|b| b.is_ascii())
+ self.as_bytes().is_ascii()
}
/// Checks that two strings are an ASCII case-insensitive match.
diff --git a/src/libcore/tests/ascii.rs b/src/libcore/tests/ascii.rs
index 71275d40c4621..57f2de16b2b37 100644
--- a/src/libcore/tests/ascii.rs
+++ b/src/libcore/tests/ascii.rs
@@ -343,3 +343,59 @@ fn test_is_ascii_control() {
" ",
);
}
+
+// `is_ascii` does a good amount of pointer manipulation and has
+// alignment-dependent computation. This is all sanity-checked via
+// `debug_assert!`s, so we test various sizes/alignments thoroughly versus an
+// "obviously correct" baseline function.
+#[test]
+fn test_is_ascii_align_size_thoroughly() {
+ // The "obviously-correct" baseline mentioned above.
+ fn is_ascii_baseline(s: &[u8]) -> bool {
+ s.iter().all(|b| b.is_ascii())
+ }
+
+ // Helper to repeat `l` copies of `b0` followed by `l` copies of `b1`.
+ fn repeat_concat(b0: u8, b1: u8, l: usize) -> Vec {
+ use core::iter::repeat;
+ repeat(b0).take(l).chain(repeat(b1).take(l)).collect()
+ }
+
+ // Miri is too slow for much of this, and in miri `align_offset` always
+ // returns `usize::max_value()` anyway (at the moment), so we just test
+ // lightly.
+ let iter = if cfg!(miri) { 0..5 } else { 0..100 };
+
+ for i in iter {
+ #[cfg(not(miri))]
+ let cases = &[
+ b"a".repeat(i),
+ b"\0".repeat(i),
+ b"\x7f".repeat(i),
+ b"\x80".repeat(i),
+ b"\xff".repeat(i),
+ repeat_concat(b'a', 0x80u8, i),
+ repeat_concat(0x80u8, b'a', i),
+ ];
+
+ #[cfg(miri)]
+ let cases = &[repeat_concat(b'a', 0x80u8, i)];
+
+ for case in cases {
+ for pos in 0..=case.len() {
+ // Potentially misaligned head
+ let prefix = &case[pos..];
+ assert_eq!(is_ascii_baseline(prefix), prefix.is_ascii(),);
+
+ // Potentially misaligned tail
+ let suffix = &case[..case.len() - pos];
+
+ assert_eq!(is_ascii_baseline(suffix), suffix.is_ascii(),);
+
+ // Both head and tail are potentially misaligned
+ let mid = &case[(pos / 2)..(case.len() - (pos / 2))];
+ assert_eq!(is_ascii_baseline(mid), mid.is_ascii(),);
+ }
+ }
+ }
+}
diff --git a/src/librustc_ast/lib.rs b/src/librustc_ast/lib.rs
index ffd2aa61f2866..c32ed1ea48c97 100644
--- a/src/librustc_ast/lib.rs
+++ b/src/librustc_ast/lib.rs
@@ -10,7 +10,7 @@
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)] // For the `transmute` in `P::new`
#![feature(const_panic)]
-#![feature(const_transmute)]
+#![cfg_attr(not(bootstrap), feature(const_fn_transmute))]
#![feature(crate_visibility_modifier)]
#![feature(label_break_value)]
#![feature(nll)]
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index dab85b8fb864d..f2e042cf86aa5 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -19,6 +19,7 @@ use crate::llvm::debuginfo::{
use crate::value::Value;
use log::debug;
+use rustc_ast::ast;
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::const_cstr;
use rustc_data_structures::fingerprint::Fingerprint;
@@ -827,14 +828,60 @@ fn file_metadata_raw(
}
}
+trait MsvcBasicName {
+ fn msvc_basic_name(self) -> &'static str;
+}
+
+impl MsvcBasicName for ast::IntTy {
+ fn msvc_basic_name(self) -> &'static str {
+ match self {
+ ast::IntTy::Isize => "ptrdiff_t",
+ ast::IntTy::I8 => "__int8",
+ ast::IntTy::I16 => "__int16",
+ ast::IntTy::I32 => "__int32",
+ ast::IntTy::I64 => "__int64",
+ ast::IntTy::I128 => "__int128",
+ }
+ }
+}
+
+impl MsvcBasicName for ast::UintTy {
+ fn msvc_basic_name(self) -> &'static str {
+ match self {
+ ast::UintTy::Usize => "size_t",
+ ast::UintTy::U8 => "unsigned __int8",
+ ast::UintTy::U16 => "unsigned __int16",
+ ast::UintTy::U32 => "unsigned __int32",
+ ast::UintTy::U64 => "unsigned __int64",
+ ast::UintTy::U128 => "unsigned __int128",
+ }
+ }
+}
+
+impl MsvcBasicName for ast::FloatTy {
+ fn msvc_basic_name(self) -> &'static str {
+ match self {
+ ast::FloatTy::F32 => "float",
+ ast::FloatTy::F64 => "double",
+ }
+ }
+}
+
fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
debug!("basic_type_metadata: {:?}", t);
+ // When targeting MSVC, emit MSVC style type names for compatibility with
+ // .natvis visualizers (and perhaps other existing native debuggers?)
+ let msvc_like_names = cx.tcx.sess.target.target.options.is_like_msvc;
+
let (name, encoding) = match t.kind {
ty::Never => ("!", DW_ATE_unsigned),
ty::Tuple(ref elements) if elements.is_empty() => ("()", DW_ATE_unsigned),
ty::Bool => ("bool", DW_ATE_boolean),
ty::Char => ("char", DW_ATE_unsigned_char),
+ ty::Int(int_ty) if msvc_like_names => (int_ty.msvc_basic_name(), DW_ATE_signed),
+ ty::Uint(uint_ty) if msvc_like_names => (uint_ty.msvc_basic_name(), DW_ATE_unsigned),
+ ty::Float(float_ty) if msvc_like_names => (float_ty.msvc_basic_name(), DW_ATE_float),
ty::Int(int_ty) => (int_ty.name_str(), DW_ATE_signed),
ty::Uint(uint_ty) => (uint_ty.name_str(), DW_ATE_unsigned),
ty::Float(float_ty) => (float_ty.name_str(), DW_ATE_float),
@@ -851,7 +898,30 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
)
};
- ty_metadata
+ if !msvc_like_names {
+ return ty_metadata;
+ }
+
+ let typedef_name = match t.kind {
+ ty::Int(int_ty) => int_ty.name_str(),
+ ty::Uint(uint_ty) => uint_ty.name_str(),
+ ty::Float(float_ty) => float_ty.name_str(),
+ _ => return ty_metadata,
+ };
+
+ let typedef_metadata = unsafe {
+ llvm::LLVMRustDIBuilderCreateTypedef(
+ DIB(cx),
+ ty_metadata,
+ typedef_name.as_ptr().cast(),
+ typedef_name.len(),
+ unknown_file_metadata(cx),
+ 0,
+ None,
+ )
+ };
+
+ typedef_metadata
}
fn foreign_type_metadata(
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index 7beb4fc897472..64f5e103f0b0d 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1703,6 +1703,16 @@ extern "C" {
Encoding: c_uint,
) -> &'a DIBasicType;
+ pub fn LLVMRustDIBuilderCreateTypedef(
+ Builder: &DIBuilder<'a>,
+ Type: &'a DIBasicType,
+ Name: *const c_char,
+ NameLen: size_t,
+ File: &'a DIFile,
+ LineNo: c_uint,
+ Scope: Option<&'a DIScope>,
+ ) -> &'a DIDerivedType;
+
pub fn LLVMRustDIBuilderCreatePointerType(
Builder: &DIBuilder<'a>,
PointeeTy: &'a DIType,
diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
index 7a07da0d3a65b..e64aafa599fd8 100644
--- a/src/librustc_codegen_ssa/back/linker.rs
+++ b/src/librustc_codegen_ssa/back/linker.rs
@@ -619,9 +619,9 @@ impl<'a> Linker for GccLinker<'a> {
// Some versions of `gcc` add it implicitly, some (e.g. `musl-gcc`) don't,
// so we just always add it.
fn add_eh_frame_header(&mut self) {
- // The condition here is "uses ELF" basically.
if !self.sess.target.target.options.is_like_osx
&& !self.sess.target.target.options.is_like_windows
+ && !self.sess.target.target.options.is_like_solaris
&& self.sess.target.target.target_os != "uefi"
{
self.linker_arg("--eh-frame-hdr");
diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs
index a64489c04c81d..20d440433cbb0 100644
--- a/src/librustc_codegen_ssa/debuginfo/type_names.rs
+++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs
@@ -47,7 +47,12 @@ pub fn push_debuginfo_type_name<'tcx>(
push_type_params(tcx, substs, output, visited);
}
ty::Tuple(component_types) => {
- output.push('(');
+ if cpp_like_names {
+ output.push_str("tuple<");
+ } else {
+ output.push('(');
+ }
+
for component_type in component_types {
push_debuginfo_type_name(tcx, component_type.expect_ty(), true, output, visited);
output.push_str(", ");
@@ -56,7 +61,12 @@ pub fn push_debuginfo_type_name<'tcx>(
output.pop();
output.pop();
}
- output.push(')');
+
+ if cpp_like_names {
+ output.push('>');
+ } else {
+ output.push(')');
+ }
}
ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl }) => {
if !cpp_like_names {
diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs
index 32481bf2b9574..0da3693af4fb6 100644
--- a/src/librustc_feature/active.rs
+++ b/src/librustc_feature/active.rs
@@ -573,6 +573,9 @@ declare_features! (
/// Lazily evaluate constants. This allows constants to depend on type parameters.
(active, lazy_normalization_consts, "1.46.0", Some(72219), None),
+ /// Alloc calling `transmute` in const fn
+ (active, const_fn_transmute, "1.46.0", Some(53605), None),
+
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
diff --git a/src/librustc_middle/lib.rs b/src/librustc_middle/lib.rs
index 96b8ca27183ed..c2b14cb2e8408 100644
--- a/src/librustc_middle/lib.rs
+++ b/src/librustc_middle/lib.rs
@@ -30,7 +30,7 @@
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)]
#![feature(const_panic)]
-#![feature(const_transmute)]
+#![cfg_attr(not(bootstrap), feature(const_fn_transmute))]
#![feature(core_intrinsics)]
#![feature(discriminant_kind)]
#![feature(drain_filter)]
diff --git a/src/librustc_middle/ty/print/pretty.rs b/src/librustc_middle/ty/print/pretty.rs
index 9dda208b5a0da..3809c8d245bbe 100644
--- a/src/librustc_middle/ty/print/pretty.rs
+++ b/src/librustc_middle/ty/print/pretty.rs
@@ -393,7 +393,7 @@ pub trait PrettyPrinter<'tcx>:
.tcx()
.item_children(visible_parent)
.iter()
- .find(|child| child.res.def_id() == def_id)
+ .find(|child| child.res.opt_def_id() == Some(def_id))
.map(|child| child.ident.name);
if let Some(reexport) = reexport {
*name = reexport;
diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs
index 7041e2db27e32..52b1eba3b93c2 100644
--- a/src/librustc_mir/transform/qualify_min_const_fn.rs
+++ b/src/librustc_mir/transform/qualify_min_const_fn.rs
@@ -6,6 +6,7 @@ use rustc_middle::ty::subst::GenericArgKind;
use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
+use rustc_target::spec::abi::Abi::RustIntrinsic;
use std::borrow::Cow;
type McfResult = Result<(), (Span, Cow<'static, str>)>;
@@ -418,6 +419,20 @@ fn check_terminator(
));
}
+ // HACK: This is to "unstabilize" the `transmute` intrinsic
+ // within const fns. `transmute` is allowed in all other const contexts.
+ // This won't really scale to more intrinsics or functions. Let's allow const
+ // transmutes in const fn before we add more hacks to this.
+ if tcx.fn_sig(fn_def_id).abi() == RustIntrinsic
+ && tcx.item_name(fn_def_id) == sym::transmute
+ && !feature_allowed(tcx, def_id, sym::const_fn_transmute)
+ {
+ return Err((
+ span,
+ "can only call `transmute` from const items, not `const fn`".into(),
+ ));
+ }
+
check_operand(tcx, func, span, fn_def_id, body)?;
for arg in args {
diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs
index e469ca80c590a..fc41ce5d53511 100644
--- a/src/librustc_resolve/late/diagnostics.rs
+++ b/src/librustc_resolve/late/diagnostics.rs
@@ -100,9 +100,7 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
let ident_span = path.last().map_or(span, |ident| ident.ident.span);
let ns = source.namespace();
let is_expected = &|res| source.is_expected(res);
- let is_enum_variant = &|res| {
- if let Res::Def(DefKind::Variant, _) = res { true } else { false }
- };
+ let is_enum_variant = &|res| matches!(res, Res::Def(DefKind::Variant, _));
// Make the base error.
let expected = source.descr_expected();
@@ -168,9 +166,9 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
if ["this", "my"].contains(&&*item_str.as_str())
&& self.self_value_is_available(path[0].ident.span, span)
{
- err.span_suggestion(
+ err.span_suggestion_short(
span,
- "did you mean",
+ "you might have meant to use `self` here instead",
"self".to_string(),
Applicability::MaybeIncorrect,
);
@@ -1044,6 +1042,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
lifetime_ref
);
err.span_label(lifetime_ref.span, "undeclared lifetime");
+ let mut suggests_in_band = false;
for missing in &self.missing_named_lifetime_spots {
match missing {
MissingLifetimeSpot::Generics(generics) => {
@@ -1057,6 +1056,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
}) {
(param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
} else {
+ suggests_in_band = true;
(generics.span, format!("<{}>", lifetime_ref))
};
err.span_suggestion(
@@ -1084,6 +1084,15 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
}
}
}
+ if nightly_options::is_nightly_build()
+ && !self.tcx.features().in_band_lifetimes
+ && suggests_in_band
+ {
+ err.help(
+ "if you want to experiment with in-band lifetime bindings, \
+ add `#![feature(in_band_lifetimes)]` to the crate attributes",
+ );
+ }
err.emit();
}
diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs
index 37fb7548e1d54..6b3dbd0bf7a05 100644
--- a/src/librustc_span/symbol.rs
+++ b/src/librustc_span/symbol.rs
@@ -226,6 +226,7 @@ symbols! {
const_eval_limit,
const_extern_fn,
const_fn,
+ const_fn_transmute,
const_fn_union,
const_generics,
const_if_match,
diff --git a/src/llvm-project b/src/llvm-project
index 6c040dd86ed62..d134a53927fa0 160000
--- a/src/llvm-project
+++ b/src/llvm-project
@@ -1 +1 @@
-Subproject commit 6c040dd86ed62d38e585279027486e6efc42fb36
+Subproject commit d134a53927fa033ae7e0f3e8ee872ff2dc71468d
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 063b6acc604ea..c92cf65f98af7 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -762,6 +762,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType(
return wrap(Builder->createBasicType(StringRef(Name, NameLen), SizeInBits, Encoding));
}
+extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTypedef(
+ LLVMRustDIBuilderRef Builder, LLVMMetadataRef Type, const char *Name, size_t NameLen,
+ LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Scope) {
+ return wrap(Builder->createTypedef(
+ unwrap(Type), StringRef(Name, NameLen), unwrap(File),
+ LineNo, unwrap(Scope)));
+}
+
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType(
LLVMRustDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,
diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs
index c2db5218e6842..b7fcfeef090aa 100644
--- a/src/test/debuginfo/simple-tuple.rs
+++ b/src/test/debuginfo/simple-tuple.rs
@@ -123,6 +123,48 @@
// lldbg-check:[...]$6 = { 0 = 15 1 = 16 }
// lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 }
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx noPadding8,d
+// cdb-check:noPadding8,d [...]: (-100, 100) [Type: tuple]
+// cdb-check:[...][0] : -100 [Type: [...]]
+// cdb-check:[...][1] : 100 [Type: [...]]
+// cdb-command:dx noPadding16,d
+// cdb-check:noPadding16,d [...]: (0, 1, 2) [Type: tuple]
+// cdb-check:[...][0] : 0 [Type: [...]]
+// cdb-check:[...][1] : 1 [Type: [...]]
+// cdb-check:[...][2] : 2 [Type: [...]]
+// cdb-command:dx noPadding32,d
+// cdb-check:noPadding32,d [...]: (3, 4.5[...], 5) [Type: tuple]
+// cdb-check:[...][0] : 3 [Type: [...]]
+// cdb-check:[...][1] : 4.5[...] [Type: [...]]
+// cdb-check:[...][2] : 5 [Type: [...]]
+// cdb-command:dx noPadding64,d
+// cdb-check:noPadding64,d [...]: (6, 7.5[...], 8) [Type: tuple]
+// cdb-check:[...][0] : 6 [Type: [...]]
+// cdb-check:[...][1] : 7.500000 [Type: [...]]
+// cdb-check:[...][2] : 8 [Type: [...]]
+
+// cdb-command:dx internalPadding1,d
+// cdb-check:internalPadding1,d [...]: (9, 10) [Type: tuple]
+// cdb-check:[...][0] : 9 [Type: short]
+// cdb-check:[...][1] : 10 [Type: int]
+// cdb-command:dx internalPadding2,d
+// cdb-check:internalPadding2,d [...]: (11, 12, 13, 14) [Type: tuple]
+// cdb-check:[...][0] : 11 [Type: [...]]
+// cdb-check:[...][1] : 12 [Type: [...]]
+// cdb-check:[...][2] : 13 [Type: [...]]
+// cdb-check:[...][3] : 14 [Type: [...]]
+
+// cdb-command:dx paddingAtEnd,d
+// cdb-check:paddingAtEnd,d [...]: (15, 16) [Type: tuple]
+// cdb-check:[...][0] : 15 [Type: [...]]
+// cdb-check:[...][1] : 16 [Type: [...]]
+
+
#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs
index e0f940ca7a1c1..0447d8e9ddeb0 100644
--- a/src/test/debuginfo/tuple-in-tuple.rs
+++ b/src/test/debuginfo/tuple-in-tuple.rs
@@ -59,6 +59,73 @@
// lldbg-check:[...]$6 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
// lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx no_padding1,d
+// cdb-check:no_padding1,d [...]: ((0, 1), 2, 3) [Type: tuple, u32, u32>]
+// cdb-check:[...][0] : (0, 1) [Type: tuple]
+// cdb-check:[...][1] : 2 [Type: [...]]
+// cdb-check:[...][2] : 3 [Type: [...]]
+// cdb-command:dx no_padding1.__0,d
+// cdb-check:no_padding1.__0,d [...]: (0, 1) [Type: tuple]
+// cdb-check:[...][0] : 0 [Type: [...]]
+// cdb-check:[...][1] : 1 [Type: [...]]
+// cdb-command:dx no_padding2,d
+// cdb-check:no_padding2,d [...]: (4, (5, 6), 7) [Type: tuple, u32>]
+// cdb-check:[...][0] : 4 [Type: [...]]
+// cdb-check:[...][1] : (5, 6) [Type: tuple]
+// cdb-check:[...][2] : 7 [Type: [...]]
+// cdb-command:dx no_padding2.__1,d
+// cdb-check:no_padding2.__1,d [...]: (5, 6) [Type: tuple]
+// cdb-check:[...][0] : 5 [Type: [...]]
+// cdb-check:[...][1] : 6 [Type: [...]]
+// cdb-command:dx no_padding3,d
+// cdb-check:no_padding3,d [...]: (8, 9, (10, 11)) [Type: tuple>]
+// cdb-check:[...][0] : 8 [Type: [...]]
+// cdb-check:[...][1] : 9 [Type: [...]]
+// cdb-check:[...][2] : (10, 11) [Type: tuple]
+// cdb-command:dx no_padding3.__2,d
+// cdb-check:no_padding3.__2,d [...]: (10, 11) [Type: tuple]
+// cdb-check:[...][0] : 10 [Type: [...]]
+// cdb-check:[...][1] : 11 [Type: [...]]
+
+// cdb-command:dx internal_padding1,d
+// cdb-check:internal_padding1,d [...]: (12, (13, 14)) [Type: tuple>]
+// cdb-check:[...][0] : 12 [Type: [...]]
+// cdb-check:[...][1] : (13, 14) [Type: tuple]
+// cdb-command:dx internal_padding1.__1,d
+// cdb-check:internal_padding1.__1,d [...]: (13, 14) [Type: tuple]
+// cdb-check:[...][0] : 13 [Type: [...]]
+// cdb-check:[...][1] : 14 [Type: [...]]
+// cdb-command:dx internal_padding2,d
+// cdb-check:internal_padding2,d [...]: (15, (16, 17)) [Type: tuple>]
+// cdb-check:[...][0] : 15 [Type: [...]]
+// cdb-check:[...][1] : (16, 17) [Type: tuple]
+// cdb-command:dx internal_padding2.__1,d
+// cdb-check:internal_padding2.__1,d [...]: (16, 17) [Type: tuple]
+// cdb-check:[...][0] : 16 [Type: [...]]
+// cdb-check:[...][1] : 17 [Type: [...]]
+
+// cdb-command:dx padding_at_end1,d
+// cdb-check:padding_at_end1,d [...]: (18, (19, 20)) [Type: tuple>]
+// cdb-check:[...][0] : 18 [Type: [...]]
+// cdb-check:[...][1] : (19, 20) [Type: tuple]
+// cdb-command:dx padding_at_end1.__1,d
+// cdb-check:padding_at_end1.__1,d [...][Type: tuple]
+// cdb-check:[...][0] : 19 [Type: [...]]
+// cdb-check:[...][1] : 20 [Type: [...]]
+// cdb-command:dx padding_at_end2,d
+// cdb-check:padding_at_end2,d [...]: ((21, 22), 23) [Type: tuple, i32>]
+// cdb-check:[...][0] : (21, 22) [Type: tuple]
+// cdb-check:[...][1] : 23 [Type: [...]]
+// cdb-command:dx padding_at_end2.__0,d
+// cdb-check:padding_at_end2.__0,d [...]: (21, 22) [Type: tuple]
+// cdb-check:[...][0] : 21 [Type: [...]]
+// cdb-check:[...][1] : 22 [Type: [...]]
+
#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
diff --git a/src/test/ui/consts/const-eval/dangling.rs b/src/test/ui/consts/const-eval/dangling.rs
index c6b8e8eb61181..78cf000db03d1 100644
--- a/src/test/ui/consts/const-eval/dangling.rs
+++ b/src/test/ui/consts/const-eval/dangling.rs
@@ -1,4 +1,4 @@
-#![feature(const_transmute, const_raw_ptr_deref)]
+#![feature(const_raw_ptr_deref)]
use std::{mem, usize};
diff --git a/src/test/ui/consts/const-eval/double_check.rs b/src/test/ui/consts/const-eval/double_check.rs
index f156d259abb20..56ca0aa1f1587 100644
--- a/src/test/ui/consts/const-eval/double_check.rs
+++ b/src/test/ui/consts/const-eval/double_check.rs
@@ -20,4 +20,6 @@ static FOO: (&Foo, &Bar) = unsafe {(
Union { u8: &BAR }.bar,
)};
+static FOO2: (&Foo, &Bar) = unsafe {(std::mem::transmute(&BAR), std::mem::transmute(&BAR))};
+
fn main() {}
diff --git a/src/test/ui/consts/const-eval/double_check2.rs b/src/test/ui/consts/const-eval/double_check2.rs
index 7c222b113cd7d..8402d62885664 100644
--- a/src/test/ui/consts/const-eval/double_check2.rs
+++ b/src/test/ui/consts/const-eval/double_check2.rs
@@ -17,5 +17,7 @@ static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior
Union { u8: &BAR }.foo,
Union { u8: &BAR }.bar,
)};
+static FOO2: (&Foo, &Bar) = unsafe {(std::mem::transmute(&BAR), std::mem::transmute(&BAR))};
+//~^ undefined behavior
fn main() {}
diff --git a/src/test/ui/consts/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr
index 513b71f0c6fdc..84f60809156d0 100644
--- a/src/test/ui/consts/const-eval/double_check2.stderr
+++ b/src/test/ui/consts/const-eval/double_check2.stderr
@@ -9,6 +9,14 @@ LL | | )};
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
-error: aborting due to previous error
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/double_check2.rs:20:1
+ |
+LL | static FOO2: (&Foo, &Bar) = unsafe {(std::mem::transmute(&BAR), std::mem::transmute(&BAR))};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x05 at .1.., but expected a valid enum tag
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/issue-55541.rs b/src/test/ui/consts/const-eval/issue-55541.rs
index 4c9e10d9cbe16..fa5a493abde21 100644
--- a/src/test/ui/consts/const-eval/issue-55541.rs
+++ b/src/test/ui/consts/const-eval/issue-55541.rs
@@ -2,7 +2,7 @@
// Test that we can handle newtypes wrapping extern types
-#![feature(extern_types, const_transmute)]
+#![feature(extern_types)]
use std::marker::PhantomData;
diff --git a/src/test/ui/consts/const-eval/transmute-const.rs b/src/test/ui/consts/const-eval/transmute-const.rs
index 48f2b39832e68..1cfad00ca76df 100644
--- a/src/test/ui/consts/const-eval/transmute-const.rs
+++ b/src/test/ui/consts/const-eval/transmute-const.rs
@@ -1,5 +1,3 @@
-#![feature(const_transmute)]
-
use std::mem;
static FOO: bool = unsafe { mem::transmute(3u8) };
diff --git a/src/test/ui/consts/const-eval/transmute-const.stderr b/src/test/ui/consts/const-eval/transmute-const.stderr
index 0de6ead4f525f..46a404982778d 100644
--- a/src/test/ui/consts/const-eval/transmute-const.stderr
+++ b/src/test/ui/consts/const-eval/transmute-const.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/transmute-const.rs:5:1
+ --> $DIR/transmute-const.rs:3:1
|
LL | static FOO: bool = unsafe { mem::transmute(3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03, but expected a boolean
diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs
index 136b33208c293..dc94f2368c9b6 100644
--- a/src/test/ui/consts/const-eval/ub-enum.rs
+++ b/src/test/ui/consts/const-eval/ub-enum.rs
@@ -1,5 +1,5 @@
// normalize-stderr-64bit "0x0000000000" -> "0x00"
-#![feature(const_transmute, never_type)]
+#![feature(never_type)]
#![allow(const_err)] // make sure we cannot allow away the errors tested here
use std::mem;
diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/src/test/ui/consts/const-eval/ub-int-array.rs
index 8907b0c160f88..6801c7fa3ff08 100644
--- a/src/test/ui/consts/const-eval/ub-int-array.rs
+++ b/src/test/ui/consts/const-eval/ub-int-array.rs
@@ -1,4 +1,3 @@
-#![feature(const_transmute)]
#![allow(const_err)] // make sure we cannot allow away the errors tested here
//! Test the "array of int" fast path in validity checking, and in particular whether it
diff --git a/src/test/ui/consts/const-eval/ub-int-array.stderr b/src/test/ui/consts/const-eval/ub-int-array.stderr
index b4a3c63b5a103..92f654847df32 100644
--- a/src/test/ui/consts/const-eval/ub-int-array.stderr
+++ b/src/test/ui/consts/const-eval/ub-int-array.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:15:1
+ --> $DIR/ub-int-array.rs:14:1
|
LL | / const UNINIT_INT_0: [u32; 3] = unsafe {
LL | |
@@ -13,7 +13,7 @@ LL | | };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:24:1
+ --> $DIR/ub-int-array.rs:23:1
|
LL | / const UNINIT_INT_1: [u32; 3] = unsafe {
LL | |
@@ -27,7 +27,7 @@ LL | | };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-int-array.rs:44:1
+ --> $DIR/ub-int-array.rs:43:1
|
LL | / const UNINIT_INT_2: [u32; 3] = unsafe {
LL | |
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs
index 1f46b6c98ad2f..4b90b892dce9a 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.rs
+++ b/src/test/ui/consts/const-eval/ub-nonnull.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, const_transmute)]
+#![feature(rustc_attrs)]
#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here
use std::mem;
diff --git a/src/test/ui/consts/const-eval/ub-ref.rs b/src/test/ui/consts/const-eval/ub-ref.rs
index 10f4c8c03330e..e8b101fed6d2f 100644
--- a/src/test/ui/consts/const-eval/ub-ref.rs
+++ b/src/test/ui/consts/const-eval/ub-ref.rs
@@ -1,5 +1,4 @@
// ignore-tidy-linelength
-#![feature(const_transmute)]
#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here
use std::mem;
diff --git a/src/test/ui/consts/const-eval/ub-ref.stderr b/src/test/ui/consts/const-eval/ub-ref.stderr
index a219679f18264..cd270f2a533bf 100644
--- a/src/test/ui/consts/const-eval/ub-ref.stderr
+++ b/src/test/ui/consts/const-eval/ub-ref.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:7:1
+ --> $DIR/ub-ref.rs:6:1
|
LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
@@ -7,7 +7,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:11:1
+ --> $DIR/ub-ref.rs:10:1
|
LL | const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned box (required 2 byte alignment but found 1)
@@ -15,7 +15,7 @@ LL | const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:15:1
+ --> $DIR/ub-ref.rs:14:1
|
LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a NULL reference
@@ -23,7 +23,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:18:1
+ --> $DIR/ub-ref.rs:17:1
|
LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a NULL box
@@ -31,7 +31,7 @@ LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:24:1
+ --> $DIR/ub-ref.rs:23:1
|
LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc16, but expected initialized plain (non-pointer) bytes
@@ -39,7 +39,7 @@ LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:27:1
+ --> $DIR/ub-ref.rs:26:1
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at ., but expected plain (non-pointer) bytes
@@ -47,7 +47,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:30:1
+ --> $DIR/ub-ref.rs:29:1
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at ., but expected plain (non-pointer) bytes
@@ -55,7 +55,7 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:33:1
+ --> $DIR/ub-ref.rs:32:1
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (created from integer)
@@ -63,7 +63,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref.rs:36:1
+ --> $DIR/ub-ref.rs:35:1
|
LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (created from integer)
diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs
index e7350ae271673..b81bca3849431 100644
--- a/src/test/ui/consts/const-eval/ub-uninhabit.rs
+++ b/src/test/ui/consts/const-eval/ub-uninhabit.rs
@@ -1,4 +1,3 @@
-#![feature(const_transmute)]
#![allow(const_err)] // make sure we cannot allow away the errors tested here
use std::mem;
diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.stderr
index 8ce4279a8b7dd..16f5316a44230 100644
--- a/src/test/ui/consts/const-eval/ub-uninhabit.stderr
+++ b/src/test/ui/consts/const-eval/ub-uninhabit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:15:1
+ --> $DIR/ub-uninhabit.rs:14:1
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Bar
@@ -7,7 +7,7 @@ LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:18:1
+ --> $DIR/ub-uninhabit.rs:17:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Bar at .
@@ -15,7 +15,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:21:1
+ --> $DIR/ub-uninhabit.rs:20:1
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Bar at [0]
diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs
index baab14dc16141..5d19276557eb6 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.rs
+++ b/src/test/ui/consts/const-eval/ub-upvars.rs
@@ -1,4 +1,3 @@
-#![feature(const_transmute)]
#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here
use std::mem;
diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr
index 972c9eb38c81e..afd6c9035cabf 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.stderr
+++ b/src/test/ui/consts/const-eval/ub-upvars.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-upvars.rs:6:1
+ --> $DIR/ub-upvars.rs:5:1
|
LL | / const BAD_UPVAR: &dyn FnOnce() = &{
LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
index f69f6a1109f76..3e148af8de9d5 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
@@ -1,5 +1,4 @@
// ignore-tidy-linelength
-#![feature(const_transmute)]
#![allow(unused)]
#![allow(const_err)] // make sure we cannot allow away the errors tested here
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
index 47d29ffc9b3c1..b7509108abc23 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:32:1
+ --> $DIR/ub-wide-ptr.rs:31:1
|
LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -7,7 +7,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:34:1
+ --> $DIR/ub-wide-ptr.rs:33:1
|
LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object at .0
@@ -15,7 +15,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:37:1
+ --> $DIR/ub-wide-ptr.rs:36:1
|
LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -23,7 +23,7 @@ LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:40:1
+ --> $DIR/ub-wide-ptr.rs:39:1
|
LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -31,7 +31,7 @@ LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:42:1
+ --> $DIR/ub-wide-ptr.rs:41:1
|
LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -39,7 +39,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize:
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:46:1
+ --> $DIR/ub-wide-ptr.rs:45:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized data in `str` at .
@@ -47,7 +47,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:49:1
+ --> $DIR/ub-wide-ptr.rs:48:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:: { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized data in `str` at ..0
@@ -55,7 +55,7 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:56:1
+ --> $DIR/ub-wide-ptr.rs:55:1
|
LL | / const SLICE_LENGTH_UNINIT: &[u8] = unsafe {
LL | |
@@ -67,7 +67,7 @@ LL | | };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:62:1
+ --> $DIR/ub-wide-ptr.rs:61:1
|
LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -75,7 +75,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:65:1
+ --> $DIR/ub-wide-ptr.rs:64:1
|
LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -83,7 +83,7 @@ LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:68:1
+ --> $DIR/ub-wide-ptr.rs:67:1
|
LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (going beyond the bounds of its allocation)
@@ -91,7 +91,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:71:1
+ --> $DIR/ub-wide-ptr.rs:70:1
|
LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in wide pointer
@@ -99,7 +99,7 @@ LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:75:1
+ --> $DIR/ub-wide-ptr.rs:74:1
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03 at .[0], but expected a boolean
@@ -107,7 +107,7 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:81:1
+ --> $DIR/ub-wide-ptr.rs:80:1
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03 at ..0, but expected a boolean
@@ -115,7 +115,7 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:84:1
+ --> $DIR/ub-wide-ptr.rs:83:1
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03 at ..1[0], but expected a boolean
@@ -123,7 +123,7 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:91:1
+ --> $DIR/ub-wide-ptr.rs:90:1
|
LL | / const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe {
LL | |
@@ -135,7 +135,7 @@ LL | | };
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:99:1
+ --> $DIR/ub-wide-ptr.rs:98:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: &dyn Trait = unsafe { mem::transmute((&92u8, &3u8)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered too small vtable
@@ -143,7 +143,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: &dyn Trait = unsafe { mem::transmute((&92u8
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:102:1
+ --> $DIR/ub-wide-ptr.rs:101:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: &dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered too small vtable
@@ -151,7 +151,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: &dyn Trait = unsafe { mem::transmute((&92u8
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:105:1
+ --> $DIR/ub-wide-ptr.rs:104:1
|
LL | const TRAIT_OBJ_INT_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, 4usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling vtable pointer in wide pointer
@@ -159,7 +159,7 @@ LL | const TRAIT_OBJ_INT_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, 4u
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:107:1
+ --> $DIR/ub-wide-ptr.rs:106:1
|
LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned vtable pointer in wide pointer
@@ -167,7 +167,7 @@ LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:109:1
+ --> $DIR/ub-wide-ptr.rs:108:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function)
@@ -175,7 +175,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:111:1
+ --> $DIR/ub-wide-ptr.rs:110:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function)
@@ -183,7 +183,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:113:1
+ --> $DIR/ub-wide-ptr.rs:112:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: &dyn Trait = unsafe { mem::transmute((&92u8, &[&42u8; 8])) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function)
@@ -191,7 +191,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: &dyn Trait = unsafe { mem::transmut
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:117:1
+ --> $DIR/ub-wide-ptr.rs:116:1
|
LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x03 at .., but expected a boolean
@@ -199,7 +199,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:121:1
+ --> $DIR/ub-wide-ptr.rs:120:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling vtable pointer in wide pointer
@@ -207,7 +207,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-wide-ptr.rs:123:1
+ --> $DIR/ub-wide-ptr.rs:122:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered too small vtable
@@ -215,13 +215,13 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:129:5
+ --> $DIR/ub-wide-ptr.rs:128:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inbounds test failed: 0x0 is not a valid pointer
error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:133:5
+ --> $DIR/ub-wide-ptr.rs:132:5
|
LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: pointer must be in-bounds at offset N, but is outside bounds of allocN which has size N
diff --git a/src/test/ui/consts/const-eval/valid-const.rs b/src/test/ui/consts/const-eval/valid-const.rs
index 65c642d750b51..9e4707182d596 100644
--- a/src/test/ui/consts/const-eval/valid-const.rs
+++ b/src/test/ui/consts/const-eval/valid-const.rs
@@ -1,7 +1,6 @@
// check-pass
// Some constants that *are* valid
-#![feature(const_transmute)]
#![deny(const_err)]
use std::mem;
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs
index f18e00fd633ea..48a989bf58863 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs
+++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs
@@ -1,5 +1,5 @@
#![feature(const_fn)]
-#![feature(const_transmute)]
+#![feature(const_fn_transmute)]
const fn foo() -> ! {
unsafe { std::mem::transmute(()) }
diff --git a/src/test/ui/consts/consts-in-patterns.rs b/src/test/ui/consts/consts-in-patterns.rs
index ee1e3cc22f77d..d51215447d6ca 100644
--- a/src/test/ui/consts/consts-in-patterns.rs
+++ b/src/test/ui/consts/consts-in-patterns.rs
@@ -1,5 +1,4 @@
// run-pass
-#![feature(const_transmute)]
const FOO: isize = 10;
const BAR: isize = 3;
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
index d55090c75e614..eb250081d6a72 100644
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
+++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
@@ -17,11 +17,6 @@ help: skipping check that does not even have a feature gate
|
LL | my_fn();
| ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/abi-mismatch.rs:16:40
- |
-LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr
index 21f11dda5a667..d782a3633b243 100644
--- a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr
+++ b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr
@@ -17,11 +17,6 @@ help: skipping check that does not even have a feature gate
|
LL | let _v = x == x;
| ^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/ptr_arith.rs:15:20
- |
-LL | let x: usize = std::mem::transmute(&0);
- | ^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/src/test/ui/consts/transmute-const.rs b/src/test/ui/consts/transmute-const.rs
index e24f89cdffdff..5044d99ec5183 100644
--- a/src/test/ui/consts/transmute-const.rs
+++ b/src/test/ui/consts/transmute-const.rs
@@ -1,7 +1,5 @@
// run-pass
-#![feature(const_transmute)]
-
use std::mem;
#[repr(transparent)]
diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr
index 0eab2dc0ee05f..33d74feead513 100644
--- a/src/test/ui/error-codes/E0261.stderr
+++ b/src/test/ui/error-codes/E0261.stderr
@@ -5,6 +5,8 @@ LL | fn foo(x: &'a str) { }
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/E0261.rs:5:9
@@ -13,6 +15,8 @@ LL | struct Foo {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | x: &'a str,
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 2 previous errors
diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs
new file mode 100644
index 0000000000000..981680b5d1fad
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.rs
@@ -0,0 +1,38 @@
+use std::mem;
+
+#[repr(transparent)]
+struct Foo(u32);
+
+const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };
+
+const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+
+const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+//~| ERROR call to unsafe function is unsafe and requires unsafe function or block
+
+const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+//~| ERROR call to unsafe function is unsafe and requires unsafe function or block
+
+const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+//~^ ERROR can only call `transmute` from const items, not `const fn`
+//~| ERROR call to unsafe function is unsafe and requires unsafe function or block
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr
new file mode 100644
index 0000000000000..44430fd577d88
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-const_fn_transmute.stderr
@@ -0,0 +1,109 @@
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:8:43
+ |
+LL | const fn transmute_fn() -> u32 { unsafe { mem::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:11:53
+ |
+LL | const fn transmute_fn_intrinsic() -> u32 { unsafe { std::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:14:58
+ |
+LL | const fn transmute_fn_core_intrinsic() -> u32 { unsafe { core::intrinsics::transmute(Foo(3)) } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:17:48
+ |
+LL | const unsafe fn unsafe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:20:58
+ |
+LL | const unsafe fn unsafe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:23:63
+ |
+LL | const unsafe fn unsafe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:26:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:30:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0723]: can only call `transmute` from const items, not `const fn`
+ --> $DIR/feature-gate-const_fn_transmute.rs:34:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57563 for more information
+ = help: add `#![feature(const_fn)]` to the crate attributes to enable
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:26:39
+ |
+LL | const fn safe_transmute_fn() -> u32 { mem::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:30:49
+ |
+LL | const fn safe_transmute_fn_intrinsic() -> u32 { std::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/feature-gate-const_fn_transmute.rs:34:54
+ |
+LL | const fn safe_transmute_fn_core_intrinsic() -> u32 { core::intrinsics::transmute(Foo(3)) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 12 previous errors
+
+Some errors have detailed explanations: E0133, E0723.
+For more information about an error, try `rustc --explain E0133`.
diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.rs b/src/test/ui/feature-gates/feature-gate-const_transmute.rs
deleted file mode 100644
index da532643d9457..0000000000000
--- a/src/test/ui/feature-gates/feature-gate-const_transmute.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-use std::mem;
-
-#[repr(transparent)]
-struct Foo(u32);
-
-const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };
-//~^ ERROR `std::intrinsics::transmute` is not yet stable as a const fn
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr b/src/test/ui/feature-gates/feature-gate-const_transmute.stderr
deleted file mode 100644
index 772e8d294781a..0000000000000
--- a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: `std::intrinsics::transmute` is not yet stable as a const fn
- --> $DIR/feature-gate-const_transmute.rs:6:38
- |
-LL | const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) };
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add `#![feature(const_transmute)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
index bbf3ea8a89f23..0f0406b8e17d8 100644
--- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
+++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
@@ -5,6 +5,8 @@ LL | fn foo(x: &'x u8) -> &'x u8 { x }
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'x` here: `<'x>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'x`
--> $DIR/feature-gate-in_band_lifetimes.rs:3:23
@@ -13,6 +15,8 @@ LL | fn foo(x: &'x u8) -> &'x u8 { x }
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'x` here: `<'x>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:15:12
@@ -28,6 +32,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn inner_2(&self) -> &'b u8 {
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b, 'a> X<'b> {
@@ -44,6 +49,8 @@ LL | impl X<'b> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'b` here: `<'b>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:25:27
@@ -51,6 +58,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn inner_3(&self) -> &'b u8 {
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> X<'b> {
@@ -67,6 +75,8 @@ LL | impl Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:35:25
@@ -74,6 +84,7 @@ error[E0261]: use of undeclared lifetime name `'a`
LL | fn inner(&self) -> &'a u8 {
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | impl<'a> Y<&'a u8> {
@@ -89,6 +100,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn any_lifetime() -> &'b u8;
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | trait MyTrait<'b, 'a> {
@@ -104,6 +116,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn borrowed_lifetime(&'b self) -> &'b u8;
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | trait MyTrait<'b, 'a> {
@@ -119,6 +132,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn borrowed_lifetime(&'b self) -> &'b u8;
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | trait MyTrait<'b, 'a> {
@@ -135,6 +149,8 @@ LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:50:25
@@ -143,6 +159,8 @@ LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:53:31
@@ -150,6 +168,7 @@ error[E0261]: use of undeclared lifetime name `'a`
LL | fn my_lifetime(&self) -> &'a u8 { self.0 }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | impl<'a> MyTrait<'a> for Y<&'a u8> {
@@ -165,6 +184,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn any_lifetime() -> &'b u8 { &0 }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
@@ -180,6 +200,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
@@ -195,6 +216,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
diff --git a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
index fc2ce1cb866bb..f164c0d07a3c4 100644
--- a/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
+++ b/src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
@@ -4,6 +4,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | + Deref>;
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | trait Iterable<'b> {
@@ -19,6 +20,7 @@ error[E0261]: use of undeclared lifetime name `'undeclared`
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
| ^^^^^^^^^^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'undeclared` here
|
LL | trait Iterable<'undeclared> {
diff --git a/src/test/ui/internal/internal-unstable-const.rs b/src/test/ui/internal/internal-unstable-const.rs
index 3b3a2950942d0..b923bc22f6e5f 100644
--- a/src/test/ui/internal/internal-unstable-const.rs
+++ b/src/test/ui/internal/internal-unstable-const.rs
@@ -8,7 +8,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
pub const fn foo() -> i32 {
- unsafe { std::mem::transmute(4u32) } //~ ERROR is not stable as `const fn`
+ unsafe { std::mem::transmute(4u32) } //~ ERROR can only call `transmute` from const items
}
fn main() {}
diff --git a/src/test/ui/internal/internal-unstable-const.stderr b/src/test/ui/internal/internal-unstable-const.stderr
index 5a2c58f3928dc..9626df23ec3c2 100644
--- a/src/test/ui/internal/internal-unstable-const.stderr
+++ b/src/test/ui/internal/internal-unstable-const.stderr
@@ -1,4 +1,4 @@
-error[E0723]: can only call other `const fn` within a `const fn`, but `const std::intrinsics::transmute::` is not stable as `const fn`
+error[E0723]: can only call `transmute` from const items, not `const fn`
--> $DIR/internal-unstable-const.rs:11:14
|
LL | unsafe { std::mem::transmute(4u32) }
diff --git a/src/test/ui/issues/issue-74236/auxiliary/dep.rs b/src/test/ui/issues/issue-74236/auxiliary/dep.rs
new file mode 100644
index 0000000000000..45f2601d307c8
--- /dev/null
+++ b/src/test/ui/issues/issue-74236/auxiliary/dep.rs
@@ -0,0 +1,8 @@
+// edition:2018
+
+mod private { pub struct Pub; }
+
+// Reexport built-in attribute without a DefId (requires Rust 2018).
+pub use cfg_attr as attr;
+// This export needs to be after the built-in attribute to trigger the bug.
+pub use private::Pub as Renamed;
diff --git a/src/test/ui/issues/issue-74236/main.rs b/src/test/ui/issues/issue-74236/main.rs
new file mode 100644
index 0000000000000..daa7cfcf9a106
--- /dev/null
+++ b/src/test/ui/issues/issue-74236/main.rs
@@ -0,0 +1,9 @@
+// edition:2018
+// aux-build:dep.rs
+// compile-flags:--extern dep
+
+fn main() {
+ // Trigger an error that will print the path of dep::private::Pub (as "dep::Renamed").
+ let () = dep::Renamed;
+ //~^ ERROR mismatched types
+}
diff --git a/src/test/ui/issues/issue-74236/main.stderr b/src/test/ui/issues/issue-74236/main.stderr
new file mode 100644
index 0000000000000..51d4833e01432
--- /dev/null
+++ b/src/test/ui/issues/issue-74236/main.stderr
@@ -0,0 +1,11 @@
+error[E0308]: mismatched types
+ --> $DIR/main.rs:7:9
+ |
+LL | let () = dep::Renamed;
+ | ^^ ------------ this expression has type `dep::Renamed`
+ | |
+ | expected struct `dep::Renamed`, found `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr
index c9f235c4f7df7..93c0384fcc266 100644
--- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr
+++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr
@@ -5,6 +5,8 @@ LL | fn main() {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | 0.clone::<'a>();
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to previous error
diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr
index 66537653291c7..d56c1fbd119c8 100644
--- a/src/test/ui/regions/regions-in-enums.stderr
+++ b/src/test/ui/regions/regions-in-enums.stderr
@@ -5,6 +5,8 @@ LL | enum No0 {
| - help: consider introducing lifetime `'foo` here: `<'foo>`
LL | X5(&'foo usize)
| ^^^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-in-enums.rs:17:9
@@ -13,6 +15,8 @@ LL | enum No1 {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | X6(&'a usize)
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 2 previous errors
diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr
index 5dfdc2ee93b43..2750149d09735 100644
--- a/src/test/ui/regions/regions-in-structs.stderr
+++ b/src/test/ui/regions/regions-in-structs.stderr
@@ -5,6 +5,8 @@ LL | struct StructDecl {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | a: &'a isize,
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-in-structs.rs:11:9
@@ -14,6 +16,8 @@ LL | struct StructDecl {
LL | a: &'a isize,
LL | b: &'a isize,
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 2 previous errors
diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr
index eb19a30c52b97..57d39d59c8b04 100644
--- a/src/test/ui/regions/regions-name-undeclared.stderr
+++ b/src/test/ui/regions/regions-name-undeclared.stderr
@@ -4,6 +4,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn m4(&self, arg: &'b isize) { }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b, 'a> Foo<'a> {
@@ -19,6 +20,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn m5(&'b self) { }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b, 'a> Foo<'a> {
@@ -34,6 +36,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | fn m6(&self, arg: Foo<'b>) { }
| ^^ undeclared lifetime
|
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b, 'a> Foo<'a> {
@@ -50,6 +53,8 @@ LL | type X = Option<&'a isize>;
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-name-undeclared.rs:27:13
@@ -58,6 +63,8 @@ LL | enum E {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | E1(&'a isize)
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-name-undeclared.rs:30:13
@@ -66,6 +73,8 @@ LL | struct S {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | f: &'a isize
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-name-undeclared.rs:32:14
@@ -74,6 +83,8 @@ LL | fn f(a: &'a isize) { }
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-name-undeclared.rs:40:17
@@ -82,6 +93,8 @@ LL | fn fn_types(a: &'a isize,
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/regions-name-undeclared.rs:42:36
@@ -90,6 +103,7 @@ LL | ... &'b isize,
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | fn fn_types<'b>(a: &'a isize,
@@ -106,6 +120,7 @@ LL | ... &'b isize)>,
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | fn fn_types<'b>(a: &'a isize,
@@ -123,6 +138,8 @@ LL | fn fn_types(a: &'a isize,
...
LL | c: &'a isize)
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 11 previous errors
diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr
index 6bfde5524ac49..f3cae184ccde8 100644
--- a/src/test/ui/regions/regions-undeclared.stderr
+++ b/src/test/ui/regions/regions-undeclared.stderr
@@ -11,6 +11,8 @@ LL | enum EnumDecl {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | Foo(&'a isize),
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-undeclared.rs:5:10
@@ -20,6 +22,8 @@ LL | enum EnumDecl {
LL | Foo(&'a isize),
LL | Bar(&'a isize),
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-undeclared.rs:8:15
@@ -28,6 +32,8 @@ LL | fn fnDecl(x: &'a isize,
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/regions-undeclared.rs:9:15
@@ -36,6 +42,8 @@ LL | fn fnDecl(x: &'a isize,
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | y: &'a isize)
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 5 previous errors
diff --git a/src/test/ui/self/suggest-self.stderr b/src/test/ui/self/suggest-self.stderr
index 631e43c8694ac..0d38b9d87c5e8 100644
--- a/src/test/ui/self/suggest-self.stderr
+++ b/src/test/ui/self/suggest-self.stderr
@@ -5,7 +5,7 @@ LL | this.x
| ^^^^
| |
| not found in this scope
- | help: did you mean: `self`
+ | help: you might have meant to use `self` here instead
error[E0425]: cannot find value `this` in this scope
--> $DIR/suggest-self.rs:26:9
@@ -14,7 +14,7 @@ LL | this.foo()
| ^^^^
| |
| not found in this scope
- | help: did you mean: `self`
+ | help: you might have meant to use `self` here instead
error[E0425]: cannot find value `my` in this scope
--> $DIR/suggest-self.rs:31:9
@@ -23,7 +23,7 @@ LL | my.bar()
| ^^
| |
| not found in this scope
- | help: did you mean: `self`
+ | help: you might have meant to use `self` here instead
error: aborting due to 3 previous errors
diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr
index 6c52664154bbf..a704fea282899 100644
--- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr
+++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr
@@ -6,6 +6,8 @@ LL | fn f() where
LL | for<'a> dyn Trait1<'a>: Trait1<'a>, // OK
LL | (dyn for<'a> Trait1<'a>): Trait1<'a>,
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/where-lifetime-resolution.rs:8:52
@@ -15,6 +17,8 @@ LL | fn f() where
...
LL | for<'a> dyn for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>,
| ^^ undeclared lifetime
+ |
+ = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.stderr b/src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.stderr
index 8dde56cd79f44..74d32b8a1aa93 100644
--- a/src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.stderr
+++ b/src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const.stderr
@@ -57,14 +57,6 @@ LL | | t
LL | | }
| |_^
-error: this could be a `const fn`
- --> $DIR/could_be_const.rs:48:1
- |
-LL | / fn sub(x: u32) -> usize {
-LL | | unsafe { transmute(&x) }
-LL | | }
- | |_^
-
error: this could be a `const fn`
--> $DIR/could_be_const.rs:67:9
|
@@ -73,5 +65,5 @@ LL | | B
LL | | }
| |_________^
-error: aborting due to 9 previous errors
+error: aborting due to 8 previous errors
diff --git a/src/tools/miri b/src/tools/miri
index eb5ff1791be70..eee22ffddab20 160000
--- a/src/tools/miri
+++ b/src/tools/miri
@@ -1 +1 @@
-Subproject commit eb5ff1791be706d173b4f4c29e9c0529b4235c0e
+Subproject commit eee22ffddab20f51e1866bcbe4c5a69a90bdd260