-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #61819 - Centril:rollup-k2gprnz, r=Centril
Rollup of 5 pull requests Successful merges: - #61704 (Pass LLVM linker flags to librustc_llvm build) - #61792 (Add ui test for issue 51301) - #61803 (typeck: small refactoring, add 'fn write_resolution') - #61805 (typeck: Fix ICE for blocks in repeat expr count.) - #61818 (Issue #60709 test) Failed merges: r? @ghost
- Loading branch information
Showing
10 changed files
with
144 additions
and
19 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
File renamed without changes.
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,28 @@ | ||
// This used to compile the future down to ud2, due to uninhabited types being | ||
// handled incorrectly in generators. | ||
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018 | ||
|
||
#![feature(async_await, await_macro)] | ||
#![allow(unused)] | ||
|
||
use std::future::Future; | ||
use std::task::Poll; | ||
use std::task::Context; | ||
use std::pin::Pin; | ||
use std::rc::Rc; | ||
|
||
struct Never(); | ||
impl Future for Never { | ||
type Output = (); | ||
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> { | ||
Poll::Pending | ||
} | ||
} | ||
|
||
fn main() { | ||
let fut = async { | ||
let _rc = Rc::new(()); // Also crashes with Arc | ||
await!(Never()); | ||
}; | ||
let _bla = fut; // Moving the future is required. | ||
} |
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,16 @@ | ||
#![feature(const_generics)] | ||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash | ||
|
||
fn f<T: Copy, const N: usize>(x: T) -> [T; N] { | ||
[x; {N}] | ||
} | ||
|
||
fn g<T, const N: usize>(x: T) -> [T; N] { | ||
[x; {N}] | ||
//~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied [E0277] | ||
} | ||
|
||
fn main() { | ||
let x: [u32; 5] = f::<u32, 5>(3); | ||
assert_eq!(x, [3u32; 5]); | ||
} |
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 @@ | ||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash | ||
--> $DIR/issue-61336-2.rs:1:12 | ||
| | ||
LL | #![feature(const_generics)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied | ||
--> $DIR/issue-61336-2.rs:9:5 | ||
| | ||
LL | [x; {N}] | ||
| ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | ||
| | ||
= help: consider adding a `where T: std::marker::Copy` bound | ||
= note: the `Copy` trait is required because the repeated element will be copied | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,35 @@ | ||
use std::any::TypeId; | ||
use std::collections::HashMap; | ||
use std::hash::Hash; | ||
|
||
trait State { | ||
type EventType; | ||
fn get_type_id_of_state(&self) -> TypeId; | ||
} | ||
|
||
struct StateMachine<EventType: Hash + Eq> { | ||
current_state: Box<dyn State<EventType = EventType>>, | ||
transition_table: | ||
HashMap<TypeId, HashMap<EventType, fn() -> Box<dyn State<EventType = EventType>>>>, | ||
} | ||
|
||
impl<EventType: Hash + Eq> StateMachine<EventType> { | ||
fn inner_process_event(&mut self, event: EventType) -> Result<(), i8> { | ||
let new_state_creation_function = self | ||
.transition_table | ||
.iter() | ||
.find(|(&event_typeid, _)| event_typeid == self.current_state.get_type_id_of_state()) | ||
.ok_or(1)? | ||
.1 | ||
.iter() | ||
.find(|(&event_type, _)| event == event_type) | ||
//~^ ERROR cannot move out of a shared reference | ||
.ok_or(2)? | ||
.1; | ||
|
||
self.current_state = new_state_creation_function(); | ||
Ok(()) | ||
} | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0507]: cannot move out of a shared reference | ||
--> $DIR/issue-51301.rs:25:20 | ||
| | ||
LL | .find(|(&event_type, _)| event == event_type) | ||
| ^^----------^^^^ | ||
| | | ||
| data moved here | ||
| move occurs because `event_type` has type `EventType`, which does not implement the `Copy` trait | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0507`. |