forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#113000 - Mark-Simulacrum:beta-backport, r=Mar…
…k-Simulacrum [beta] backport This PR backports: - rust-lang#112684: Disable alignment checks on i686-pc-windows-msvc - rust-lang#112581: [rustdoc] Fix URL encoding of % sign - rust-lang#112312: Update to LLVM 16.0.5 - rust-lang#112266: Fix type-inference regression in rust-lang#112225 - rust-lang#112062: Make struct layout not depend on unsizeable tail r? `@Mark-Simulacrum`
- Loading branch information
Showing
13 changed files
with
202 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule llvm-project
updated
69 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// check-pass | ||
// edition:2021 | ||
|
||
use core::future::Future; | ||
|
||
fn main() { | ||
do_async(async { (0,) }, { | ||
// closure must be inside block | ||
|info| println!("{:?}", info.0) | ||
}); | ||
} | ||
|
||
fn do_async<R, Fut, F>(_tokio_fut: Fut, _glib_closure: F) | ||
where | ||
Fut: Future<Output = R>, | ||
F: FnOnce(R), | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// edition:2021 | ||
|
||
// With the current compiler logic, we cannot have both the `112225-1` case, | ||
// and this `112225-2` case working, as the type inference depends on the evaluation | ||
// order, and there is some explicit ordering going on. | ||
// See the `check_closures` part in `FnCtxt::check_argument_types`. | ||
// The `112225-1` case was a regression in real world code, whereas the `112225-2` | ||
// case never used to work prior to 1.70. | ||
|
||
use core::future::Future; | ||
|
||
fn main() { | ||
let x = Default::default(); | ||
//~^ ERROR: type annotations needed | ||
do_async( | ||
async { x.0; }, | ||
{ || { let _: &(i32,) = &x; } }, | ||
); | ||
} | ||
fn do_async<Fut, T>(_fut: Fut, _val: T, ) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/issue-112225-2.rs:13:9 | ||
| | ||
LL | let x = Default::default(); | ||
| ^ | ||
... | ||
LL | async { x.0; }, | ||
| - type must be known at this point | ||
| | ||
help: consider giving `x` an explicit type | ||
| | ||
LL | let x: /* Type */ = Default::default(); | ||
| ++++++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// run-pass | ||
|
||
// Check that unsizing doesn't reorder fields. | ||
|
||
#![allow(dead_code)] | ||
|
||
use std::fmt::Debug; | ||
|
||
#[derive(Debug)] | ||
struct GcNode<T: ?Sized> { | ||
gets_swapped_with_next: usize, | ||
next: Option<&'static GcNode<dyn Debug>>, | ||
tail: T, | ||
} | ||
|
||
fn main() { | ||
let node: Box<GcNode<dyn Debug>> = Box::new(GcNode { | ||
gets_swapped_with_next: 42, | ||
next: None, | ||
tail: Box::new(1), | ||
}); | ||
|
||
assert_eq!(node.gets_swapped_with_next, 42); | ||
assert!(node.next.is_none()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// run-pass | ||
|
||
// Check that unsizing does not change which field is considered for niche layout. | ||
|
||
#![feature(offset_of)] | ||
#![allow(dead_code)] | ||
|
||
#[derive(Clone)] | ||
struct WideptrField<T: ?Sized> { | ||
first: usize, | ||
second: usize, | ||
niche: NicheAtEnd, | ||
tail: T, | ||
} | ||
|
||
#[derive(Clone)] | ||
#[repr(C)] | ||
struct NicheAtEnd { | ||
arr: [u8; 7], | ||
b: bool, | ||
} | ||
|
||
type Tail = [bool; 8]; | ||
|
||
fn main() { | ||
assert_eq!( | ||
core::mem::offset_of!(WideptrField<Tail>, niche), | ||
core::mem::offset_of!(WideptrField<dyn Send>, niche) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// run-pass | ||
// only-i686-pc-windows-msvc | ||
// compile-flags: -Copt-level=0 -Cdebug-assertions=yes | ||
|
||
// MSVC isn't sure if on 32-bit Windows its u64 type is 8-byte-aligned or 4-byte-aligned. | ||
// So this test ensures that on i686-pc-windows-msvc, we do not insert a runtime check | ||
// that will fail on dereferencing of a pointer to u64 which is not 8-byte-aligned but is | ||
// 4-byte-aligned. | ||
|
||
#![feature(strict_provenance)] | ||
|
||
fn main() { | ||
let mut x = [0u64; 2]; | ||
let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>(); | ||
unsafe { | ||
let misaligned = ptr.add(4).cast::<u64>(); | ||
assert!(misaligned.addr() % 8 != 0); | ||
assert!(misaligned.addr() % 4 == 0); | ||
*misaligned = 42; | ||
} | ||
} |