Skip to content

Commit 97c5d59

Browse files
committed
fixup failing test, bless error changes
1 parent a962b26 commit 97c5d59

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

library/alloc/src/raw_vec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<T, A: Allocator> RawVec<T, A> {
294294
/// be careful.
295295
#[inline]
296296
pub const fn ptr(&self) -> *mut T {
297-
self.inner.as_ptr()
297+
self.inner.ptr()
298298
}
299299

300300
#[inline]
@@ -501,8 +501,8 @@ impl<A: Allocator> RawVecInner<A> {
501501
}
502502

503503
#[inline]
504-
fn ptr<T>(&self) -> *mut T {
505-
self.non_null::<T>().as_ptr()
504+
const fn ptr<T>(&self) -> *mut T {
505+
self.ptr.as_ptr() as _
506506
}
507507

508508
#[inline]
@@ -511,7 +511,7 @@ impl<A: Allocator> RawVecInner<A> {
511511
}
512512

513513
#[inline]
514-
fn capacity(&self, elem_size: usize) -> usize {
514+
const fn capacity(&self, elem_size: usize) -> usize {
515515
if elem_size == 0 { usize::MAX } else { self.cap.0 }
516516
}
517517

tests/ui/consts/issue-94675.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ known-bug: #103507
22

3-
#![feature(const_trait_impl, const_mut_refs)]
3+
#![feature(const_trait_impl, const_mut_refs, const_vec_string_slice)]
44

55
struct Foo<'a> {
66
bar: &'a mut Vec<usize>,

tests/ui/consts/issue-94675.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0015]: cannot call non-const fn `Vec::<u32>::len` in constant functions
2-
--> $DIR/issue-94675.rs:11:27
3-
|
4-
LL | self.bar[0] = baz.len();
5-
| ^^^^^
6-
|
7-
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8-
91
error[E0015]: cannot call non-const operator in constant functions
102
--> $DIR/issue-94675.rs:11:17
113
|
@@ -20,6 +12,6 @@ help: add `#![feature(effects)]` to the crate attributes to enable
2012
LL + #![feature(effects)]
2113
|
2214

23-
error: aborting due to 2 previous errors
15+
error: aborting due to 1 previous error
2416

2517
For more information about this error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)