Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #62069

Merged
merged 11 commits into from
Jun 23, 2019
8 changes: 4 additions & 4 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2070,19 +2070,19 @@ macro_rules! tuple {
() => ();
( $($name:ident,)+ ) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($name:Debug),*> Debug for ($($name,)*) where last_type!($($name,)+): ?Sized {
impl<$($name:Debug),+> Debug for ($($name,)+) where last_type!($($name,)+): ?Sized {
#[allow(non_snake_case, unused_assignments)]
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
let mut builder = f.debug_tuple("");
let ($(ref $name,)*) = *self;
let ($(ref $name,)+) = *self;
$(
builder.field(&$name);
)*
)+

builder.finish()
}
}
peel! { $($name,)* }
peel! { $($name,)+ }
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,11 @@ mod impls {

( $($name:ident)+) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($name: Hash),*> Hash for ($($name,)*) where last_type!($($name,)+): ?Sized {
impl<$($name: Hash),+> Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
#[allow(non_snake_case)]
fn hash<S: Hasher>(&self, state: &mut S) {
let ($(ref $name,)*) = *self;
$($name.hash(state);)*
let ($(ref $name,)+) = *self;
$($name.hash(state);)+
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/iter/traits/accum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ macro_rules! integer_sum_product {
($($a:ty)*) => (
integer_sum_product!(@impls 0, 1,
#[stable(feature = "iter_arith_traits", since = "1.12.0")],
$($a)+);
$($a)*);
integer_sum_product!(@impls Wrapping(0), Wrapping(1),
#[stable(feature = "wrapping_iter_arith", since = "1.14.0")],
$(Wrapping<$a>)+);
$(Wrapping<$a>)*);
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro_rules! panic {
$crate::panic!($msg)
);
($fmt:expr, $($arg:tt)+) => ({
$crate::panicking::panic_fmt(format_args!($fmt, $($arg)*),
$crate::panicking::panic_fmt(format_args!($fmt, $($arg)+),
&(file!(), line!(), __rust_unstable_column!()))
});
}
Expand Down Expand Up @@ -558,7 +558,7 @@ macro_rules! unreachable {
#[stable(feature = "rust1", since = "1.0.0")]
macro_rules! unimplemented {
() => (panic!("not yet implemented"));
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)+)));
}

/// Indicates unfinished code.
Expand Down Expand Up @@ -617,7 +617,7 @@ macro_rules! unimplemented {
#[unstable(feature = "todo_macro", issue = "59277")]
macro_rules! todo {
() => (panic!("not yet implemented"));
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*)));
($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)+)));
}

/// Creates an array of [`MaybeUninit`].
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub trait Sized {
/// `Unsize` is implemented for:
///
/// - `[T; N]` is `Unsize<[T]>`
/// - `T` is `Unsize<Trait>` when `T: Trait`
/// - `T` is `Unsize<dyn Trait>` when `T: Trait`
/// - `Foo<..., T, ...>` is `Unsize<Foo<..., U, ...>>` if:
/// - `T: Unsize<U>`
/// - Foo is a struct
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2725,12 +2725,12 @@ macro_rules! fnptr_impls_safety_abi {

macro_rules! fnptr_impls_args {
($($Arg: ident),+) => {
fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { extern "C" fn($($Arg),* , ...) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),* , ...) -> Ret, $($Arg),* }
fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
fnptr_impls_safety_abi! { extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
fnptr_impls_safety_abi! { extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ }
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+) -> Ret, $($Arg),+ }
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ }
};
() => {
// No variadic functions with 0 parameters
Expand Down
6 changes: 3 additions & 3 deletions src/libproc_macro/bridge/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ macro_rules! rpc_encode_decode {
}
};
(enum $name:ident $(<$($T:ident),+>)? { $($variant:ident $(($field:ident))*),* $(,)? }) => {
impl<S, $($($T: Encode<S>),+)?> Encode<S> for $name $(<$($T),+>)* {
impl<S, $($($T: Encode<S>),+)?> Encode<S> for $name $(<$($T),+>)? {
fn encode(self, w: &mut Writer, s: &mut S) {
// HACK(eddyb): `Tag` enum duplicated between the
// two impls as there's no other place to stash it.
Expand All @@ -79,8 +79,8 @@ macro_rules! rpc_encode_decode {
}
}

impl<S, $($($T: for<'s> DecodeMut<'a, 's, S>),+)*> DecodeMut<'a, '_, S>
for $name $(<$($T),+>)*
impl<S, $($($T: for<'s> DecodeMut<'a, 's, S>),+)?> DecodeMut<'a, '_, S>
for $name $(<$($T),+>)?
{
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
// HACK(eddyb): `Tag` enum duplicated between the
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/itemlikevisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub trait ItemLikeVisitor<'hir> {
fn visit_impl_item(&mut self, impl_item: &'hir ImplItem);
}

pub struct DeepVisitor<'v, V: 'v> {
pub struct DeepVisitor<'v, V> {
visitor: &'v mut V,
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
/// [blog post]: https://is.gd/0hKvIr
struct TypeGeneralizer<'me, 'tcx, D>
where
D: TypeRelatingDelegate<'tcx> + 'me,
D: TypeRelatingDelegate<'tcx>,
{
infcx: &'me InferCtxt<'me, 'tcx>,

Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

#![feature(arbitrary_self_types)]
#![feature(box_patterns)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/weak_lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'tcx> TyCtxt<'tcx> {
let lang_items = self.lang_items();
let did = Some(item_def_id);

$(lang_items.$name() == did)||+
$(lang_items.$name() == did)||*
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub struct CommonConsts<'tcx> {
pub err: &'tcx Const<'tcx>,
}

pub struct LocalTableInContext<'a, V: 'a> {
pub struct LocalTableInContext<'a, V> {
local_id_root: Option<DefId>,
data: &'a ItemLocalMap<V>
}
Expand Down Expand Up @@ -294,7 +294,7 @@ impl<'a, V> ::std::ops::Index<hir::HirId> for LocalTableInContext<'a, V> {
}
}

pub struct LocalTableInContextMut<'a, V: 'a> {
pub struct LocalTableInContextMut<'a, V> {
local_id_root: Option<DefId>,
data: &'a mut ItemLocalMap<V>
}
Expand Down Expand Up @@ -2171,7 +2171,7 @@ impl<'tcx> TyCtxt<'tcx> {


/// An entry in an interner.
struct Interned<'tcx, T: 'tcx+?Sized>(&'tcx T);
struct Interned<'tcx, T: ?Sized>(&'tcx T);

impl<'tcx, T: 'tcx+?Sized> Clone for Interned<'tcx, T> {
fn clone(&self) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ macro_rules! profq_query_msg {

/// A type representing the responsibility to execute the job in the `job` field.
/// This will poison the relevant query if dropped.
pub(super) struct JobOwner<'a, 'tcx, Q: QueryDescription<'tcx> + 'a> {
pub(super) struct JobOwner<'a, 'tcx, Q: QueryDescription<'tcx>> {
cache: &'a Lock<QueryCache<'tcx, Q>>,
key: Q::Key,
job: Lrc<QueryJob<'tcx>>,
Expand Down Expand Up @@ -230,7 +230,7 @@ pub struct CycleError<'tcx> {
}

/// The result of `try_get_lock`
pub(super) enum TryGetJob<'a, 'tcx, D: QueryDescription<'tcx> + 'a> {
pub(super) enum TryGetJob<'a, 'tcx, D: QueryDescription<'tcx>> {
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
NotYetStarted(JobOwner<'a, 'tcx, D>),

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ macro_rules! builder_methods_for_value_instructions {
unsafe {
llvm::$llvm_capi(self.llbuilder, $($arg,)* UNNAMED)
}
})*
})+
}
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

use back::write::{create_target_machine, create_informational_target_machine};
use syntax_pos::symbol::Symbol;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

#![recursion_limit="256"]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/indexed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ macro_rules! newtype_index {
(@derives [$($derives:ident,)*]
@attrs [$(#[$attrs:meta])*]
@type [$type:ident]
@max [$_max:expr]
@max [$max:expr]
@vis [$v:vis]
@debug_format [$debug_format:tt]
$(#[doc = $doc:expr])*
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fn get_type_suggestion(t: Ty<'_>, val: u128, negative: bool) -> Option<String> {
return Some(format!("{:?}", $itypes))
})*
None
},)*
},)+
_ => None
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl<'a, 'tcx, BD> MirWithFlowState<'tcx> for DataflowBuilder<'a, 'tcx, BD>
fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state }
}

struct Graph<'a, 'tcx, MWF:'a, P> where
struct Graph<'a, 'tcx, MWF, P> where
MWF: MirWithFlowState<'tcx>
{
mbcx: &'a MWF,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ where

struct PropagationContext<'b, 'a, 'tcx, O>
where
O: 'b + BitDenotation<'tcx>,
O: BitDenotation<'tcx>,
{
builder: &'b mut DataflowAnalysis<'a, 'tcx, O>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::{
};
use crate::const_eval::{CompileTimeInterpreter, CompileTimeEvalContext};

struct InternVisitor<'rt, 'mir: 'rt, 'tcx: 'rt + 'mir> {
struct InternVisitor<'rt, 'mir, 'tcx> {
/// previously encountered safe references
ref_tracking: &'rt mut RefTracking<(MPlaceTy<'tcx>, Mutability, InternMode)>,
ecx: &'rt mut CompileTimeEvalContext<'mir, 'tcx>,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

#[macro_use] extern crate log;
#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/util/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub trait DropElaborator<'a, 'tcx>: fmt::Debug {
#[derive(Debug)]
struct DropCtxt<'l, 'b, 'tcx, D>
where
D: DropElaborator<'b, 'tcx> + 'l,
D: DropElaborator<'b, 'tcx>,
{
elaborator: &'l mut D,

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ macro_rules! flavor_mappings {
($((($($flavor:tt)*), $string:expr),)*) => (
impl LinkerFlavor {
pub const fn one_of() -> &'static str {
concat!("one of: ", $($string, " ",)+)
concat!("one of: ", $($string, " ",)*)
}

pub fn from_str(s: &str) -> Option<Self> {
Some(match s {
$($string => $($flavor)*,)+
$($string => $($flavor)*,)*
_ => return None,
})
}

pub fn desc(&self) -> &str {
match *self {
$($($flavor)* => $string,)+
$($($flavor)* => $string,)*
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ This API is completely unstable and subject to change.
#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]
#![allow(explicit_outlives_requirements)]

#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
Expand Down
18 changes: 9 additions & 9 deletions src/libserialize/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,33 +739,33 @@ macro_rules! count {
macro_rules! tuple {
() => ();
( $($name:ident,)+ ) => (
impl<$($name:Decodable),*> Decodable for ($($name,)*) {
impl<$($name:Decodable),+> Decodable for ($($name,)+) {
#[allow(non_snake_case)]
fn decode<D: Decoder>(d: &mut D) -> Result<($($name,)*), D::Error> {
let len: usize = count!($($name)*);
fn decode<D: Decoder>(d: &mut D) -> Result<($($name,)+), D::Error> {
let len: usize = count!($($name)+);
d.read_tuple(len, |d| {
let mut i = 0;
let ret = ($(d.read_tuple_arg({ i+=1; i-1 }, |d| -> Result<$name, D::Error> {
Decodable::decode(d)
})?,)*);
})?,)+);
Ok(ret)
})
}
}
impl<$($name:Encodable),*> Encodable for ($($name,)*) {
impl<$($name:Encodable),+> Encodable for ($($name,)+) {
#[allow(non_snake_case)]
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
let ($(ref $name,)*) = *self;
let ($(ref $name,)+) = *self;
let mut n = 0;
$(let $name = $name; n += 1;)*
$(let $name = $name; n += 1;)+
s.emit_tuple(n, |s| {
let mut i = 0;
$(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s))?;)*
$(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s))?;)+
Ok(())
})
}
}
peel! { $($name,)* }
peel! { $($name,)+ }
)
}

Expand Down
Loading