Auto merge of #53150 - kennytm:rollup, r=kennytm

Rollup of 10 pull requests

Successful merges:

 - #52885 (Remove some unused method arguments from typeck)
 - #52886 (cleanup: Remove `Def::GlobalAsm`)
 - #53028 (Building librustc_codegen_llvm in a separate directory)
 - #53052 (fixed broken links to char)
 - #53060 (Change rustdoc style so fully qualified name does not overlap src link)
 - #53068 (Rename Executor trait to Spawn)
 - #53093 (Enable macros to pass $:literal to another macro)
 - #53107 (Remove references to `StaticMutex` which got removed a while ago)
 - #53135 (Rust 2018: Disable catch_expr, not targeted for 2018 edition)
 - #53139 (set emit_debug_gdb_scripts: false for riscv32imac-unknown-none target)
This commit is contained in:
bors 2018-08-07 11:00:07 +00:00
commit 18925dee25
28 changed files with 141 additions and 212 deletions

View file

@ -22,7 +22,7 @@ use std::sync::{
use std::future::FutureObj;
use std::task::{
Context, Poll, Wake,
Executor, SpawnObjError,
Spawn, SpawnObjError,
local_waker_from_nonlocal,
};
@ -36,8 +36,8 @@ impl Wake for Counter {
}
}
struct NoopExecutor;
impl Executor for NoopExecutor {
struct NoopSpawner;
impl Spawn for NoopSpawner {
fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
Ok(())
}
@ -127,8 +127,8 @@ where
let mut fut = PinBox::new(f(9));
let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) });
let waker = local_waker_from_nonlocal(counter.clone());
let executor = &mut NoopExecutor;
let cx = &mut Context::new(&waker, executor);
let spawner = &mut NoopSpawner;
let cx = &mut Context::new(&waker, spawner);
assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst));
assert_eq!(Poll::Pending, fut.as_pin_mut().poll(cx));

View file

@ -23,7 +23,7 @@ use std::future::FutureObj;
use std::task::{
Context, Poll,
Wake, Waker, LocalWaker,
Executor, SpawnObjError,
Spawn, SpawnObjError,
local_waker, local_waker_from_nonlocal,
};
@ -42,9 +42,9 @@ impl Wake for Counter {
}
}
struct NoopExecutor;
struct NoopSpawner;
impl Executor for NoopExecutor {
impl Spawn for NoopSpawner {
fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
Ok(())
}
@ -59,7 +59,7 @@ impl Future for MyFuture {
cx.waker().wake();
cx.waker().wake();
cx.local_waker().wake();
cx.executor().spawn_obj(PinBox::new(MyFuture).into()).unwrap();
cx.spawner().spawn_obj(PinBox::new(MyFuture).into()).unwrap();
Poll::Ready(())
}
}
@ -70,8 +70,8 @@ fn test_local_waker() {
nonlocal_wakes: AtomicUsize::new(0),
});
let waker = unsafe { local_waker(counter.clone()) };
let executor = &mut NoopExecutor;
let cx = &mut Context::new(&waker, executor);
let spawner = &mut NoopSpawner;
let cx = &mut Context::new(&waker, spawner);
assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx));
assert_eq!(1, counter.local_wakes.load(atomic::Ordering::SeqCst));
assert_eq!(2, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst));
@ -83,8 +83,8 @@ fn test_local_as_nonlocal_waker() {
nonlocal_wakes: AtomicUsize::new(0),
});
let waker: LocalWaker = local_waker_from_nonlocal(counter.clone());
let executor = &mut NoopExecutor;
let cx = &mut Context::new(&waker, executor);
let spawner = &mut NoopSpawner;
let cx = &mut Context::new(&waker, spawner);
assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx));
assert_eq!(0, counter.local_wakes.load(atomic::Ordering::SeqCst));
assert_eq!(3, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst));

View file

@ -0,0 +1,24 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(macro_literal_matcher)]
macro_rules! a {
($i:literal) => { "right" };
($i:tt) => { "wrong" };
}
macro_rules! b {
($i:literal) => { a!($i) };
}
fn main() {
assert_eq!(b!(0), "right");
}