Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 3bc9dd0

Browse files
committed
Auto merge of rust-lang#87509 - JohnTitor:rollup-8iqn6cl, r=JohnTitor
Rollup of 10 pull requests Successful merges: - rust-lang#86450 (Add flag to configure `large_assignments` lint) - rust-lang#86764 (Avoid ICE on type error recovery) - rust-lang#87354 (Update VxWork's UNIX support) - rust-lang#87427 (get rid of NoMirFor error variant) - rust-lang#87446 (macos current_exe using directly libc instead.) - rust-lang#87494 (fix typo: whenver -> whenever) - rust-lang#87497 (Add long explanation for E0544.) - rust-lang#87499 (Remove ASCII fast path from `rustc_lexer::{is_id_continue, is_id_start}`) - rust-lang#87502 (Update cargo) - rust-lang#87503 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 99d6692 + af6c95f commit 3bc9dd0

File tree

29 files changed

+187
-59
lines changed

29 files changed

+187
-59
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,9 +1880,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
18801880

18811881
[[package]]
18821882
name = "libc"
1883-
version = "0.2.93"
1883+
version = "0.2.98"
18841884
source = "registry+https://github.com/rust-lang/crates.io-index"
1885-
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
1885+
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
18861886
dependencies = [
18871887
"rustc-std-workspace-core",
18881888
]
@@ -5409,9 +5409,9 @@ dependencies = [
54095409

54105410
[[package]]
54115411
name = "unicode-xid"
5412-
version = "0.2.1"
5412+
version = "0.2.2"
54135413
source = "registry+https://github.com/rust-lang/crates.io-index"
5414-
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
5414+
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
54155415

54165416
[[package]]
54175417
name = "unicode_categories"

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ E0539: include_str!("./error_codes/E0539.md"),
287287
E0541: include_str!("./error_codes/E0541.md"),
288288
E0542: include_str!("./error_codes/E0542.md"),
289289
E0543: include_str!("./error_codes/E0543.md"),
290+
E0544: include_str!("./error_codes/E0544.md"),
290291
E0545: include_str!("./error_codes/E0545.md"),
291292
E0546: include_str!("./error_codes/E0546.md"),
292293
E0547: include_str!("./error_codes/E0547.md"),
@@ -610,7 +611,6 @@ E0783: include_str!("./error_codes/E0783.md"),
610611
E0523,
611612
// E0526, // shuffle indices are not constant
612613
// E0540, // multiple rustc_deprecated attributes
613-
E0544, // multiple stability levels
614614
// E0548, // replaced with a generic attribute input check
615615
// E0553, // multiple rustc_const_unstable attributes
616616
// E0555, // replaced with a generic attribute input check
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Multiple stability attributes were declared on the same item.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0544
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "rust1")]
8+
9+
#[stable(feature = "rust1", since = "1.0.0")]
10+
#[stable(feature = "test", since = "2.0.0")] // invalid
11+
fn foo() {}
12+
```
13+
14+
To fix this issue, ensure that each item has at most one stability attribute.
15+
16+
```
17+
#![feature(staged_api)]
18+
#![stable(since = "1.0.0", feature = "rust1")]
19+
20+
#[stable(feature = "test", since = "2.0.0")] // ok!
21+
fn foo() {}
22+
```
23+
24+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
25+
of the Book and the [Stability attributes][stability-attributes] section of the
26+
Rustc Dev Guide for more details.
27+
28+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
29+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ fn test_debugging_options_tracking_hash() {
735735
tracked!(merge_functions, Some(MergeFunctions::Disabled));
736736
tracked!(mir_emit_retag, true);
737737
tracked!(mir_opt_level, Some(4));
738+
tracked!(move_size_limit, Some(4096));
738739
tracked!(mutable_noalias, Some(true));
739740
tracked!(new_llvm_pass_manager, Some(true));
740741
tracked!(no_generate_arange_section, true);

compiler/rustc_lexer/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,24 +273,14 @@ pub fn is_whitespace(c: char) -> bool {
273273
/// a formal definition of valid identifier name.
274274
pub fn is_id_start(c: char) -> bool {
275275
// This is XID_Start OR '_' (which formally is not a XID_Start).
276-
// We also add fast-path for ascii idents
277-
('a'..='z').contains(&c)
278-
|| ('A'..='Z').contains(&c)
279-
|| c == '_'
280-
|| (c > '\x7f' && unicode_xid::UnicodeXID::is_xid_start(c))
276+
c == '_' || unicode_xid::UnicodeXID::is_xid_start(c)
281277
}
282278

283279
/// True if `c` is valid as a non-first character of an identifier.
284280
/// See [Rust language reference](https://doc.rust-lang.org/reference/identifiers.html) for
285281
/// a formal definition of valid identifier name.
286282
pub fn is_id_continue(c: char) -> bool {
287-
// This is exactly XID_Continue.
288-
// We also add fast-path for ascii idents
289-
('a'..='z').contains(&c)
290-
|| ('A'..='Z').contains(&c)
291-
|| ('0'..='9').contains(&c)
292-
|| c == '_'
293-
|| (c > '\x7f' && unicode_xid::UnicodeXID::is_xid_continue(c))
283+
unicode_xid::UnicodeXID::is_xid_continue(c)
294284
}
295285

296286
/// The passed string is lexically an identifier.

compiler/rustc_middle/src/middle/limits.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ use std::num::IntErrorKind;
2121
pub fn provide(providers: &mut ty::query::Providers) {
2222
providers.limits = |tcx, ()| Limits {
2323
recursion_limit: get_recursion_limit(tcx.hir().krate_attrs(), tcx.sess),
24-
move_size_limit: get_limit(tcx.hir().krate_attrs(), tcx.sess, sym::move_size_limit, 0),
24+
move_size_limit: get_limit(
25+
tcx.hir().krate_attrs(),
26+
tcx.sess,
27+
sym::move_size_limit,
28+
tcx.sess.opts.debugging_opts.move_size_limit.unwrap_or(0),
29+
),
2530
type_length_limit: get_limit(
2631
tcx.hir().krate_attrs(),
2732
tcx.sess,

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
402402
pub enum UnsupportedOpInfo {
403403
/// Free-form case. Only for errors that are never caught!
404404
Unsupported(String),
405-
/// Could not find MIR for a function.
406-
NoMirFor(DefId),
407405
/// Encountered a pointer where we needed raw bytes.
408406
ReadPointerAsBytes,
409407
//
@@ -421,7 +419,6 @@ impl fmt::Display for UnsupportedOpInfo {
421419
match self {
422420
Unsupported(ref msg) => write!(f, "{}", msg),
423421
ReadExternStatic(did) => write!(f, "cannot read from extern static ({:?})", did),
424-
NoMirFor(did) => write!(f, "no MIR body is available for {:?}", did),
425422
ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",),
426423
ThreadLocalStatic(did) => write!(f, "cannot access thread local static ({:?})", did),
427424
}

compiler/rustc_mir/src/const_eval/machine.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
212212
if ecx.tcx.is_ctfe_mir_available(def.did) {
213213
Ok(ecx.tcx.mir_for_ctfe_opt_const_arg(def))
214214
} else {
215-
throw_unsup!(NoMirFor(def.did))
215+
let path = ecx.tcx.def_path_str(def.did);
216+
Err(ConstEvalErrKind::NeedsRfc(format!("calling extern function `{}`", path))
217+
.into())
216218
}
217219
}
218220
_ => Ok(ecx.tcx.instance_mir(instance)),
@@ -247,20 +249,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
247249
}
248250
}
249251
// This is a const fn. Call it.
250-
Ok(Some(match ecx.load_mir(instance.def, None) {
251-
Ok(body) => body,
252-
Err(err) => {
253-
if let err_unsup!(NoMirFor(did)) = err.kind() {
254-
let path = ecx.tcx.def_path_str(*did);
255-
return Err(ConstEvalErrKind::NeedsRfc(format!(
256-
"calling extern function `{}`",
257-
path
258-
))
259-
.into());
260-
}
261-
return Err(err);
262-
}
263-
}))
252+
Ok(Some(ecx.load_mir(instance.def, None)?))
264253
}
265254

266255
fn call_intrinsic(

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,8 @@ options! {
11481148
(default: no)"),
11491149
mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED],
11501150
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
1151+
move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED],
1152+
"the size at which the `large_assignments` lint starts to be emitted"),
11511153
mutable_noalias: Option<bool> = (None, parse_opt_bool, [TRACKED],
11521154
"emit noalias metadata for mutable references (default: yes for LLVM >= 12, otherwise no)"),
11531155
new_llvm_pass_manager: Option<bool> = (None, parse_opt_bool, [TRACKED],

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
2121
use rustc_hir::intravisit::{walk_generics, Visitor as _};
2222
use rustc_hir::lang_items::LangItem;
2323
use rustc_hir::{Constness, GenericArg, GenericArgs};
24-
use rustc_middle::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
24+
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, Subst, SubstsRef};
2525
use rustc_middle::ty::GenericParamDefKind;
2626
use rustc_middle::ty::{self, Const, DefIdTree, Ty, TyCtxt, TypeFoldable};
2727
use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
@@ -488,12 +488,20 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
488488
tcx.ty_error().into()
489489
} else {
490490
// This is a default type parameter.
491+
let substs = substs.unwrap();
492+
if substs.iter().any(|arg| match arg.unpack() {
493+
GenericArgKind::Type(ty) => ty.references_error(),
494+
_ => false,
495+
}) {
496+
// Avoid ICE #86756 when type error recovery goes awry.
497+
return tcx.ty_error().into();
498+
}
491499
self.astconv
492500
.normalize_ty(
493501
self.span,
494502
tcx.at(self.span).type_of(param.def_id).subst_spanned(
495503
tcx,
496-
substs.unwrap(),
504+
substs,
497505
Some(self.span),
498506
),
499507
)

0 commit comments

Comments
 (0)