Skip to content

Commit c9cd707

Browse files
committed
Auto merge of rust-lang#139229 - Zalathar:rollup-5cs3f4d, r=Zalathar
Rollup of 14 pull requests Successful merges: - rust-lang#135295 (Check empty SIMD vector in inline asm) - rust-lang#138003 (Add the new `amx` target features and the `movrs` target feature) - rust-lang#138823 (rustc_target: RISC-V: add base `I`-related important extensions) - rust-lang#138913 (Remove even more instances of `@ts-expect-error` from search.js) - rust-lang#138941 (Do not mix normalized and unnormalized caller bounds when constructing param-env for `receiver_is_dispatchable`) - rust-lang#139060 (replace commit placeholder in vendor status with actual commit) - rust-lang#139102 (coverage: Avoid splitting spans during span extraction/refinement) - rust-lang#139191 (small opaque type/borrowck cleanup) - rust-lang#139200 (Skip suggest impl or dyn when poly trait is not a real trait) - rust-lang#139208 (fix dead link netbsd.md) - rust-lang#139210 (chore: remove redundant backtick) - rust-lang#139212 (Update mdbook to 0.4.48) - rust-lang#139214 (Tell rustfmt to use the 2024 edition in ./x.py fmt) - rust-lang#139225 (move autodiff from EnzymeAD/Enzyme to our rust-lang/Enzyme soft-fork) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 70dab5a + ea51a1c commit c9cd707

File tree

117 files changed

+760
-583
lines changed

Some content is hidden

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

117 files changed

+760
-583
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
shallow = true
4646
[submodule "src/tools/enzyme"]
4747
path = src/tools/enzyme
48-
url = https://github.com/EnzymeAD/Enzyme.git
48+
url = https://github.com/rust-lang/Enzyme.git
4949
shallow = true
5050
[submodule "src/gcc"]
5151
path = src/gcc

compiler/rustc_borrowck/src/consumers.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This file provides API for compiler consumers.
22
33
use rustc_hir::def_id::LocalDefId;
4-
use rustc_index::{IndexSlice, IndexVec};
4+
use rustc_index::IndexVec;
55
use rustc_middle::mir::{Body, Promoted};
66
use rustc_middle::ty::TyCtxt;
77

@@ -100,8 +100,5 @@ pub fn get_body_with_borrowck_facts(
100100
def: LocalDefId,
101101
options: ConsumerOptions,
102102
) -> BodyWithBorrowckFacts<'_> {
103-
let (input_body, promoted) = tcx.mir_promoted(def);
104-
let input_body: &Body<'_> = &input_body.borrow();
105-
let promoted: &IndexSlice<_, _> = &promoted.borrow();
106-
*super::do_mir_borrowck(tcx, input_body, promoted, Some(options)).1.unwrap()
103+
*super::do_mir_borrowck(tcx, def, Some(options)).1.unwrap()
107104
}

compiler/rustc_borrowck/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ pub fn provide(providers: &mut Providers) {
103103
}
104104

105105
fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
106-
let (input_body, promoted) = tcx.mir_promoted(def);
107-
debug!("run query mir_borrowck: {}", tcx.def_path_str(def));
108-
106+
let (input_body, _) = tcx.mir_promoted(def);
109107
let input_body: &Body<'_> = &input_body.borrow();
110-
111108
if input_body.should_skip() || input_body.tainted_by_errors.is_some() {
112109
debug!("Skipping borrowck because of injected body or tainted body");
113110
// Let's make up a borrowck result! Fun times!
@@ -120,7 +117,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
120117
return tcx.arena.alloc(result);
121118
}
122119

123-
let borrowck_result = do_mir_borrowck(tcx, input_body, &*promoted.borrow(), None).0;
120+
let borrowck_result = do_mir_borrowck(tcx, def, None).0;
124121
debug!("mir_borrowck done");
125122

126123
tcx.arena.alloc(borrowck_result)
@@ -131,15 +128,16 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
131128
/// Use `consumer_options: None` for the default behavior of returning
132129
/// [`BorrowCheckResult`] only. Otherwise, return [`BodyWithBorrowckFacts`] according
133130
/// to the given [`ConsumerOptions`].
134-
#[instrument(skip(tcx, input_body, input_promoted), fields(id=?input_body.source.def_id()), level = "debug")]
131+
#[instrument(skip(tcx), level = "debug")]
135132
fn do_mir_borrowck<'tcx>(
136133
tcx: TyCtxt<'tcx>,
137-
input_body: &Body<'tcx>,
138-
input_promoted: &IndexSlice<Promoted, Body<'tcx>>,
134+
def: LocalDefId,
139135
consumer_options: Option<ConsumerOptions>,
140136
) -> (BorrowCheckResult<'tcx>, Option<Box<BodyWithBorrowckFacts<'tcx>>>) {
141-
let def = input_body.source.def_id().expect_local();
142137
let infcx = BorrowckInferCtxt::new(tcx, def);
138+
let (input_body, promoted) = tcx.mir_promoted(def);
139+
let input_body: &Body<'_> = &input_body.borrow();
140+
let input_promoted: &IndexSlice<_, _> = &promoted.borrow();
143141
if let Some(e) = input_body.tainted_by_errors {
144142
infcx.set_tainted_by_errors(e);
145143
}
@@ -499,7 +497,8 @@ impl<'tcx> BorrowckInferCtxt<'tcx> {
499497
)
500498
});
501499

502-
self.inject_new_hidden_type_unchecked(key, hidden_ty);
500+
let prev = self.register_hidden_type_in_storage(key, hidden_ty);
501+
assert_eq!(prev, None);
503502
}
504503
}
505504
}

compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@
66
#![feature(gen_blocks)]
77

88
fn foo() -> impl Iterator<Item = u32> {
9-
gen { yield 42; for x in 3..6 { yield x } }
9+
gen {
10+
yield 42;
11+
for x in 3..6 {
12+
yield x
13+
}
14+
}
1015
}
1116

1217
fn moved() -> impl Iterator<Item = u32> {
1318
let mut x = "foo".to_string();
1419
gen move {
1520
yield 42;
16-
if x == "foo" { return }
21+
if x == "foo" {
22+
return;
23+
}
1724
x.clear();
18-
for x in 3..6 { yield x }
25+
for x in 3..6 {
26+
yield x
27+
}
1928
}
2029
}
2130

@@ -32,5 +41,4 @@ fn main() {
3241
let mut iter = moved();
3342
assert_eq!(iter.next(), Some(42));
3443
assert_eq!(iter.next(), None);
35-
3644
}

compiler/rustc_codegen_cranelift/rustfmt.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
ignore = [
2-
"example/gen_block_iterate.rs", # uses edition 2024
3-
]
4-
51
# Matches rustfmt.toml of rustc
62
style_edition = "2024"
73
use_small_heuristics = "Max"

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
300300
("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")),
301301
("sparc", "v8plus") if get_version().0 < 19 => None,
302302
("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
303+
// These new `amx` variants and `movrs` were introduced in LLVM20
304+
("x86", "amx-avx512" | "amx-fp8" | "amx-movrs" | "amx-tf32" | "amx-transpose")
305+
if get_version().0 < 20 =>
306+
{
307+
None
308+
}
309+
("x86", "movrs") if get_version().0 < 20 => None,
303310
(_, s) => Some(LLVMFeature::new(s)),
304311
}
305312
}

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ declare_features! (
324324
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
325325
(unstable, m68k_target_feature, "1.85.0", Some(134328)),
326326
(unstable, mips_target_feature, "1.27.0", Some(44839)),
327+
(unstable, movrs_target_feature, "CURRENT_RUSTC_VERSION", Some(137976)),
327328
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
328329
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),
329330
(unstable, riscv_target_feature, "1.45.0", Some(44839)),

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum NonAsmTypeReason<'tcx> {
2929
Invalid(Ty<'tcx>),
3030
InvalidElement(DefId, Ty<'tcx>),
3131
NotSizedPtr(Ty<'tcx>),
32+
EmptySIMDArray(Ty<'tcx>),
3233
}
3334

3435
impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
@@ -102,6 +103,9 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
102103
}
103104
ty::Adt(adt, args) if adt.repr().simd() => {
104105
let fields = &adt.non_enum_variant().fields;
106+
if fields.is_empty() {
107+
return Err(NonAsmTypeReason::EmptySIMDArray(ty));
108+
}
105109
let field = &fields[FieldIdx::ZERO];
106110
let elem_ty = field.ty(self.tcx(), args);
107111

@@ -226,6 +230,10 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
226230
can be used as arguments for inline assembly",
227231
).emit();
228232
}
233+
NonAsmTypeReason::EmptySIMDArray(ty) => {
234+
let msg = format!("use of empty SIMD vector `{ty}`");
235+
self.infcx.dcx().struct_span_err(expr.span, msg).emit();
236+
}
229237
}
230238
return None;
231239
}

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
8686
"expected a type, found a trait"
8787
);
8888
if self_ty.span.can_be_used_for_suggestions()
89+
&& poly_trait_ref.trait_ref.trait_def_id().is_some()
8990
&& !self.maybe_suggest_impl_trait(self_ty, &mut diag)
9091
&& !self.maybe_suggest_dyn_trait(self_ty, sugg, &mut diag)
9192
{

compiler/rustc_infer/src/infer/opaque_types/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,12 @@ impl<'tcx> InferCtxt<'tcx> {
198198
/// it hasn't previously been defined. This does not emit any
199199
/// constraints and it's the responsibility of the caller to make
200200
/// sure that the item bounds of the opaque are checked.
201-
pub fn inject_new_hidden_type_unchecked(
201+
pub fn register_hidden_type_in_storage(
202202
&self,
203203
opaque_type_key: OpaqueTypeKey<'tcx>,
204204
hidden_ty: OpaqueHiddenType<'tcx>,
205-
) {
206-
let prev = self.inner.borrow_mut().opaque_types().register(opaque_type_key, hidden_ty);
207-
assert_eq!(prev, None);
205+
) -> Option<Ty<'tcx>> {
206+
self.inner.borrow_mut().opaque_types().register(opaque_type_key, hidden_ty)
208207
}
209208

210209
/// Insert a hidden type into the opaque type storage, equating it

0 commit comments

Comments
 (0)