-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 6 pull requests #92542
Rollup of 6 pull requests #92542
Conversation
…a 4-byte buffer minimum. Include suggestions from @agausmann and @Mark-Simulacrum.
The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR rust-lang#84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
No functional changes intended. The LLVM commit llvm/llvm-project@ec501f1 removed the signed version of `createExpression`. This adapts the Rust LLVM wrappers accordingly.
gsgdt 0.1.3 was yanked: rust-lang#92254 (comment)
…dio-windows, r=Mark-Simulacrum Modifications to `std::io::Stdin` on Windows so that there is no longer a 4-byte buffer minimum in read(). This is an attempted fix of issue rust-lang#91722, where a too-small buffer was passed to the read function of stdio on Windows. This caused an error to be returned when `read_to_end` or `read_to_string` were called. Both delegate to `std::io::default_read_to_end`, which creates a buffer that is of length >0, and forwards it to `std::io::Stdin::read()`. The latter method returns an error if the length of the buffer is less than 4, as there might not be enough space to allocate a UTF-16 character. This creates a problem when the buffer length is in `0 < N < 4`, causing the bug. The current modification creates an internal buffer, much like the one used for the write functions I'd also like to acknowledge the help of `@agausmann` and `@hkratz` in detecting and isolating the bug, and for suggestions that made the fix possible. Couple disclaimers: - Firstly, I didn't know where to put code to replicate the bug found in the issue. It would probably be wise to add that case to the testing suite, but I'm afraid that I don't know _where_ that test should be added. - Secondly, the code is fairly fundamental to IO operations, so my fears are that this may cause some undesired side effects ~or performance loss in benchmarks.~ The testing suite runs on my computer, and it does fix the issue noted in rust-lang#91722. - Thirdly, I left the "surrogate" field in the Stdin struct, but from a cursory glance, it seems to be serving the same purpose for other functions. Perhaps merging the two would be appropriate. Finally, this is my first pull request to the rust language, and as such some things may be weird/unidiomatic/plain out bad. If there are any obvious improvements I could do to the code, or any other suggestions, I would appreciate them. Edit: Closes rust-lang#91722
Constify `Box<T, A>` methods Tracking issue: none yet Most of the methods bounded on `~const`. `intrinsics::const_eval_select` is used for handling an allocation error. <details><summary>Constified API</summary> ```rust impl<T, A: Allocator> Box<T, A> { pub const fn new_in(x: T, alloc: A) -> Self where A: ~const Allocator + ~const Drop; pub const fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError> where T: ~const Drop, A: ~const Allocator + ~const Drop; pub const fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> where A: ~const Allocator + ~const Drop; pub const fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError> where A: ~const Allocator + ~const Drop; pub const fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> where A: ~const Allocator + ~const Drop; pub const fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError> where A: ~const Allocator + ~const Drop; pub const fn pin_in(x: T, alloc: A) -> Pin<Self> where A: 'static, A: 'static + ~const Allocator + ~const Drop, pub const fn into_boxed_slice(boxed: Self) -> Box<[T], A>; pub const fn into_inner(boxed: Self) -> T where Self: ~const Drop, } impl<T, A: Allocator> Box<MaybeUninit<T>, A> { pub const unsafe fn assume_init(self) -> Box<T, A>; pub const fn write(mut boxed: Self, value: T) -> Box<T, A>; pub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self; pub const fn into_raw_with_allocator(b: Self) -> (*mut T, A); pub const fn into_unique(b: Self) -> (Unique<T>, A); pub const fn allocator(b: &Self) -> &A; pub const fn leak<'a>(b: Self) -> &'a mut T where A: 'a; pub const fn into_pin(boxed: Self) -> Pin<Self> where A: 'static; } unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> const Drop for Box<T, A>; impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>> where A: 'static; impl<T: ?Sized, A: Allocator> const Deref for Box<T, A>; impl<T: ?Sized, A: Allocator> const DerefMut for Box<T, A>; impl<T: ?Sized, A: Allocator> const Unpin for Box<T, A> where A: 'static; ``` </details> <details><summary>Example</summary> ```rust pub struct ConstAllocator; unsafe impl const Allocator for ConstAllocator { fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { unsafe { let ptr = core::intrinsics::const_allocate(layout.size(), layout.align()); Ok(NonNull::new_unchecked(ptr as *mut [u8; 0] as *mut [u8])) } } unsafe fn deallocate(&self, _ptr: NonNull<u8>, _layout: Layout) { /* do nothing */ } fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { self.allocate(layout) } unsafe fn grow( &self, _ptr: NonNull<u8>, _old_layout: Layout, _new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError> { unimplemented!() } unsafe fn grow_zeroed( &self, _ptr: NonNull<u8>, _old_layout: Layout, _new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError> { unimplemented!() } unsafe fn shrink( &self, _ptr: NonNull<u8>, _old_layout: Layout, _new_layout: Layout, ) -> Result<NonNull<[u8]>, AllocError> { unimplemented!() } fn by_ref(&self) -> &Self where Self: Sized, { self } } #[test] fn const_box() { const VALUE: u32 = { let mut boxed = Box::new_in(1u32, ConstAllocator); assert!(*boxed == 1); *boxed = 42; assert!(*boxed == 42); *boxed }; assert!(VALUE == 42); } ``` </details>
Actually set IMAGE_SCN_LNK_REMOVE for .rmeta The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR rust-lang#84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
…agisa RustWrapper: adapt for an LLVM API change No functional changes intended. The LLVM commit llvm/llvm-project@ec501f1 removed the signed version of `createExpression`. This adapts the Rust LLVM wrappers accordingly.
Explicitly pass `PATH` to the Windows exe resolver This allows for testing different `PATH`s without using the actual environment.
…acrum revert rust-lang#92254 "Bump gsgdt to 0.1.3" This reverts rust-lang#92254 since gsgdt 0.1.3 was yanked: rust-lang#92254 (comment)
@bors r+ rollup=never p=6 |
📌 Commit 8221ff5 has been approved by |
⌛ Testing commit 8221ff5 with merge a85ca6261381acf3ccee970ea31614aac8db3754... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
⌛ Testing commit 8221ff5 with merge b33e5dc90acef7a8de247c9d49fdabe4cff0416a... |
💥 Test timed out |
@bors retry |
⌛ Testing commit 8221ff5 with merge dd565424cd71145208f744e54cf85ecc428519d6... |
💥 Test timed out |
:/ new rollup #92556 |
Successful merges:
std::io::Stdin
on Windows so that there is no longer a 4-byte buffer minimum in read(). #91754 (Modifications tostd::io::Stdin
on Windows so that there is no longer a 4-byte buffer minimum in read().)Box<T, A>
methods #91884 (ConstifyBox<T, A>
methods)PATH
to the Windows exe resolver #92517 (Explicitly passPATH
to the Windows exe resolver)gsgdt
to 0.1.3 #92254 "Bump gsgdt to 0.1.3")Failed merges:
r? @ghost
@rustbot modify labels: rollup
Create a similar rollup