Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a8bff87
Stabilize [T]::split_off... methods
cramertj Feb 28, 2025
3786a7a
stabilize `box_uninit_write`
slanterns Mar 1, 2025
0ad48b4
Do not recover missing lifetime with random in-scope lifetime
compiler-errors Mar 3, 2025
e403654
Simplify `<Postorder as Iterator>::size_hint`
scottmcm Mar 3, 2025
53ee696
Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Win…
jieyouxu Mar 3, 2025
a89cddb
Add ``dyn`` keyword
Eclips4 Mar 3, 2025
3e5fddc
Allow struct field default values to reference struct's generics
compiler-errors Mar 3, 2025
12cc2b9
Remove unused `PpMode::needs_hir`
Zalathar Mar 4, 2025
fe6cf34
Also simplify `Preorder`'s `size_hint`
scottmcm Mar 4, 2025
a8c0b3b
rustdoc search: increase strictness of typechecking
lolbinarycat Mar 4, 2025
2f9ea8a
rustdoc search: give buildTypeMapIndex a conditional return type
lolbinarycat Mar 4, 2025
60c5855
ParserQueryElement.typeFilter MAY be a string, OR number.
lolbinarycat Mar 4, 2025
4febd27
Fix some typos
fuyangpengqi Mar 4, 2025
2816f03
Add `avr-none` to SUMMARY.md and platform-support.md
tgross35 Mar 4, 2025
84dd2a7
Remove obsolete comment from DeduceReadOnly
tmiasko Mar 4, 2025
c6c4ea4
Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: dele…
safinaskar Mar 4, 2025
7635f2b
fix whitespace
lolbinarycat Mar 4, 2025
32ebe8e
don't use double quotes
lolbinarycat Mar 4, 2025
d130e25
search.js: local variable `extra` is an array, annotate it as such.
lolbinarycat Mar 4, 2025
78b92f0
search.js: second argument of convertNameToId is optional
lolbinarycat Mar 4, 2025
9581f19
search.js: give pathSplitter a type signature
lolbinarycat Mar 4, 2025
4f6772d
give local mgens a type
lolbinarycat Mar 4, 2025
c05f6bf
search.js: give local `where` a type
lolbinarycat Mar 4, 2025
374de12
search.js: give buildIndex a proper return type
lolbinarycat Mar 4, 2025
5f39026
search.js: allow empty result arrays
lolbinarycat Mar 4, 2025
a9a52dd
search.js: give RawSearchIndexCrate.a an index signature
lolbinarycat Mar 4, 2025
8920167
search.js: remove incorrect outdated comment
lolbinarycat Mar 4, 2025
4d75c4f
Make CrateItem::body() function return an option
celinval Mar 5, 2025
55f8d3f
Pretty-print `#[deprecated]` attribute in HIR.
obi1kenobi Mar 4, 2025
29d3ad9
Rollup merge of #137829 - cramertj:stabilize-split-off, r=jhpratt
workingjubilee Mar 5, 2025
0bb2f95
Rollup merge of #137850 - slanterns:box_uninit_write, r=ibraheemdev
workingjubilee Mar 5, 2025
99efb42
Rollup merge of #137912 - compiler-errors:no-missing-lifetime-recover…
workingjubilee Mar 5, 2025
b3d7c14
Rollup merge of #137913 - compiler-errors:struct-field-default-generi…
workingjubilee Mar 5, 2025
81a4349
Rollup merge of #137923 - scottmcm:fix-postorder-size-hint, r=tmiasko
workingjubilee Mar 5, 2025
a3b271d
Rollup merge of #137949 - jieyouxu:update-install, r=ChrisDenton
workingjubilee Mar 5, 2025
48a0d52
Rollup merge of #137963 - Eclips4:fix-E0373, r=compiler-errors
workingjubilee Mar 5, 2025
dfbd9b2
Rollup merge of #137975 - Zalathar:needs-hir, r=compiler-errors
workingjubilee Mar 5, 2025
c32124f
Rollup merge of #137981 - lolbinarycat:rustdoc-js-less-expect-error, …
workingjubilee Mar 5, 2025
131867b
Rollup merge of #137986 - fuyangpengqi:master, r=Amanieu
workingjubilee Mar 5, 2025
349f6af
Rollup merge of #137991 - tgross35:avr-book-links, r=jieyouxu
workingjubilee Mar 5, 2025
7f6ad7f
Rollup merge of #137993 - tmiasko:deduce-comment, r=compiler-errors
workingjubilee Mar 5, 2025
f32ba6b
Rollup merge of #137996 - safinaskar:2025-03-04-revert-parallel, r=co…
workingjubilee Mar 5, 2025
a69982e
Rollup merge of #138019 - obi1kenobi:pg/pretty-print-more-attrs, r=co…
workingjubilee Mar 5, 2025
3065925
Rollup merge of #138026 - celinval:chores-item-has-body, r=compiler-e…
workingjubilee Mar 5, 2025
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
Prev Previous commit
Next Next commit
Simplify <Postorder as Iterator>::size_hint
The current version is wrong (cc 137919); let's see if we can get away with a loose but trivially-correct one.
  • Loading branch information
scottmcm committed Mar 3, 2025
commit e403654c8b49f7bf62e551c2dc5aaaca9ba71d76
17 changes: 6 additions & 11 deletions compiler/rustc_middle/src/mir/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ pub struct Postorder<'a, 'tcx> {
basic_blocks: &'a IndexSlice<BasicBlock, BasicBlockData<'tcx>>,
visited: DenseBitSet<BasicBlock>,
visit_stack: Vec<(BasicBlock, Successors<'a>)>,
root_is_start_block: bool,
/// A non-empty `extra` allows for a precise calculation of the successors.
extra: Option<(TyCtxt<'tcx>, Instance<'tcx>)>,
}
Expand All @@ -123,7 +122,6 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> {
basic_blocks,
visited: DenseBitSet::new_empty(basic_blocks.len()),
visit_stack: Vec::new(),
root_is_start_block: root == START_BLOCK,
extra,
};

Expand Down Expand Up @@ -211,16 +209,13 @@ impl<'tcx> Iterator for Postorder<'_, 'tcx> {
}

fn size_hint(&self) -> (usize, Option<usize>) {
// All the blocks, minus the number of blocks we've visited.
let upper = self.basic_blocks.len() - self.visited.count();

let lower = if self.root_is_start_block {
// We will visit all remaining blocks exactly once.
upper
} else {
self.visit_stack.len()
};
// These bounds are not at all tight, but that's fine.
// It's not worth a popcnt loop in `DenseBitSet` to improve the upper,
// and in mono-reachable we can't be precise anyway.
// Leaning on amortized growth is fine.

let lower = self.visit_stack.len();
let upper = self.basic_blocks.len();
(lower, Some(upper))
}
}
Expand Down