Skip to content

Commit 88b620e

Browse files
committed
Merge branch 'main' into mgca-merge-associated-const-equality
2 parents 62b56b7 + 451b7b6 commit 88b620e

283 files changed

Lines changed: 12803 additions & 8695 deletions

File tree

Some content is hidden

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

Cargo.lock

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,22 +445,21 @@ dependencies = [
445445

446446
[[package]]
447447
name = "capstone"
448-
version = "0.13.0"
448+
version = "0.14.0"
449449
source = "registry+https://github.com/rust-lang/crates.io-index"
450-
checksum = "015ef5d5ca1743e3f94af9509ba6bd2886523cfee46e48d15c2ef5216fd4ac9a"
450+
checksum = "f442ae0f2f3f1b923334b4a5386c95c69c1cfa072bafa23d6fae6d9682eb1dd4"
451451
dependencies = [
452452
"capstone-sys",
453-
"libc",
453+
"static_assertions",
454454
]
455455

456456
[[package]]
457457
name = "capstone-sys"
458-
version = "0.17.0"
458+
version = "0.18.0"
459459
source = "registry+https://github.com/rust-lang/crates.io-index"
460-
checksum = "2267cb8d16a1e4197863ec4284ffd1aec26fe7e57c58af46b02590a0235809a0"
460+
checksum = "a4e8087cab6731295f5a2a2bd82989ba4f41d3a428aab2e7c98d8f4db38aac05"
461461
dependencies = [
462462
"cc",
463-
"libc",
464463
]
465464

466465
[[package]]
@@ -2232,19 +2231,19 @@ dependencies = [
22322231

22332232
[[package]]
22342233
name = "libffi"
2235-
version = "5.0.0"
2234+
version = "5.1.0"
22362235
source = "registry+https://github.com/rust-lang/crates.io-index"
2237-
checksum = "0444124f3ffd67e1b0b0c661a7f81a278a135eb54aaad4078e79fbc8be50c8a5"
2236+
checksum = "0498fe5655f857803e156523e644dcdcdc3b3c7edda42ea2afdae2e09b2db87b"
22382237
dependencies = [
22392238
"libc",
22402239
"libffi-sys",
22412240
]
22422241

22432242
[[package]]
22442243
name = "libffi-sys"
2245-
version = "4.0.0"
2244+
version = "4.1.0"
22462245
source = "registry+https://github.com/rust-lang/crates.io-index"
2247-
checksum = "3d722da8817ea580d0669da6babe2262d7b86a1af1103da24102b8bb9c101ce7"
2246+
checksum = "71d4f1d4ce15091955144350b75db16a96d4a63728500122706fb4d29a26afbb"
22482247
dependencies = [
22492248
"cc",
22502249
]

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ pub enum ExternAbi {
6767

6868
/* gpu */
6969
/// An entry-point function called by the GPU's host
70-
// FIXME: should not be callable from Rust on GPU targets, is for host's use only
7170
GpuKernel,
7271
/// An entry-point function called by the GPU's host
7372
// FIXME: why do we have two of these?

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,16 @@ impl<'a> AstValidator<'a> {
401401
| CanonAbi::Rust
402402
| CanonAbi::RustCold
403403
| CanonAbi::Arm(_)
404-
| CanonAbi::GpuKernel
405404
| CanonAbi::X86(_) => { /* nothing to check */ }
406405

406+
CanonAbi::GpuKernel => {
407+
// An `extern "gpu-kernel"` function cannot be `async` and/or `gen`.
408+
self.reject_coroutine(abi, sig);
409+
410+
// An `extern "gpu-kernel"` function cannot return a value.
411+
self.reject_return(abi, sig);
412+
}
413+
407414
CanonAbi::Custom => {
408415
// An `extern "custom"` function must be unsafe.
409416
self.reject_safe_fn(abi, ctxt, sig);
@@ -433,18 +440,7 @@ impl<'a> AstValidator<'a> {
433440
self.dcx().emit_err(errors::AbiX86Interrupt { spans, param_count });
434441
}
435442

436-
if let FnRetTy::Ty(ref ret_ty) = sig.decl.output
437-
&& match &ret_ty.kind {
438-
TyKind::Never => false,
439-
TyKind::Tup(tup) if tup.is_empty() => false,
440-
_ => true,
441-
}
442-
{
443-
self.dcx().emit_err(errors::AbiMustNotHaveReturnType {
444-
span: ret_ty.span,
445-
abi,
446-
});
447-
}
443+
self.reject_return(abi, sig);
448444
} else {
449445
// An `extern "interrupt"` function must have type `fn()`.
450446
self.reject_params_or_return(abi, ident, sig);
@@ -496,6 +492,18 @@ impl<'a> AstValidator<'a> {
496492
}
497493
}
498494

495+
fn reject_return(&self, abi: ExternAbi, sig: &FnSig) {
496+
if let FnRetTy::Ty(ref ret_ty) = sig.decl.output
497+
&& match &ret_ty.kind {
498+
TyKind::Never => false,
499+
TyKind::Tup(tup) if tup.is_empty() => false,
500+
_ => true,
501+
}
502+
{
503+
self.dcx().emit_err(errors::AbiMustNotHaveReturnType { span: ret_ty.span, abi });
504+
}
505+
}
506+
499507
fn reject_params_or_return(&self, abi: ExternAbi, ident: &Ident, sig: &FnSig) {
500508
let mut spans: Vec<_> = sig.decl.inputs.iter().map(|p| p.span).collect();
501509
if let FnRetTy::Ty(ref ret_ty) = sig.decl.output

compiler/rustc_codegen_llvm/src/base.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ pub(crate) fn compile_codegen_unit(
9393
// They are necessary for correct offload execution. We do this here to simplify the
9494
// `offload` intrinsic, avoiding the need for tracking whether it's the first
9595
// intrinsic call or not.
96-
let has_host_offload =
97-
cx.sess().opts.unstable_opts.offload.iter().any(|o| matches!(o, Offload::Host(_)));
96+
let has_host_offload = cx
97+
.sess()
98+
.opts
99+
.unstable_opts
100+
.offload
101+
.iter()
102+
.any(|o| matches!(o, Offload::Host(_) | Offload::Test));
98103
if has_host_offload && !cx.sess().target.is_like_gpu {
99104
cx.offload_globals.replace(Some(OffloadGlobals::declare(&cx)));
100105
}

compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ impl<'ll> OffloadGlobals<'ll> {
4949
let bin_desc = cx.type_named_struct("struct.__tgt_bin_desc");
5050
cx.set_struct_body(bin_desc, &tgt_bin_desc_ty, false);
5151

52-
let register_lib = declare_offload_fn(&cx, "__tgt_register_lib", mapper_fn_ty);
53-
let unregister_lib = declare_offload_fn(&cx, "__tgt_unregister_lib", mapper_fn_ty);
52+
let reg_lib_decl = cx.type_func(&[cx.type_ptr()], cx.type_void());
53+
let register_lib = declare_offload_fn(&cx, "__tgt_register_lib", reg_lib_decl);
54+
let unregister_lib = declare_offload_fn(&cx, "__tgt_unregister_lib", reg_lib_decl);
5455
let init_ty = cx.type_func(&[], cx.type_void());
5556
let init_rtls = declare_offload_fn(cx, "__tgt_init_all_rtls", init_ty);
5657

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,12 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
330330
let mut e_flags: u32 = 0x0;
331331

332332
// Check if compression is enabled
333-
// `unstable_target_features` is used here because "zca" is gated behind riscv_target_feature.
334-
if sess.unstable_target_features.contains(&sym::zca) {
333+
if sess.target_features.contains(&sym::zca) {
335334
e_flags |= elf::EF_RISCV_RVC;
336335
}
337336

338337
// Check if RVTSO is enabled
339-
// `unstable_target_features` is used here because "ztso" is gated behind riscv_target_feature.
340-
if sess.unstable_target_features.contains(&sym::ztso) {
338+
if sess.target_features.contains(&sym::ztso) {
341339
e_flags |= elf::EF_RISCV_TSO;
342340
}
343341

compiler/rustc_feature/src/unstable.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,16 @@ declare_features! (
239239
(internal, negative_bounds, "1.71.0", None),
240240
/// Set the maximum pattern complexity allowed (not limited by default).
241241
(internal, pattern_complexity_limit, "1.78.0", None),
242-
/// Allows using pattern types.
243-
(internal, pattern_types, "1.79.0", Some(123646)),
244242
/// Allows using `#[prelude_import]` on glob `use` items.
245243
(internal, prelude_import, "1.2.0", None),
246244
/// Used to identify crates that contain the profiler runtime.
247245
(internal, profiler_runtime, "1.18.0", None),
248246
/// Allows using `rustc_*` attributes (RFC 572).
249247
(internal, rustc_attrs, "1.0.0", None),
250-
/// Introduces a hierarchy of `Sized` traits (RFC 3729).
251-
(unstable, sized_hierarchy, "1.89.0", None),
252248
/// Allows using the `#[stable]` and `#[unstable]` attributes.
253249
(internal, staged_api, "1.0.0", None),
254250
/// Added for testing unstable lints; perma-unstable.
255251
(internal, test_unstable_lint, "1.60.0", None),
256-
/// Helps with formatting for `group_imports = "StdExternalCrate"`.
257-
(unstable, unqualified_local_imports, "1.83.0", Some(138299)),
258252
/// Use for stable + negative coherence and strict coherence depending on trait's
259253
/// rustc_strict_coherence value.
260254
(unstable, with_negative_coherence, "1.60.0", None),
@@ -295,6 +289,8 @@ declare_features! (
295289
(internal, needs_panic_runtime, "1.10.0", Some(32837)),
296290
/// Allows using the `#![panic_runtime]` attribute.
297291
(internal, panic_runtime, "1.10.0", Some(32837)),
292+
/// Allows using pattern types.
293+
(internal, pattern_types, "1.79.0", Some(123646)),
298294
/// Allows using `#[rustc_allow_const_fn_unstable]`.
299295
/// This is an attribute on `const fn` for the same
300296
/// purpose as `#[allow_internal_unstable]`.
@@ -305,12 +301,16 @@ declare_features! (
305301
(internal, rustdoc_internals, "1.58.0", Some(90418)),
306302
/// Allows using the `rustdoc::missing_doc_code_examples` lint
307303
(unstable, rustdoc_missing_doc_code_examples, "1.31.0", Some(101730)),
304+
/// Introduces a hierarchy of `Sized` traits (RFC 3729).
305+
(unstable, sized_hierarchy, "1.89.0", Some(144404)),
308306
/// Allows using `#[structural_match]` which indicates that a type is structurally matchable.
309307
/// FIXME: Subsumed by trait `StructuralPartialEq`, cannot move to removed until a library
310308
/// feature with the same name exists.
311309
(unstable, structural_match, "1.8.0", Some(31434)),
312310
/// Allows using the `rust-call` ABI.
313311
(unstable, unboxed_closures, "1.0.0", Some(29625)),
312+
/// Helps with formatting for `group_imports = "StdExternalCrate"`.
313+
(unstable, unqualified_local_imports, "1.83.0", Some(138299)),
314314
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
315315
// Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
316316
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!

compiler/rustc_hir/src/def.rs

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -563,29 +563,6 @@ pub enum Res<Id = hir::HirId> {
563563
/// to get the underlying type.
564564
alias_to: DefId,
565565

566-
/// Whether the `Self` type is disallowed from mentioning generics (i.e. when used in an
567-
/// anonymous constant).
568-
///
569-
/// HACK(min_const_generics): self types also have an optional requirement to **not**
570-
/// mention any generic parameters to allow the following with `min_const_generics`:
571-
/// ```
572-
/// # struct Foo;
573-
/// impl Foo { fn test() -> [u8; size_of::<Self>()] { todo!() } }
574-
///
575-
/// struct Bar([u8; baz::<Self>()]);
576-
/// const fn baz<T>() -> usize { 10 }
577-
/// ```
578-
/// We do however allow `Self` in repeat expression even if it is generic to not break code
579-
/// which already works on stable while causing the `const_evaluatable_unchecked` future
580-
/// compat lint:
581-
/// ```
582-
/// fn foo<T>() {
583-
/// let _bar = [1_u8; size_of::<*mut T>()];
584-
/// }
585-
/// ```
586-
// FIXME(generic_const_exprs): Remove this bodge once that feature is stable.
587-
forbid_generic: bool,
588-
589566
/// Is this within an `impl Foo for bar`?
590567
is_trait_impl: bool,
591568
},
@@ -910,8 +887,8 @@ impl<Id> Res<Id> {
910887
Res::PrimTy(id) => Res::PrimTy(id),
911888
Res::Local(id) => Res::Local(map(id)),
912889
Res::SelfTyParam { trait_ } => Res::SelfTyParam { trait_ },
913-
Res::SelfTyAlias { alias_to, forbid_generic, is_trait_impl } => {
914-
Res::SelfTyAlias { alias_to, forbid_generic, is_trait_impl }
890+
Res::SelfTyAlias { alias_to, is_trait_impl } => {
891+
Res::SelfTyAlias { alias_to, is_trait_impl }
915892
}
916893
Res::ToolMod => Res::ToolMod,
917894
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
@@ -926,8 +903,8 @@ impl<Id> Res<Id> {
926903
Res::PrimTy(id) => Res::PrimTy(id),
927904
Res::Local(id) => Res::Local(map(id)?),
928905
Res::SelfTyParam { trait_ } => Res::SelfTyParam { trait_ },
929-
Res::SelfTyAlias { alias_to, forbid_generic, is_trait_impl } => {
930-
Res::SelfTyAlias { alias_to, forbid_generic, is_trait_impl }
906+
Res::SelfTyAlias { alias_to, is_trait_impl } => {
907+
Res::SelfTyAlias { alias_to, is_trait_impl }
931908
}
932909
Res::ToolMod => Res::ToolMod,
933910
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),

compiler/rustc_hir/src/hir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl<'hir> ConstItemRhs<'hir> {
440440
/// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`).
441441
///
442442
/// For an explanation of the `Unambig` generic parameter see the dev-guide:
443-
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html>
443+
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
444444
#[derive(Clone, Copy, Debug, HashStable_Generic)]
445445
#[repr(C)]
446446
pub struct ConstArg<'hir, Unambig = ()> {
@@ -3374,7 +3374,7 @@ pub enum AmbigArg {}
33743374
/// Represents a type in the `HIR`.
33753375
///
33763376
/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3377-
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html>
3377+
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
33783378
#[derive(Debug, Clone, Copy, HashStable_Generic)]
33793379
#[repr(C)]
33803380
pub struct Ty<'hir, Unambig = ()> {
@@ -3713,7 +3713,7 @@ pub enum InferDelegationKind {
37133713
/// The various kinds of types recognized by the compiler.
37143714
///
37153715
/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3716-
/// <https://rustc-dev-guide.rust-lang.org/hir/ambig-unambig-ty-and-consts.html>
3716+
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
37173717
// SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible
37183718
#[repr(u8, C)]
37193719
#[derive(Debug, Clone, Copy, HashStable_Generic)]

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
21492149
);
21502150
self.check_param_uses_if_mcg(tcx.types.self_param, span, false)
21512151
}
2152-
Res::SelfTyAlias { alias_to: def_id, forbid_generic: _, .. } => {
2152+
Res::SelfTyAlias { alias_to: def_id, .. } => {
21532153
// `Self` in impl (we know the concrete type).
21542154
assert_eq!(opt_self_ty, None);
21552155
// Try to evaluate any array length constants.

0 commit comments

Comments
 (0)