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#115901 - Mark-Simulacrum:beta-backport, r=Mar…
…k-Simulacrum [beta] backport This PR backports: - rust-lang#115785: Only suggest turbofish in patterns if we may recover - rust-lang#115527: Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are generic, if `T` requires `Drop` - rust-lang#115389: fix(resolve): update def if binding is warning ambiguity - rust-lang#115215: Remove assert that checks type equality r? `@Mark-Simulacrum`
- Loading branch information
Showing
9 changed files
with
122 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// ignore-pass | ||
// build-pass | ||
// edition:2021 | ||
use std::future::Future; | ||
use std::pin::Pin; | ||
|
||
type BoxFuture<T> = Pin<Box<dyn Future<Output = T>>>; | ||
|
||
fn main() { | ||
let _ = wrapper_call(handler); | ||
} | ||
|
||
async fn wrapper_call(handler: impl Handler) { | ||
handler.call().await; | ||
} | ||
async fn handler() { | ||
f(&()).await; | ||
} | ||
async fn f<'a>(db: impl Acquire<'a>) { | ||
db.acquire().await; | ||
} | ||
|
||
trait Handler { | ||
type Future: Future; | ||
fn call(self) -> Self::Future; | ||
} | ||
|
||
impl<Fut, F> Handler for F | ||
where | ||
F: Fn() -> Fut, | ||
Fut: Future, | ||
{ | ||
type Future = Fut; | ||
fn call(self) -> Self::Future { | ||
loop {} | ||
} | ||
} | ||
|
||
trait Acquire<'a> { | ||
type Connection; | ||
fn acquire(self) -> BoxFuture<Self::Connection>; | ||
} | ||
impl<'a> Acquire<'a> for &'a () { | ||
type Connection = Self; | ||
fn acquire(self) -> BoxFuture<Self> { | ||
loop {} | ||
} | ||
} |
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 @@ | ||
WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858 |
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 @@ | ||
// build-pass | ||
|
||
pub const fn f<T, const N: usize>(_: [std::mem::MaybeUninit<T>; N]) {} | ||
|
||
pub struct Blubb<T>(*const T); | ||
|
||
pub const fn g<T, const N: usize>(_: [Blubb<T>; N]) {} | ||
|
||
pub struct Blorb<const N: usize>([String; N]); | ||
|
||
pub const fn h(_: Blorb<0>) {} | ||
|
||
pub struct Wrap(Blorb<0>); | ||
|
||
pub const fn i(_: Wrap) {} | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// check-pass | ||
// build-pass | ||
// aux-build: ../ambiguous-4-extern.rs | ||
|
||
extern crate ambiguous_4_extern; | ||
|
21 changes: 21 additions & 0 deletions
21
tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs
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 @@ | ||
// Regression test for issue #115780. | ||
// Ensure that we don't emit a parse error for the token sequence `Ident "<" Ty` in pattern position | ||
// if we are inside a macro call since it can be valid input for a subsequent macro rule. | ||
// See also #103534. | ||
|
||
// check-pass | ||
|
||
macro_rules! mdo { | ||
($p: pat =<< $e: expr ; $( $t: tt )*) => { | ||
$e.and_then(|$p| mdo! { $( $t )* }) | ||
}; | ||
(ret<$ty: ty> $e: expr;) => { Some::<$ty>($e) }; | ||
} | ||
|
||
fn main() { | ||
mdo! { | ||
x_val =<< Some(0); | ||
y_val =<< Some(1); | ||
ret<(i32, i32)> (x_val, y_val); | ||
}; | ||
} |