Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #110778

Merged
merged 37 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
41e3cc4
Add some tests around (lack of) object safety of associated types and…
oli-obk Apr 20, 2023
704a9da
Ignore src/bootstrap formatting commit in .git-blame-ignore-revs
jyn514 Apr 20, 2023
fa35156
pointer-auth-link-with-c: Fix cross compilation.
pcc Apr 22, 2023
adb5ded
add known-bug test for unsound issue 25860
whtahy Apr 18, 2023
2fb2098
add known-bug test for unsound issue 49206
whtahy Apr 18, 2023
232d685
add known-bug test for unsound issue 57893
whtahy Apr 19, 2023
fbfb620
add known-bug test for unsound issue 84366
whtahy Apr 19, 2023
cac62ab
add known-bug test for unsound issue 84533
whtahy Apr 19, 2023
be68c69
add known-bug test for unsound issue 84591
whtahy Apr 19, 2023
3c5de9a
add known-bug test for unsound issue 85099
whtahy Apr 20, 2023
3338ee3
drop unused deps, gate libc under unix for one crate
klensy Apr 22, 2023
0e68cbd
Remove useless special case.
cjgillot Apr 15, 2023
629cdb4
Move eval_discriminant.
cjgillot Apr 15, 2023
dd452ae
Simplify logic.
cjgillot Apr 15, 2023
dd78b99
Reduce rightward drift.
cjgillot Apr 15, 2023
3141262
add known-bug test for unsound issue 98117
whtahy Apr 22, 2023
cff6c0e
add known-bug test for unsound issue 100041
whtahy Apr 22, 2023
6f6550f
add known-bug test for unsound issue 100051
whtahy Apr 22, 2023
ebe61ce
add known-bug test for unsound issue 104005
whtahy Apr 22, 2023
f5e535c
bootstrap: update paths cargo-credential crate
weihanglo Apr 23, 2023
31531ce
Add size asserts for MIR `SourceScopeData` & `VarDebugInfo`
scottmcm Apr 24, 2023
5c70287
Add regression test for #60522
GuillaumeGomez Apr 24, 2023
e496fbe
Split `{Idx, IndexVec, IndexSlice}` into their own modules
WaffleLapkin Apr 19, 2023
99ebfe2
move index code around
WaffleLapkin Apr 19, 2023
7d23b52
`const`-ify some `{IndexVec, IndexSlice}` methods
WaffleLapkin Apr 19, 2023
5d809b1
Decorative changes to `IndexVec`
WaffleLapkin Apr 19, 2023
c0daff0
Fix `rustc_index` imports outside the compiler
WaffleLapkin Apr 19, 2023
42467d5
Rollup merge of #110480 - whtahy:105107/known-bug-tests-for-unsound-i…
JohnTitor Apr 24, 2023
cefb479
Rollup merge of #110539 - WaffleLapkin:split_index_vec&slice, r=cjgillot
JohnTitor Apr 24, 2023
1a906f2
Rollup merge of #110590 - oli-obk:object_safe_assoc_types, r=jackh726
JohnTitor Apr 24, 2023
e0bb7bb
Rollup merge of #110602 - jyn514:ignore-fmt, r=Mark-Simulacrum
JohnTitor Apr 24, 2023
2a2df56
Rollup merge of #110667 - pcc:fix-pointer-auth-link-with-c, r=Mark-Si…
JohnTitor Apr 24, 2023
a373623
Rollup merge of #110681 - klensy:cut-dep, r=lcnr
JohnTitor Apr 24, 2023
4d3ab3d
Rollup merge of #110685 - cjgillot:clean-dcp, r=oli-obk
JohnTitor Apr 24, 2023
b708aad
Rollup merge of #110744 - weihanglo:cargo-credential-install, r=ehuss
JohnTitor Apr 24, 2023
16fdef7
Rollup merge of #110750 - scottmcm:vardebug-size, r=cjgillot
JohnTitor Apr 24, 2023
513c0cc
Rollup merge of #110760 - GuillaumeGomez:regression-60522, r=notriddle
JohnTitor Apr 24, 2023
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
const-ify some {IndexVec, IndexSlice} methods
  • Loading branch information
WaffleLapkin committed Apr 24, 2023
commit 7d23b5237623f5d1db9840838bbf5abfe3a14e29
18 changes: 9 additions & 9 deletions compiler/rustc_index/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ pub struct IndexSlice<I: Idx, T> {

impl<I: Idx, T> IndexSlice<I, T> {
#[inline]
pub fn empty() -> &'static Self {
Default::default()
pub const fn empty() -> &'static Self {
Self::from_raw(&[])
}

#[inline]
pub fn from_raw(raw: &[T]) -> &Self {
pub const fn from_raw(raw: &[T]) -> &Self {
let ptr: *const [T] = raw;
// SAFETY: `IndexSlice` is `repr(transparent)` over a normal slice
unsafe { &*(ptr as *const Self) }
Expand All @@ -42,10 +42,15 @@ impl<I: Idx, T> IndexSlice<I, T> {
}

#[inline]
pub fn len(&self) -> usize {
pub const fn len(&self) -> usize {
self.raw.len()
}

#[inline]
pub const fn is_empty(&self) -> bool {
self.raw.is_empty()
}

/// Gives the next index that will be assigned when `push` is called.
///
/// Manual bounds checks can be done using `idx < slice.next_index()`
Expand All @@ -55,11 +60,6 @@ impl<I: Idx, T> IndexSlice<I, T> {
I::new(self.len())
}

#[inline]
pub fn is_empty(&self) -> bool {
self.raw.is_empty()
}

#[inline]
pub fn iter(&self) -> slice::Iter<'_, T> {
self.raw.iter()
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ pub struct IndexVec<I: Idx, T> {

impl<I: Idx, T> IndexVec<I, T> {
#[inline]
pub fn new() -> Self {
pub const fn new() -> Self {
IndexVec { raw: Vec::new(), _marker: PhantomData }
}

#[inline]
pub fn from_raw(raw: Vec<T>) -> Self {
pub const fn from_raw(raw: Vec<T>) -> Self {
IndexVec { raw, _marker: PhantomData }
}

Expand Down