Skip to content

Commit

Permalink
Fixup various places that were doing &T+'a and do &(T+'a)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Nov 26, 2014
1 parent 74a1041 commit f4e29e7
Show file tree
Hide file tree
Showing 37 changed files with 56 additions and 56 deletions.
6 changes: 3 additions & 3 deletions src/libcore/fmt/mod.rs
Expand Up @@ -85,7 +85,7 @@ pub struct Formatter<'a> {
width: Option<uint>,
precision: Option<uint>,

buf: &'a mut FormatWriter+'a,
buf: &'a mut (FormatWriter+'a),
curarg: slice::Items<'a, Argument<'a>>,
args: &'a [Argument<'a>],
}
Expand Down Expand Up @@ -565,7 +565,7 @@ impl<'a, Sized? T: Show> Show for &'a T {
impl<'a, Sized? T: Show> Show for &'a mut T {
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) }
}
impl<'a> Show for &'a Show+'a {
impl<'a> Show for &'a (Show+'a) {
fn fmt(&self, f: &mut Formatter) -> Result { (*self).fmt(f) }
}

Expand Down Expand Up @@ -724,7 +724,7 @@ macro_rules! tuple (

tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }

impl<'a> Show for &'a any::Any+'a {
impl<'a> Show for &'a (any::Any+'a) {
fn fmt(&self, f: &mut Formatter) -> Result { f.pad("&Any") }
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/expr_use_visitor.rs
Expand Up @@ -295,7 +295,7 @@ impl OverloadedCallType {
pub struct ExprUseVisitor<'d,'t,'tcx,TYPER:'t> {
typer: &'t TYPER,
mc: mc::MemCategorizationContext<'t,TYPER>,
delegate: &'d mut Delegate<'tcx>+'d,
delegate: &'d mut (Delegate<'tcx>+'d),
}

// If the TYPER results in an error, it's because the type check
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/select.rs
Expand Up @@ -43,7 +43,7 @@ use util::ppaux::Repr;
pub struct SelectionContext<'cx, 'tcx:'cx> {
infcx: &'cx InferCtxt<'cx, 'tcx>,
param_env: &'cx ty::ParameterEnvironment<'tcx>,
typer: &'cx Typer<'tcx>+'cx,
typer: &'cx (Typer<'tcx>+'cx),

/// Skolemizer used specifically for skolemizing entries on the
/// obligation stack. This ensures that all entries on the stack
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/rscope.rs
Expand Up @@ -139,11 +139,11 @@ impl RegionScope for BindingRscope {
/// A scope which simply shifts the Debruijn index of other scopes
/// to account for binding levels.
pub struct ShiftedRscope<'r> {
base_scope: &'r RegionScope+'r
base_scope: &'r (RegionScope+'r)
}

impl<'r> ShiftedRscope<'r> {
pub fn new(base_scope: &'r RegionScope+'r) -> ShiftedRscope<'r> {
pub fn new(base_scope: &'r (RegionScope+'r)) -> ShiftedRscope<'r> {
ShiftedRscope { base_scope: base_scope }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustrt/unwind.rs
Expand Up @@ -86,7 +86,7 @@ struct Exception {
cause: Option<Box<Any + Send>>,
}

pub type Callback = fn(msg: &Any + Send, file: &'static str, line: uint);
pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: uint);

// Variables used for invoking callbacks when a task starts to unwind.
//
Expand Down
4 changes: 2 additions & 2 deletions src/libserialize/json.rs
Expand Up @@ -398,7 +398,7 @@ fn fmt_number_or_null(v: f64) -> string::String {

/// A structure for implementing serialization to JSON.
pub struct Encoder<'a> {
writer: &'a mut io::Writer+'a,
writer: &'a mut (io::Writer+'a),
}

impl<'a> Encoder<'a> {
Expand Down Expand Up @@ -602,7 +602,7 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
/// Another encoder for JSON, but prints out human-readable JSON instead of
/// compact data
pub struct PrettyEncoder<'a> {
writer: &'a mut io::Writer+'a,
writer: &'a mut (io::Writer+'a),
curr_indent: uint,
indent: uint,
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/comm/select.rs
Expand Up @@ -84,7 +84,7 @@ pub struct Handle<'rx, T:'rx> {
next: *mut Handle<'static, ()>,
prev: *mut Handle<'static, ()>,
added: bool,
packet: &'rx Packet+'rx,
packet: &'rx (Packet+'rx),

// due to our fun transmutes, we be sure to place this at the end. (nothing
// previous relies on T)
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/failure.rs
Expand Up @@ -40,7 +40,7 @@ impl Writer for Stdio {
}
}

pub fn on_fail(obj: &Any + Send, file: &'static str, line: uint) {
pub fn on_fail(obj: &(Any+Send), file: &'static str, line: uint) {
let msg = match obj.downcast_ref::<&'static str>() {
Some(s) => *s,
None => match obj.downcast_ref::<String>() {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/io/mod.rs
Expand Up @@ -911,7 +911,7 @@ impl<'a> Reader for Box<Reader+'a> {
}
}

impl<'a> Reader for &'a mut Reader+'a {
impl<'a> Reader for &'a mut (Reader+'a) {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { (*self).read(buf) }
}

Expand Down Expand Up @@ -1279,7 +1279,7 @@ impl<'a> Writer for Box<Writer+'a> {
}
}

impl<'a> Writer for &'a mut Writer+'a {
impl<'a> Writer for &'a mut (Writer+'a) {
#[inline]
fn write(&mut self, buf: &[u8]) -> IoResult<()> { (**self).write(buf) }

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/backtrace.rs
Expand Up @@ -288,7 +288,7 @@ mod imp {

struct Context<'a> {
idx: int,
writer: &'a mut Writer+'a,
writer: &'a mut (Writer+'a),
last_error: Option<IoError>,
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Expand Up @@ -61,7 +61,7 @@ pub struct State<'a> {
literals: Option<Vec<comments::Literal> >,
cur_cmnt_and_lit: CurrentCommentAndLiteral,
boxes: Vec<pp::Breaks>,
ann: &'a PpAnn+'a,
ann: &'a (PpAnn+'a),
encode_idents_with_hygiene: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/dst-index.rs
Expand Up @@ -25,7 +25,7 @@ impl Index<uint, str> for S {
struct T;

impl Index<uint, Show + 'static> for T {
fn index<'a>(&'a self, idx: &uint) -> &'a Show + 'static {
fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) {
static x: uint = 42;
&x
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-12470.rs
Expand Up @@ -24,7 +24,7 @@ impl X for B {
}

struct A<'a> {
p: &'a X+'a
p: &'a (X+'a)
}

fn make_a<'a>(p: &'a X) -> A<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-14285.rs
Expand Up @@ -14,7 +14,7 @@ struct A;

impl Foo for A {}

struct B<'a>(&'a Foo+'a);
struct B<'a>(&'a (Foo+'a));

fn foo<'a>(a: &Foo) -> B<'a> {
B(a) //~ ERROR cannot infer an appropriate lifetime
Expand Down
6 changes: 3 additions & 3 deletions src/test/compile-fail/kindck-copy.rs
Expand Up @@ -44,15 +44,15 @@ fn test<'a,T,U:Copy>(_: &'a int) {

// borrowed object types are generally ok
assert_copy::<&'a Dummy>();
assert_copy::<&'a Dummy+Copy>();
assert_copy::<&'static Dummy+Copy>();
assert_copy::<&'a (Dummy+Copy)>();
assert_copy::<&'static (Dummy+Copy)>();

// owned object types are not ok
assert_copy::<Box<Dummy>>(); //~ ERROR `core::kinds::Copy` is not implemented
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `core::kinds::Copy` is not implemented

// mutable object types are not ok
assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR `core::kinds::Copy` is not implemented
assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `core::kinds::Copy` is not implemented

// closures are like an `&mut` object
assert_copy::<||>(); //~ ERROR `core::kinds::Copy` is not implemented
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/kindck-send-object.rs
Expand Up @@ -19,7 +19,7 @@ trait Message : Send { }
// careful with object types, who knows what they close over...

fn object_ref_with_static_bound_not_ok() {
assert_send::<&'static Dummy+'static>();
assert_send::<&'static (Dummy+'static)>();
//~^ ERROR the trait `core::kinds::Send` is not implemented
}

Expand All @@ -36,7 +36,7 @@ fn closure_with_no_bound_not_ok<'a>() {
}

fn object_with_send_bound_ok() {
assert_send::<&'static Dummy+Send>();
assert_send::<&'static (Dummy+Send)>();
assert_send::<Box<Dummy+Send>>();
assert_send::<proc():Send>;
assert_send::<||:Send>;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/kindck-send-object1.rs
Expand Up @@ -21,13 +21,13 @@ fn test51<'a>() {
//~^ ERROR the trait `core::kinds::Send` is not implemented
}
fn test52<'a>() {
assert_send::<&'a Dummy+Send>();
assert_send::<&'a (Dummy+Send)>();
//~^ ERROR does not fulfill the required lifetime
}

// ...unless they are properly bounded
fn test60() {
assert_send::<&'static Dummy+Send>();
assert_send::<&'static (Dummy+Send)>();
}
fn test61() {
assert_send::<Box<Dummy+Send>>();
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/kindck-send-object2.rs
Expand Up @@ -23,7 +23,7 @@ fn test53() {

// ...unless they are properly bounded
fn test60() {
assert_send::<&'static Dummy+Send>();
assert_send::<&'static (Dummy+Send)>();
}
fn test61() {
assert_send::<Box<Dummy+Send>>();
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/region-object-lifetime-1.rs
Expand Up @@ -28,14 +28,14 @@ fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {

// Borrowed receiver with two distinct lifetimes, but we know that
// 'b:'a, hence &'a () is permitted.
fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a Foo+'b) -> &'a () {
fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () {
x.borrowed()
}

// Here we have two distinct lifetimes, but we try to return a pointer
// with the longer lifetime when (from the signature) we only know
// that it lives as long as the shorter lifetime. Therefore, error.
fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a Foo+'b) -> &'b () {
fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
x.borrowed() //~ ERROR cannot infer
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/regions-bounded-by-send.rs
Expand Up @@ -57,12 +57,12 @@ fn box_with_region_not_ok<'a>() {
// objects with insufficient bounds no ok

fn object_with_random_bound_not_ok<'a>() {
assert_send::<&'a Dummy+'a>();
assert_send::<&'a (Dummy+'a)>();
//~^ ERROR not implemented
}

fn object_with_send_bound_not_ok<'a>() {
assert_send::<&'a Dummy+Send>();
assert_send::<&'a (Dummy+Send)>();
//~^ ERROR does not fulfill
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/regions-close-object-into-object.rs
Expand Up @@ -10,7 +10,7 @@


trait A<T> {}
struct B<'a, T>(&'a A<T>+'a);
struct B<'a, T>(&'a (A<T>+'a));

trait X {}
impl<'a, T> X for B<'a, T> {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/regions-trait-variance.rs
Expand Up @@ -31,7 +31,7 @@ impl Drop for B {
}

struct A<'r> {
p: &'r X+'r
p: &'r (X+'r)
}

fn make_a(p:&X) -> A {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/trait-bounds-not-on-impl.rs
Expand Up @@ -13,7 +13,7 @@ trait Foo {

struct Bar;

impl Foo + Owned for Bar { //~ ERROR bounded traits are only valid in type position
impl Foo + Owned for Bar { //~ ERROR not a trait
}

fn main() { }
2 changes: 1 addition & 1 deletion src/test/compile-fail/trait-bounds-not-on-struct.rs
Expand Up @@ -11,6 +11,6 @@

struct Foo;

fn foo(_x: Box<Foo + Send>) { } //~ ERROR kind bounds can only be used on trait types
fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected a reference to a trait

fn main() { }
4 changes: 2 additions & 2 deletions src/test/compile-fail/trait-bounds-sugar.rs
Expand Up @@ -16,14 +16,14 @@ trait Foo {}
fn a(_x: Box<Foo+Send>) {
}

fn b(_x: &'static Foo+'static) {
fn b(_x: &'static (Foo+'static)) {
}

fn c(x: Box<Foo+Sync>) {
a(x); //~ ERROR mismatched types
}

fn d(x: &'static Foo+Sync) {
fn d(x: &'static (Foo+Sync)) {
b(x); //~ ERROR cannot infer
//~^ ERROR mismatched types
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/colorful-write-macros.rs
Expand Up @@ -18,7 +18,7 @@ use std::fmt;
use std::fmt::FormatWriter;

struct Foo<'a> {
writer: &'a mut Writer+'a,
writer: &'a mut (Writer+'a),
other: &'a str,
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/dst-index.rs
Expand Up @@ -25,7 +25,7 @@ impl Index<uint, str> for S {
struct T;

impl Index<uint, Show + 'static> for T {
fn index<'a>(&'a self, idx: &uint) -> &'a Show + 'static {
fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) {
static x: uint = 42;
&x
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issue-10902.rs
Expand Up @@ -10,15 +10,15 @@

pub mod two_tuple {
pub trait T {}
pub struct P<'a>(&'a T + 'a, &'a T + 'a);
pub struct P<'a>(&'a (T + 'a), &'a (T + 'a));
pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> {
P(car, cdr)
}
}

pub mod two_fields {
pub trait T {}
pub struct P<'a> { car: &'a T + 'a, cdr: &'a T + 'a }
pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) }
pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> {
P{ car: car, cdr: cdr }
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issue-11205.rs
Expand Up @@ -49,7 +49,7 @@ fn main() {
foog(x, &[box 1i]);

struct T<'a> {
t: [&'a Foo+'a, ..2]
t: [&'a (Foo+'a), ..2]
}
let _n = T {
t: [&1i, &2i]
Expand All @@ -64,7 +64,7 @@ fn main() {
};

struct F<'b> {
t: &'b [&'b Foo+'b]
t: &'b [&'b (Foo+'b)]
}
let _n = F {
t: &[&1i, &2i]
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-14901.rs
Expand Up @@ -11,7 +11,7 @@
use std::io::Reader;

enum Wrapper<'a> {
WrapReader(&'a Reader + 'a)
WrapReader(&'a (Reader + 'a))
}

trait Wrap<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-14958.rs
Expand Up @@ -14,7 +14,7 @@ trait Foo {}

struct Bar;

impl<'a> std::ops::Fn<(&'a Foo+'a,), ()> for Bar {
impl<'a> std::ops::Fn<(&'a (Foo+'a),), ()> for Bar {
extern "rust-call" fn call(&self, _: (&'a Foo,)) {}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issue-14959.rs
Expand Up @@ -33,8 +33,8 @@ impl Alloy {
}
}

impl<'a, 'b> Fn<(&'b mut Response+'b,),()> for SendFile<'a> {
extern "rust-call" fn call(&self, (_res,): (&'b mut Response+'b,)) {}
impl<'a, 'b> Fn<(&'b mut (Response+'b),),()> for SendFile<'a> {
extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {}
}

impl<Rq: Request, Rs: Response> Ingot<Rq, Rs> for HelloWorld {
Expand Down

0 comments on commit f4e29e7

Please sign in to comment.