mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Auto merge of #87509 - JohnTitor:rollup-8iqn6cl, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #86450 (Add flag to configure `large_assignments` lint) - #86764 (Avoid ICE on type error recovery) - #87354 (Update VxWork's UNIX support) - #87427 (get rid of NoMirFor error variant) - #87446 (macos current_exe using directly libc instead.) - #87494 (fix typo: whenver -> whenever) - #87497 (Add long explanation for E0544.) - #87499 (Remove ASCII fast path from `rustc_lexer::{is_id_continue, is_id_start}`) - #87502 (Update cargo) - #87503 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
3bc9dd0dd2
@ -1880,9 +1880,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.93"
|
version = "0.2.98"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
|
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc-std-workspace-core",
|
"rustc-std-workspace-core",
|
||||||
]
|
]
|
||||||
@ -5409,9 +5409,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode_categories"
|
name = "unicode_categories"
|
||||||
|
@ -287,6 +287,7 @@ E0539: include_str!("./error_codes/E0539.md"),
|
|||||||
E0541: include_str!("./error_codes/E0541.md"),
|
E0541: include_str!("./error_codes/E0541.md"),
|
||||||
E0542: include_str!("./error_codes/E0542.md"),
|
E0542: include_str!("./error_codes/E0542.md"),
|
||||||
E0543: include_str!("./error_codes/E0543.md"),
|
E0543: include_str!("./error_codes/E0543.md"),
|
||||||
|
E0544: include_str!("./error_codes/E0544.md"),
|
||||||
E0545: include_str!("./error_codes/E0545.md"),
|
E0545: include_str!("./error_codes/E0545.md"),
|
||||||
E0546: include_str!("./error_codes/E0546.md"),
|
E0546: include_str!("./error_codes/E0546.md"),
|
||||||
E0547: include_str!("./error_codes/E0547.md"),
|
E0547: include_str!("./error_codes/E0547.md"),
|
||||||
@ -610,7 +611,6 @@ E0783: include_str!("./error_codes/E0783.md"),
|
|||||||
E0523,
|
E0523,
|
||||||
// E0526, // shuffle indices are not constant
|
// E0526, // shuffle indices are not constant
|
||||||
// E0540, // multiple rustc_deprecated attributes
|
// E0540, // multiple rustc_deprecated attributes
|
||||||
E0544, // multiple stability levels
|
|
||||||
// E0548, // replaced with a generic attribute input check
|
// E0548, // replaced with a generic attribute input check
|
||||||
// E0553, // multiple rustc_const_unstable attributes
|
// E0553, // multiple rustc_const_unstable attributes
|
||||||
// E0555, // replaced with a generic attribute input check
|
// E0555, // replaced with a generic attribute input check
|
||||||
|
29
compiler/rustc_error_codes/src/error_codes/E0544.md
Normal file
29
compiler/rustc_error_codes/src/error_codes/E0544.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Multiple stability attributes were declared on the same item.
|
||||||
|
|
||||||
|
Erroneous code example:
|
||||||
|
|
||||||
|
```compile_fail,E0544
|
||||||
|
#![feature(staged_api)]
|
||||||
|
#![stable(since = "1.0.0", feature = "rust1")]
|
||||||
|
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[stable(feature = "test", since = "2.0.0")] // invalid
|
||||||
|
fn foo() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
To fix this issue, ensure that each item has at most one stability attribute.
|
||||||
|
|
||||||
|
```
|
||||||
|
#![feature(staged_api)]
|
||||||
|
#![stable(since = "1.0.0", feature = "rust1")]
|
||||||
|
|
||||||
|
#[stable(feature = "test", since = "2.0.0")] // ok!
|
||||||
|
fn foo() {}
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
|
||||||
|
of the Book and the [Stability attributes][stability-attributes] section of the
|
||||||
|
Rustc Dev Guide for more details.
|
||||||
|
|
||||||
|
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
|
||||||
|
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html
|
@ -735,6 +735,7 @@ fn test_debugging_options_tracking_hash() {
|
|||||||
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
||||||
tracked!(mir_emit_retag, true);
|
tracked!(mir_emit_retag, true);
|
||||||
tracked!(mir_opt_level, Some(4));
|
tracked!(mir_opt_level, Some(4));
|
||||||
|
tracked!(move_size_limit, Some(4096));
|
||||||
tracked!(mutable_noalias, Some(true));
|
tracked!(mutable_noalias, Some(true));
|
||||||
tracked!(new_llvm_pass_manager, Some(true));
|
tracked!(new_llvm_pass_manager, Some(true));
|
||||||
tracked!(no_generate_arange_section, true);
|
tracked!(no_generate_arange_section, true);
|
||||||
|
@ -273,24 +273,14 @@ pub fn is_whitespace(c: char) -> bool {
|
|||||||
/// a formal definition of valid identifier name.
|
/// a formal definition of valid identifier name.
|
||||||
pub fn is_id_start(c: char) -> bool {
|
pub fn is_id_start(c: char) -> bool {
|
||||||
// This is XID_Start OR '_' (which formally is not a XID_Start).
|
// This is XID_Start OR '_' (which formally is not a XID_Start).
|
||||||
// We also add fast-path for ascii idents
|
c == '_' || unicode_xid::UnicodeXID::is_xid_start(c)
|
||||||
('a'..='z').contains(&c)
|
|
||||||
|| ('A'..='Z').contains(&c)
|
|
||||||
|| c == '_'
|
|
||||||
|| (c > '\x7f' && unicode_xid::UnicodeXID::is_xid_start(c))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True if `c` is valid as a non-first character of an identifier.
|
/// True if `c` is valid as a non-first character of an identifier.
|
||||||
/// See [Rust language reference](https://doc.rust-lang.org/reference/identifiers.html) for
|
/// See [Rust language reference](https://doc.rust-lang.org/reference/identifiers.html) for
|
||||||
/// a formal definition of valid identifier name.
|
/// a formal definition of valid identifier name.
|
||||||
pub fn is_id_continue(c: char) -> bool {
|
pub fn is_id_continue(c: char) -> bool {
|
||||||
// This is exactly XID_Continue.
|
unicode_xid::UnicodeXID::is_xid_continue(c)
|
||||||
// We also add fast-path for ascii idents
|
|
||||||
('a'..='z').contains(&c)
|
|
||||||
|| ('A'..='Z').contains(&c)
|
|
||||||
|| ('0'..='9').contains(&c)
|
|
||||||
|| c == '_'
|
|
||||||
|| (c > '\x7f' && unicode_xid::UnicodeXID::is_xid_continue(c))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The passed string is lexically an identifier.
|
/// The passed string is lexically an identifier.
|
||||||
|
@ -21,7 +21,12 @@ use std::num::IntErrorKind;
|
|||||||
pub fn provide(providers: &mut ty::query::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
providers.limits = |tcx, ()| Limits {
|
providers.limits = |tcx, ()| Limits {
|
||||||
recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess),
|
recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess),
|
||||||
move_size_limit: get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::move_size_limit, 0),
|
move_size_limit: get_limit(
|
||||||
|
tcx.hir().krate_attrs(),
|
||||||
|
tcx.sess,
|
||||||
|
sym::move_size_limit,
|
||||||
|
tcx.sess.opts.debugging_opts.move_size_limit.unwrap_or(0),
|
||||||
|
),
|
||||||
type_length_limit: get_limit(
|
type_length_limit: get_limit(
|
||||||
tcx.hir().krate_attrs(),
|
tcx.hir().krate_attrs(),
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
|
@ -402,8 +402,6 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
|
|||||||
pub enum UnsupportedOpInfo {
|
pub enum UnsupportedOpInfo {
|
||||||
/// Free-form case. Only for errors that are never caught!
|
/// Free-form case. Only for errors that are never caught!
|
||||||
Unsupported(String),
|
Unsupported(String),
|
||||||
/// Could not find MIR for a function.
|
|
||||||
NoMirFor(DefId),
|
|
||||||
/// Encountered a pointer where we needed raw bytes.
|
/// Encountered a pointer where we needed raw bytes.
|
||||||
ReadPointerAsBytes,
|
ReadPointerAsBytes,
|
||||||
//
|
//
|
||||||
@ -421,7 +419,6 @@ impl fmt::Display for UnsupportedOpInfo {
|
|||||||
match self {
|
match self {
|
||||||
Unsupported(ref msg) => write!(f, "{}", msg),
|
Unsupported(ref msg) => write!(f, "{}", msg),
|
||||||
ReadExternStatic(did) => write!(f, "cannot read from extern static ({:?})", did),
|
ReadExternStatic(did) => write!(f, "cannot read from extern static ({:?})", did),
|
||||||
NoMirFor(did) => write!(f, "no MIR body is available for {:?}", did),
|
|
||||||
ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
|
ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
|
||||||
ThreadLocalStatic(did) => write!(f, "cannot access thread local static ({:?})", did),
|
ThreadLocalStatic(did) => write!(f, "cannot access thread local static ({:?})", did),
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||||||
if ecx.tcx.is_ctfe_mir_available(def.did) {
|
if ecx.tcx.is_ctfe_mir_available(def.did) {
|
||||||
Ok(ecx.tcx.mir_for_ctfe_opt_const_arg(def))
|
Ok(ecx.tcx.mir_for_ctfe_opt_const_arg(def))
|
||||||
} else {
|
} else {
|
||||||
throw_unsup!(NoMirFor(def.did))
|
let path = ecx.tcx.def_path_str(def.did);
|
||||||
|
Err(ConstEvalErrKind::NeedsRfc(format!("calling extern function `{}`", path))
|
||||||
|
.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => Ok(ecx.tcx.instance_mir(instance)),
|
_ => Ok(ecx.tcx.instance_mir(instance)),
|
||||||
@ -247,20 +249,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is a const fn. Call it.
|
// This is a const fn. Call it.
|
||||||
Ok(Some(match ecx.load_mir(instance.def, None) {
|
Ok(Some(ecx.load_mir(instance.def, None)?))
|
||||||
Ok(body) => body,
|
|
||||||
Err(err) => {
|
|
||||||
if let err_unsup!(NoMirFor(did)) = err.kind() {
|
|
||||||
let path = ecx.tcx.def_path_str(*did);
|
|
||||||
return Err(ConstEvalErrKind::NeedsRfc(format!(
|
|
||||||
"calling extern function `{}`",
|
|
||||||
path
|
|
||||||
))
|
|
||||||
.into());
|
|
||||||
}
|
|
||||||
return Err(err);
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_intrinsic(
|
fn call_intrinsic(
|
||||||
|
@ -1148,6 +1148,8 @@ options! {
|
|||||||
(default: no)"),
|
(default: no)"),
|
||||||
mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
|
mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
|
||||||
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
|
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
|
||||||
|
move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED],
|
||||||
|
"the size at which the `large_assignments` lint starts to be emitted"),
|
||||||
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
|
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
|
||||||
new_llvm_pass_manager: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
new_llvm_pass_manager: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
|
@ -21,7 +21,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
|||||||
use rustc_hir::intravisit::{walk_generics, Visitor as _};
|
use rustc_hir::intravisit::{walk_generics, Visitor as _};
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_hir::{Constness, GenericArg, GenericArgs};
|
use rustc_hir::{Constness, GenericArg, GenericArgs};
|
||||||
use rustc_middle::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
|
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, Subst, SubstsRef};
|
||||||
use rustc_middle::ty::GenericParamDefKind;
|
use rustc_middle::ty::GenericParamDefKind;
|
||||||
use rustc_middle::ty::{self, Const, DefIdTree, Ty, TyCtxt, TypeFoldable};
|
use rustc_middle::ty::{self, Const, DefIdTree, Ty, TyCtxt, TypeFoldable};
|
||||||
use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
|
use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
|
||||||
@ -488,12 +488,20 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
tcx.ty_error().into()
|
tcx.ty_error().into()
|
||||||
} else {
|
} else {
|
||||||
// This is a default type parameter.
|
// This is a default type parameter.
|
||||||
|
let substs = substs.unwrap();
|
||||||
|
if substs.iter().any(|arg| match arg.unpack() {
|
||||||
|
GenericArgKind::Type(ty) => ty.references_error(),
|
||||||
|
_ => false,
|
||||||
|
}) {
|
||||||
|
// Avoid ICE #86756 when type error recovery goes awry.
|
||||||
|
return tcx.ty_error().into();
|
||||||
|
}
|
||||||
self.astconv
|
self.astconv
|
||||||
.normalize_ty(
|
.normalize_ty(
|
||||||
self.span,
|
self.span,
|
||||||
tcx.at(self.span).type_of(param.def_id).subst_spanned(
|
tcx.at(self.span).type_of(param.def_id).subst_spanned(
|
||||||
tcx,
|
tcx,
|
||||||
substs.unwrap(),
|
substs,
|
||||||
Some(self.span),
|
Some(self.span),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -583,7 +583,7 @@ impl<T> Cell<[T]> {
|
|||||||
pub struct RefCell<T: ?Sized> {
|
pub struct RefCell<T: ?Sized> {
|
||||||
borrow: Cell<BorrowFlag>,
|
borrow: Cell<BorrowFlag>,
|
||||||
// Stores the location of the earliest currently active borrow.
|
// Stores the location of the earliest currently active borrow.
|
||||||
// This gets updated whenver we go from having zero borrows
|
// This gets updated whenever we go from having zero borrows
|
||||||
// to having a single borrow. When a borrow occurs, this gets included
|
// to having a single borrow. When a borrow occurs, this gets included
|
||||||
// in the generated `BorrowError/`BorrowMutError`
|
// in the generated `BorrowError/`BorrowMutError`
|
||||||
#[cfg(feature = "debug_refcell")]
|
#[cfg(feature = "debug_refcell")]
|
||||||
|
@ -16,7 +16,7 @@ cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
|
|||||||
panic_unwind = { path = "../panic_unwind", optional = true }
|
panic_unwind = { path = "../panic_unwind", optional = true }
|
||||||
panic_abort = { path = "../panic_abort" }
|
panic_abort = { path = "../panic_abort" }
|
||||||
core = { path = "../core" }
|
core = { path = "../core" }
|
||||||
libc = { version = "0.2.93", default-features = false, features = ['rustc-dep-of-std'] }
|
libc = { version = "0.2.98", default-features = false, features = ['rustc-dep-of-std'] }
|
||||||
compiler_builtins = { version = "0.1.44" }
|
compiler_builtins = { version = "0.1.44" }
|
||||||
profiler_builtins = { path = "../profiler_builtins", optional = true }
|
profiler_builtins = { path = "../profiler_builtins", optional = true }
|
||||||
unwind = { path = "../unwind" }
|
unwind = { path = "../unwind" }
|
||||||
|
@ -350,17 +350,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
pub fn current_exe() -> io::Result<PathBuf> {
|
pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
extern "C" {
|
|
||||||
fn _NSGetExecutablePath(buf: *mut libc::c_char, bufsize: *mut u32) -> libc::c_int;
|
|
||||||
}
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut sz: u32 = 0;
|
let mut sz: u32 = 0;
|
||||||
_NSGetExecutablePath(ptr::null_mut(), &mut sz);
|
libc::_NSGetExecutablePath(ptr::null_mut(), &mut sz);
|
||||||
if sz == 0 {
|
if sz == 0 {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
|
let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
|
||||||
let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
|
let err = libc::_NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
|
||||||
if err != 0 {
|
if err != 0 {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(target_os = "vxworks"))]
|
||||||
fn test_glibc_version() {
|
fn test_glibc_version() {
|
||||||
// This mostly just tests that the weak linkage doesn't panic wildly...
|
// This mostly just tests that the weak linkage doesn't panic wildly...
|
||||||
glibc_version();
|
glibc_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(target_os = "vxworks"))]
|
||||||
fn test_parse_glibc_version() {
|
fn test_parse_glibc_version() {
|
||||||
let cases = [
|
let cases = [
|
||||||
("0.0", Some((0, 0))),
|
("0.0", Some((0, 0))),
|
||||||
|
@ -50,7 +50,7 @@ cfg_if::cfg_if! {
|
|||||||
raw[bit / 8] |= 1 << (bit % 8);
|
raw[bit / 8] |= 1 << (bit % 8);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if #[cfg(not(target_os = "vxworks"))] {
|
} else {
|
||||||
pub use libc::{sigemptyset, sigaddset};
|
pub use libc::{sigemptyset, sigaddset};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit eac55314210519238652f12b30fec9daea61f7fe
|
Subproject commit a07036f864b37896b31eb996cd7aedb489f69a1f
|
@ -1 +1 @@
|
|||||||
Subproject commit af696ce8ea526445590ae0ca66a8128d2a95a69a
|
Subproject commit 3710b0cae783d0bcd2b42452a63b081473f5970a
|
@ -1 +1 @@
|
|||||||
Subproject commit 7a13537f96af4b9b8e3ea296d6e5c3c7ab72ce9f
|
Subproject commit f51734eb5566c826b471977747ea3d7d6915bbe9
|
@ -1 +1 @@
|
|||||||
Subproject commit 82d75cf423e4a7824fb36e73ccb18519d6900610
|
Subproject commit 3b7be075af5d6e402a18efff672a8a265b4596fd
|
@ -1 +1 @@
|
|||||||
Subproject commit 1db6bb483cc87ad3b424d9aba764fe622960a1be
|
Subproject commit 0dc9cd4e89f00cb5230f120e1a083916386e422b
|
@ -1 +1 @@
|
|||||||
Subproject commit 93422c21baca585dc88357ec886a48f6ddc7d665
|
Subproject commit 09343d6f921d2a07c66f8c41ec3d65bf1fa52556
|
10
src/doc/unstable-book/src/compiler-flags/move-size-limit.md
Normal file
10
src/doc/unstable-book/src/compiler-flags/move-size-limit.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# `move_size_limit`
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The `-Zmove-size-limit=N` compiler flag enables `large_assignments` lints which
|
||||||
|
will warn when moving objects whose size exceeds `N` bytes.
|
||||||
|
|
||||||
|
Lint warns only about moves in functions that participate in code generation.
|
||||||
|
Consequently it will be ineffective for compiler invocatation that emit
|
||||||
|
metadata only, i.e., `cargo check` like workflows.
|
@ -1,5 +1,5 @@
|
|||||||
error: moving 10024 bytes
|
error: moving 10024 bytes
|
||||||
--> $DIR/large_moves.rs:10:13
|
--> $DIR/large_moves.rs:12:13
|
||||||
|
|
|
|
||||||
LL | let x = async {
|
LL | let x = async {
|
||||||
| _____________^
|
| _____________^
|
||||||
@ -17,19 +17,19 @@ LL | #![deny(large_assignments)]
|
|||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: moving 10024 bytes
|
error: moving 10024 bytes
|
||||||
--> $DIR/large_moves.rs:16:14
|
--> $DIR/large_moves.rs:18:14
|
||||||
|
|
|
|
||||||
LL | let z = (x, 42);
|
LL | let z = (x, 42);
|
||||||
| ^ value moved from here
|
| ^ value moved from here
|
||||||
|
|
||||||
error: moving 10024 bytes
|
error: moving 10024 bytes
|
||||||
--> $DIR/large_moves.rs:16:13
|
--> $DIR/large_moves.rs:18:13
|
||||||
|
|
|
|
||||||
LL | let z = (x, 42);
|
LL | let z = (x, 42);
|
||||||
| ^^^^^^^ value moved from here
|
| ^^^^^^^ value moved from here
|
||||||
|
|
||||||
error: moving 10024 bytes
|
error: moving 10024 bytes
|
||||||
--> $DIR/large_moves.rs:18:13
|
--> $DIR/large_moves.rs:20:13
|
||||||
|
|
|
|
||||||
LL | let a = z.0;
|
LL | let a = z.0;
|
||||||
| ^^^ value moved from here
|
| ^^^ value moved from here
|
38
src/test/ui/async-await/large_moves.option.stderr
Normal file
38
src/test/ui/async-await/large_moves.option.stderr
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
error: moving 10024 bytes
|
||||||
|
--> $DIR/large_moves.rs:12:13
|
||||||
|
|
|
||||||
|
LL | let x = async {
|
||||||
|
| _____________^
|
||||||
|
LL | | let y = [0; 9999];
|
||||||
|
LL | | dbg!(y);
|
||||||
|
LL | | thing(&y).await;
|
||||||
|
LL | | dbg!(y);
|
||||||
|
LL | | };
|
||||||
|
| |_____^ value moved from here
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/large_moves.rs:1:9
|
||||||
|
|
|
||||||
|
LL | #![deny(large_assignments)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: moving 10024 bytes
|
||||||
|
--> $DIR/large_moves.rs:18:14
|
||||||
|
|
|
||||||
|
LL | let z = (x, 42);
|
||||||
|
| ^ value moved from here
|
||||||
|
|
||||||
|
error: moving 10024 bytes
|
||||||
|
--> $DIR/large_moves.rs:18:13
|
||||||
|
|
|
||||||
|
LL | let z = (x, 42);
|
||||||
|
| ^^^^^^^ value moved from here
|
||||||
|
|
||||||
|
error: moving 10024 bytes
|
||||||
|
--> $DIR/large_moves.rs:20:13
|
||||||
|
|
|
||||||
|
LL | let a = z.0;
|
||||||
|
| ^^^ value moved from here
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
@ -1,8 +1,10 @@
|
|||||||
#![deny(large_assignments)]
|
#![deny(large_assignments)]
|
||||||
#![feature(large_assignments)]
|
#![feature(large_assignments)]
|
||||||
#![move_size_limit = "1000"]
|
#![cfg_attr(attribute, move_size_limit = "1000")]
|
||||||
// build-fail
|
// build-fail
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
// revisions: attribute option
|
||||||
|
// [option]compile-flags: -Zmove-size-limit=1000
|
||||||
|
|
||||||
// edition:2018
|
// edition:2018
|
||||||
|
|
||||||
|
12
src/test/ui/issues/issue-86756.rs
Normal file
12
src/test/ui/issues/issue-86756.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
trait Foo<T, T = T> {}
|
||||||
|
//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters
|
||||||
|
|
||||||
|
fn eq<A, B>() {
|
||||||
|
eq::<dyn, Foo>
|
||||||
|
//~^ ERROR cannot find type `dyn` in this scope
|
||||||
|
//~| ERROR missing generics for trait `Foo`
|
||||||
|
//~| WARN trait objects without an explicit `dyn` are deprecated
|
||||||
|
//~| WARN this is accepted in the current edition
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
46
src/test/ui/issues/issue-86756.stderr
Normal file
46
src/test/ui/issues/issue-86756.stderr
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
|
||||||
|
--> $DIR/issue-86756.rs:1:14
|
||||||
|
|
|
||||||
|
LL | trait Foo<T, T = T> {}
|
||||||
|
| - ^ already used
|
||||||
|
| |
|
||||||
|
| first use of `T`
|
||||||
|
|
||||||
|
error[E0412]: cannot find type `dyn` in this scope
|
||||||
|
--> $DIR/issue-86756.rs:5:10
|
||||||
|
|
|
||||||
|
LL | fn eq<A, B>() {
|
||||||
|
| - help: you might be missing a type parameter: `, dyn`
|
||||||
|
LL | eq::<dyn, Foo>
|
||||||
|
| ^^^ not found in this scope
|
||||||
|
|
||||||
|
warning: trait objects without an explicit `dyn` are deprecated
|
||||||
|
--> $DIR/issue-86756.rs:5:15
|
||||||
|
|
|
||||||
|
LL | eq::<dyn, Foo>
|
||||||
|
| ^^^ help: use `dyn`: `dyn Foo`
|
||||||
|
|
|
||||||
|
= note: `#[warn(bare_trait_objects)]` on by default
|
||||||
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
|
error[E0107]: missing generics for trait `Foo`
|
||||||
|
--> $DIR/issue-86756.rs:5:15
|
||||||
|
|
|
||||||
|
LL | eq::<dyn, Foo>
|
||||||
|
| ^^^ expected at least 1 generic argument
|
||||||
|
|
|
||||||
|
note: trait defined here, with at least 1 generic parameter: `T`
|
||||||
|
--> $DIR/issue-86756.rs:1:7
|
||||||
|
|
|
||||||
|
LL | trait Foo<T, T = T> {}
|
||||||
|
| ^^^ -
|
||||||
|
help: add missing generic argument
|
||||||
|
|
|
||||||
|
LL | eq::<dyn, Foo<T>>
|
||||||
|
| ^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0107, E0403, E0412.
|
||||||
|
For more information about an error, try `rustc --explain E0107`.
|
@ -122,5 +122,5 @@ LL | #[rustc_deprecated(since = "a", reason = "text")]
|
|||||||
|
|
||||||
error: aborting due to 19 previous errors
|
error: aborting due to 19 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0546, E0547, E0549, E0550.
|
Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0544, E0546, E0547, E0549, E0550.
|
||||||
For more information about an error, try `rustc --explain E0539`.
|
For more information about an error, try `rustc --explain E0539`.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit cebef2951ee69617852844894164b54ed478a7da
|
Subproject commit d21c22870e58499d6c31f1bef3bf1255eb021666
|
Loading…
Reference in New Issue
Block a user