Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a3be40f
Rustdoc issue template: fix typo in comment ("thorugh")
DanielEScherzer Sep 11, 2026
fcec25c
Remove unused argument of `write_splatted_call`
JonathanBrouwer Sep 11, 2026
0957d02
Remove unused argument of `simplify_rvalue`
JonathanBrouwer Sep 11, 2026
86f0a13
Remove unused argument of `check_let`
JonathanBrouwer Sep 11, 2026
bb89d6f
Remove unused argument of `process_registered_region_obligations`
JonathanBrouwer Sep 11, 2026
e1a4c77
Remove unused argument of `lower_fn_decl`
JonathanBrouwer Sep 11, 2026
338b24b
Remove unused argument of `try_match_macro_derive`
JonathanBrouwer Sep 11, 2026
c690933
Remove unused argument of `try_match_macro_attr`
JonathanBrouwer Sep 11, 2026
de8eec9
Remove unused argument of `try_match_macro`
JonathanBrouwer Sep 11, 2026
80e7183
Remove unused argument of `unify_query_var_values`
JonathanBrouwer Sep 11, 2026
8764372
docs(error_codes): document type/const mismatch case for E0747
raushan728 Sep 12, 2026
0a612a2
Remove `domain_size` from `GrowableBitSet`
Zalathar Sep 10, 2026
16cd825
Use `GrowableBitSet` in the main loop of `rustc_mir_transform::sroa`
Zalathar Sep 10, 2026
d774bfa
Stabilize `Vec::from_fn`
EFanZh Sep 12, 2026
df15f02
Disconnect `rustc_codegen_ssa` from `rustc_mir_transform`
Zalathar Sep 12, 2026
83025dc
Rollup merge of #162623 - Zalathar:growable, r=hanna-kruppe
JonathanBrouwer Sep 12, 2026
f42e056
Rollup merge of #162678 - Zalathar:ssa-transform, r=hanna-kruppe
JonathanBrouwer Sep 12, 2026
d66ffb0
Rollup merge of #162641 - JonathanBrouwer:unused_args, r=BoxyUwU
JonathanBrouwer Sep 12, 2026
2725a26
Rollup merge of #162663 - DanielEScherzer:rustdoc-template-typo, r=ji…
JonathanBrouwer Sep 12, 2026
d6570b4
Rollup merge of #162684 - raushan728:issues/162320, r=GuillaumeGomez
JonathanBrouwer Sep 12, 2026
f91d429
Rollup merge of #162685 - EFanZh:stabilize-vec-from-fn, r=hanna-kruppe
JonathanBrouwer Sep 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For diagnostics, please provide a mockup of the desired output in a code block.
<!--
* rustdoc console output
* browser screenshot of generated html
* rustdoc json (prettify by running through `jq` or running thorugh an online formatter)
* rustdoc json (prettify by running through `jq` or running through an online formatter)
-->
```console
<code>
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3855,7 +3855,6 @@ dependencies = [
"rustc_macros",
"rustc_metadata",
"rustc_middle",
"rustc_mir_transform",
"rustc_serialize",
"rustc_session",
"rustc_span",
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/expr/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
let fn_decl = self.lower_fn_decl(decl, closure_id, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
def_id: closure_def_id,
Expand Down Expand Up @@ -327,8 +327,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl =
self.lower_fn_decl(&decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
let fn_decl = self.lower_fn_decl(&decl, closure_id, FnDeclKind::Closure, None);

if let Const::Yes(span) = constness {
self.dcx().span_err(span, "const coroutines are not supported");
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let itctx = ImplTraitContext::Universal;
let (generics, decl) = this.lower_generics(generics, itctx, |this| {
this.lower_fn_decl(decl, id, *fn_sig_span, FnDeclKind::Fn, coroutine_marker)
this.lower_fn_decl(decl, id, FnDeclKind::Fn, coroutine_marker)
});
let sig = hir::FnSig {
decl,
Expand Down Expand Up @@ -741,7 +741,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let (generics, (decl, fn_args)) = self.lower_generics(generics, itctx, |this| {
(
// Disallow `impl Trait` in foreign items.
this.lower_fn_decl(fdec, i.id, sig.span, FnDeclKind::ExternFn, None),
this.lower_fn_decl(fdec, i.id, FnDeclKind::ExternFn, None),
this.lower_fn_params_to_idents(fdec),
)
});
Expand Down Expand Up @@ -1668,7 +1668,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let header = self.lower_fn_header(sig.header, hir::Safety::Safe, attrs);
let itctx = ImplTraitContext::Universal;
let (generics, decl) = self.lower_generics(generics, itctx, |this| {
this.lower_fn_decl(&sig.decl, id, sig.span, kind, coroutine_marker)
this.lower_fn_decl(&sig.decl, id, kind, coroutine_marker)
});
(generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) })
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
generic_params,
safety: self.lower_safety(f.safety, hir::Safety::Safe),
abi: self.lower_extern(f.ext),
decl: self.lower_fn_decl(&f.decl, t.id, t.span, FnDeclKind::Pointer, None),
decl: self.lower_fn_decl(&f.decl, t.id, FnDeclKind::Pointer, None),
param_idents: self.lower_fn_params_to_idents(&f.decl),
}))
}
Expand Down Expand Up @@ -1962,7 +1962,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
decl: &FnDecl,
fn_node_id: NodeId,
fn_span: Span,
kind: FnDeclKind,
coro: Option<CoroutineMarker>,
) -> &'hir hir::FnDecl<'hir> {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_middle = { path = "../rustc_middle" }
rustc_mir_transform = { path = "../rustc_mir_transform" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let fn_abi = cx.fn_abi_of_instance(instance, ty::List::empty());
debug!("fn_abi: {:?}", fn_abi);

let nop_landing_pads = rustc_mir_transform::remove_noop_landing_pads::find_noop_landing_pads(
mir,
Some(rustc_mir_transform::remove_noop_landing_pads::ExtraInfo {
tcx,
instance,
typing_env: cx.typing_env(),
}),
);
let nop_landing_pads = tcx.find_noop_landing_pads_for_instance(mir, instance, cx.typing_env());

if tcx.features().ergonomic_clones() {
let monomorphized_mir = instance.instantiate_mir_and_normalize_erasing_regions(
Expand Down
21 changes: 20 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0747.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Generic arguments were not provided in the same order as the corresponding
generic parameters are declared.
generic parameters are declared, or a type was provided when a constant
was expected.

Erroneous code example:

Expand All @@ -18,3 +19,21 @@ struct S<'a, T>(&'a T);

type X = S<'static, ()>; // ok
```

Another erroneous code example:

```compile_fail,E0747
struct Foo<const N: usize>;

fn foo() -> Foo<usize> {} // error: type provided when a constant was
// expected
```

A constant expression must be provided when a constant generic parameter
is declared, not a type, as in the following:

```
struct Foo<const N: usize>;

fn foo() -> Foo<3> { Foo }
```
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/mbe/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ pub(super) fn failed_to_match_macro(
let mut tracker = CollectTrackerAndEmitter::new(name, psess.dcx(), sp);

let try_success_result = match args {
FailedMacro::Func => try_match_macro(psess, name, body, rules, &mut tracker),
FailedMacro::Func => try_match_macro(psess, body, rules, &mut tracker),
FailedMacro::Attr(attr_args) => {
try_match_macro_attr(psess, name, attr_args, body, rules, &mut tracker)
try_match_macro_attr(psess, attr_args, body, rules, &mut tracker)
}
FailedMacro::Derive => try_match_macro_derive(psess, name, body, rules, &mut tracker),
FailedMacro::Derive => try_match_macro_derive(psess, body, rules, &mut tracker),
};

if try_success_result.is_ok() {
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl MacroRulesMacroExpander {
trace_macros_note(&mut cx.expansions, sp, msg);
}

match try_match_macro_derive(psess, name, body, rules, &mut NoopTracker) {
match try_match_macro_derive(psess, body, rules, &mut NoopTracker) {
Ok((rule_index, rule, named_matches)) => {
let MacroRule::Derive { rhs, .. } = rule else {
panic!("try_match_macro_derive returned non-derive rule");
Expand Down Expand Up @@ -447,7 +447,7 @@ fn expand_macro<'cx, 'a: 'cx>(
}

// Track nothing for the best performance.
let try_success_result = try_match_macro(psess, name, &arg, rules, &mut NoopTracker);
let try_success_result = try_match_macro(psess, &arg, rules, &mut NoopTracker);

match try_success_result {
Ok((rule_index, rule, named_matches)) => {
Expand Down Expand Up @@ -538,7 +538,7 @@ fn expand_macro_attr(
}

// Track nothing for the best performance.
match try_match_macro_attr(psess, name, &args, &body, rules, &mut NoopTracker) {
match try_match_macro_attr(psess, &args, &body, rules, &mut NoopTracker) {
Ok((i, rule, named_matches)) => {
let MacroRule::Attr { rhs, unsafe_rule, .. } = rule else {
panic!("try_macro_match_attr returned non-attr rule");
Expand Down Expand Up @@ -606,7 +606,6 @@ pub(super) enum CanRetry {
#[instrument(level = "debug", skip(psess, arg, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
arg: &TokenStream,
rules: &'matcher [MacroRule],
track: &mut T,
Expand Down Expand Up @@ -686,7 +685,6 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>(
#[instrument(level = "debug", skip(psess, attr_args, attr_body, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
attr_args: &TokenStream,
attr_body: &TokenStream,
rules: &'matcher [MacroRule],
Expand Down Expand Up @@ -743,7 +741,6 @@ pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>(
#[instrument(level = "debug", skip(psess, body, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro_derive<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
body: &TokenStream,
rules: &'matcher [MacroRule],
track: &mut T,
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ where

lint_redundant_lifetimes(tcx, body_def_id, &outlives_env);

let errors = infcx.resolve_regions_with_outlives_env(&outlives_env, tcx.def_span(body_def_id));
let errors = infcx.resolve_regions_with_outlives_env(&outlives_env);
if errors.is_empty() {
return Ok(());
}
Expand All @@ -215,8 +215,7 @@ where
// the implied bounds hack if this contains `bevy_ecs`'s `ParamSet` type.
false,
);
let errors_compat =
infcx_compat.resolve_regions_with_outlives_env(&outlives_env, tcx.def_span(body_def_id));
let errors_compat = infcx_compat.resolve_regions_with_outlives_env(&outlives_env);
if errors_compat.is_empty() {
// FIXME: Once we fix bevy, this would be the place to insert a warning
// to upgrade bevy.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub(crate) fn write_splatted_call(
&self,
hir_id: HirId,
span: Span,
fn_id: SplatLoweringInfo<'tcx>,
callee_generic_args: Option<GenericArgsRef<'tcx>>,
first_tupled_arg_index: u16,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// FIXME(const_trait_impl): does not enforce constness yet
self.write_splatted_call(
call_expr.hir_id,
call_span,
fn_id,
callee_generic_args,
first_tupled_arg_index,
Expand Down
57 changes: 22 additions & 35 deletions compiler/rustc_index/src/bit_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,6 @@ impl<T: Idx> DenseBitSet<T> {
result
}

/// Replaces this bitset with one having the same elements, but a larger domain size.
#[inline]
pub fn enlarge(self, new_domain_size: usize) -> DenseBitSet<T> {
// We could also support shrinking, but it's hard to imagine a real use-case for it.
assert!(self.domain_size <= new_domain_size);
let new_num_words = num_words(new_domain_size);

let DenseBitSet { domain_size: _, mut words, marker } = self;

if new_num_words != words.len() {
let mut words_vec = words.into_vec();
words_vec.resize(new_num_words, 0);
words = words_vec.into_boxed_slice()
}

DenseBitSet { domain_size: new_domain_size, words, marker }
}

/// Clear all elements.
#[inline]
pub fn clear(&mut self) {
Expand Down Expand Up @@ -1231,21 +1213,19 @@ impl<'a, T: Idx> Iterator for MixedBitIter<'a, T> {
/// just be `usize`.
#[derive(Debug, PartialEq)]
pub struct GrowableBitSet<T: Idx> {
domain_size: usize,
words: Vec<Word>,
marker: PhantomData<T>,
}

// Manually implemented to provide `clone_from`.
impl<T: Idx> Clone for GrowableBitSet<T> {
fn clone(&self) -> Self {
let &GrowableBitSet { domain_size, ref words, marker } = self;
GrowableBitSet { domain_size, words: words.clone(), marker }
let &GrowableBitSet { ref words, marker } = self;
GrowableBitSet { words: words.clone(), marker }
}

fn clone_from(&mut self, source: &Self) {
let GrowableBitSet { domain_size, words, marker } = source;
self.domain_size.clone_from(domain_size);
let GrowableBitSet { words, marker } = source;
self.words.clone_from(words);
self.marker.clone_from(marker);
}
Expand All @@ -1258,28 +1238,25 @@ impl<T: Idx> Default for GrowableBitSet<T> {
}

impl<T: Idx> GrowableBitSet<T> {
/// Ensure that the set can hold at least `min_domain_size` elements.
pub fn ensure(&mut self, min_domain_size: usize) {
if self.domain_size < min_domain_size {
self.domain_size = min_domain_size;
}
/// Ensure that the set has allocated and initialized at least `min_num_bits` bits.
fn ensure(&mut self, min_num_bits: usize) {
let min_num_words = num_words(min_num_bits);
self.ensure_words(min_num_words);
}

let min_num_words = num_words(min_domain_size);
/// Ensures that the set has allocated and initialized at least `min_num_words` words.
fn ensure_words(&mut self, min_num_words: usize) {
if self.words.len() < min_num_words {
self.words.resize(min_num_words, 0)
}
}

pub fn new_empty() -> GrowableBitSet<T> {
GrowableBitSet { domain_size: 0, words: vec![], marker: PhantomData }
GrowableBitSet { words: vec![], marker: PhantomData }
}

pub fn with_capacity(capacity: usize) -> GrowableBitSet<T> {
GrowableBitSet {
domain_size: capacity,
words: vec![0; num_words(capacity)],
marker: PhantomData,
}
GrowableBitSet { words: Vec::with_capacity(num_words(capacity)), marker: PhantomData }
}

/// Returns `true` if the set has changed.
Expand Down Expand Up @@ -1309,6 +1286,16 @@ impl<T: Idx> GrowableBitSet<T> {
pub fn iter(&self) -> BitIter<'_, T> {
BitIter::new(&self.words)
}

/// Mutates `self = self | other`.
#[inline]
pub fn union(&mut self, other: &GrowableBitSet<T>) {
// Eagerly grow `self` to be at least as large as `other`.
// This is simpler than trying to check whether `other` has any nonzero
// bits beyond our current size.
self.ensure_words(other.words.len());
update_words(&mut self.words[..other.words.len()], &other.words, |a, b| a | b);
}
}

/// A fixed-size 2D bit matrix type with a dense representation.
Expand Down
29 changes: 29 additions & 0 deletions compiler/rustc_index/src/bit_set/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,35 @@ fn grow() {
}
}

#[test]
fn growable_union() {
// Create two input sets with partly-overlapping values, and different sizes.
let mut twos = GrowableBitSet::<usize>::new_empty();
for i in (0usize..100).map(|x| x * 2) {
twos.insert(i);
}

let mut threes = GrowableBitSet::<usize>::new_empty();
for i in (0usize..100).map(|x| x * 3) {
threes.insert(i);
}

// Double-check that we did end up with input sets of different sizes.
assert_ne!(twos.words.len(), threes.words.len());

// Perform a union in both directions, and check that the resulting contents are correct.
for (mut lhs, rhs) in [(twos.clone(), threes.clone()), (threes.clone(), twos.clone())] {
lhs.union(&rhs);

for i in 0..400 {
assert_eq!(
lhs.contains(i),
(i.is_multiple_of(2) && i < 200) || (i.is_multiple_of(3) && i < 300)
);
}
}
}

#[test]
fn matrix_intersection() {
let mut matrix: BitMatrix<usize, usize> = BitMatrix::new(200, 200);
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_infer/src/infer/outlives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::iter;
use rustc_data_structures::undo_log::UndoLogs;
use rustc_middle::traits::query::OutlivesBound;
use rustc_middle::ty;
use rustc_span::Span;
use tracing::instrument;

use self::env::OutlivesEnvironment;
Expand Down Expand Up @@ -44,9 +43,8 @@ impl<'tcx> InferCtxt<'tcx> {
pub fn resolve_regions_with_outlives_env(
&self,
outlives_env: &OutlivesEnvironment<'tcx>,
span: Span,
) -> Vec<RegionResolutionError<'tcx>> {
self.process_registered_region_obligations(outlives_env, span);
self.process_registered_region_obligations(outlives_env);

let mut storage = {
let mut inner = self.inner.borrow_mut();
Expand Down
Loading
Loading