forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#74574 - Mark-Simulacrum:stable-next, r=Mark-S…
…imulacrum [stable] 1.45.1 release See RELEASES.md for details on what this contains.
- Loading branch information
Showing
17 changed files
with
196 additions
and
74 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
This file was deleted.
Oops, something went wrong.
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
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,12 @@ | ||
enum E { | ||
A(u8, u8), | ||
} | ||
|
||
fn main() { | ||
let e = E::A(2, 3); | ||
match e { | ||
E::A(x @ ..) => { //~ ERROR `x @` is not allowed in a tuple | ||
x //~ ERROR cannot find value `x` in this scope | ||
} | ||
}; | ||
} |
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 @@ | ||
error[E0425]: cannot find value `x` in this scope | ||
--> $DIR/issue-74539.rs:9:13 | ||
| | ||
LL | x | ||
| ^ help: a local variable with a similar name exists: `e` | ||
|
||
error: `x @` is not allowed in a tuple struct | ||
--> $DIR/issue-74539.rs:8:14 | ||
| | ||
LL | E::A(x @ ..) => { | ||
| ^^^^^^ this is only allowed in slice patterns | ||
| | ||
= help: remove this and bind each tuple field independently | ||
help: if you don't need to use the contents of x, discard the tuple's remaining fields | ||
| | ||
LL | E::A(..) => { | ||
| ^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0425`. |
66 changes: 66 additions & 0 deletions
66
src/test/ui/regions/type-param-outlives-reempty-issue-74429-2.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,66 @@ | ||
// Regression test for #74429, where we didn't think that a type parameter | ||
// outlived `ReEmpty`. | ||
|
||
// check-pass | ||
|
||
use std::marker::PhantomData; | ||
use std::ptr::NonNull; | ||
|
||
pub unsafe trait RawData { | ||
type Elem; | ||
} | ||
|
||
unsafe impl<A> RawData for OwnedRepr<A> { | ||
type Elem = A; | ||
} | ||
|
||
unsafe impl<'a, A> RawData for ViewRepr<&'a A> { | ||
type Elem = A; | ||
} | ||
|
||
pub struct OwnedRepr<A> { | ||
ptr: PhantomData<A>, | ||
} | ||
|
||
// these Copy impls are not necessary for the repro, but allow the code to compile without error | ||
// on 1.44.1 | ||
#[derive(Copy, Clone)] | ||
pub struct ViewRepr<A> { | ||
life: PhantomData<A>, | ||
} | ||
|
||
#[derive(Copy, Clone)] | ||
pub struct ArrayBase<S> | ||
where | ||
S: RawData, | ||
{ | ||
ptr: NonNull<S::Elem>, | ||
} | ||
|
||
pub type Array<A> = ArrayBase<OwnedRepr<A>>; | ||
|
||
pub type ArrayView<'a, A> = ArrayBase<ViewRepr<&'a A>>; | ||
|
||
impl<A, S> ArrayBase<S> | ||
where | ||
S: RawData<Elem = A>, | ||
{ | ||
pub fn index_axis(&self) -> ArrayView<'_, A> { | ||
unimplemented!() | ||
} | ||
|
||
pub fn axis_iter<'a>(&'a self) -> std::iter::Empty<&'a A> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
pub fn x<T: Copy>(a: Array<T>) { | ||
// drop just avoids a must_use warning | ||
drop((0..1).filter(|_| true)); | ||
let y = a.index_axis(); | ||
a.axis_iter().for_each(|_| { | ||
drop(y); | ||
}); | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.