Skip to content

Commit

Permalink
Replace Pin::new with .as_mut()
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jun 8, 2021
1 parent bddf151 commit ecc68e7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl BoxedResolver {
let mut generator = Box::pin(generator);

// Run it to the first yield to set it up
let init = match Pin::new(&mut generator).resume(Action::Initial) {
let init = match generator.as_mut().resume(Action::Initial) {
GeneratorState::Yielded(YieldType::Initial(y)) => y,
_ => panic!(),
};
Expand All @@ -162,7 +162,9 @@ impl BoxedResolver {
// Get the generator to call our closure
unsafe {
// Call the generator, which in turn will call the closure
if let GeneratorState::Complete(_) = Pin::new(&mut self.generator)
if let GeneratorState::Complete(_) = self
.generator
.as_mut()
.resume(Action::Access(AccessAction(::std::mem::transmute(mut_f))))
{
panic!()
Expand All @@ -175,7 +177,7 @@ impl BoxedResolver {

pub fn complete(mut self) -> ResolverOutputs {
// Tell the generator we want it to complete, consuming it and yielding a result
let result = Pin::new(&mut self.generator).resume(Action::Complete);
let result = self.generator.as_mut().resume(Action::Complete);
if let GeneratorState::Complete(r) = result { r } else { panic!() }
}

Expand Down

0 comments on commit ecc68e7

Please sign in to comment.