1
Fork 0

Fixup various places that were doing &T+'a and do &(T+'a)

This commit is contained in:
Niko Matsakis 2014-11-20 15:08:02 -05:00
parent 74a1041a4d
commit f4e29e7e9a
37 changed files with 56 additions and 56 deletions

View file

@ -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>],
}
@ -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) }
}
@ -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") }
}

View file

@ -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

View file

@ -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

View file

@ -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 }
}
}

View file

@ -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.
//

View file

@ -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> {
@ -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,
}

View file

@ -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)

View file

@ -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>() {

View file

@ -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) }
}
@ -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) }

View file

@ -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>,
}

View file

@ -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,
}

View file

@ -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
}

View file

@ -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> {

View file

@ -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

View file

@ -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

View file

@ -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
}
@ -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>;

View file

@ -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>>();

View file

@ -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>>();

View file

@ -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
}

View file

@ -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
}

View file

@ -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> {}

View file

@ -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 {

View file

@ -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() { }

View file

@ -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() { }

View file

@ -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
}

View file

@ -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,
}

View file

@ -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
}

View file

@ -10,7 +10,7 @@
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)
}
@ -18,7 +18,7 @@ pub mod two_tuple {
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 }
}

View file

@ -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]
@ -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]

View file

@ -11,7 +11,7 @@
use std::io::Reader;
enum Wrapper<'a> {
WrapReader(&'a Reader + 'a)
WrapReader(&'a (Reader + 'a))
}
trait Wrap<'a> {

View file

@ -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,)) {}
}

View file

@ -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 {

View file

@ -29,7 +29,7 @@ impl Inner for int {
}
struct Outer<'a> {
inner: &'a Inner+'a
inner: &'a (Inner+'a)
}
impl<'a> Outer<'a> {
@ -51,7 +51,7 @@ pub fn main() {
pub trait MyTrait<T> { }
pub struct MyContainer<'a, T> {
foos: Vec<&'a MyTrait<T>+'a> ,
foos: Vec<&'a (MyTrait<T>+'a)> ,
}
impl<'a, T> MyContainer<'a, T> {

View file

@ -13,7 +13,7 @@ struct B;
impl A for B {}
struct C<'a> {
foo: &'a mut A+'a,
foo: &'a mut (A+'a),
}
fn foo(a: &mut A) {

View file

@ -16,7 +16,7 @@ mod a {
pub trait X {}
impl X for int {}
pub struct Z<'a>(Enum<&'a X+'a>);
pub struct Z<'a>(Enum<&'a (X+'a)>);
fn foo() { let x = 42i; let z = Z(Enum::A(&x as &X)); let _ = z; }
}
@ -24,7 +24,7 @@ mod b {
trait X {}
impl X for int {}
struct Y<'a>{
x:Option<&'a X+'a>,
x:Option<&'a (X+'a)>,
}
fn bar() {
@ -36,7 +36,7 @@ mod b {
mod c {
pub trait X { fn f(&self); }
impl X for int { fn f(&self) {} }
pub struct Z<'a>(Option<&'a X+'a>);
pub struct Z<'a>(Option<&'a (X+'a)>);
fn main() { let x = 42i; let z = Z(Some(&x as &X)); let _ = z; }
}

View file

@ -19,7 +19,7 @@ mod foo {
pub trait D<'a, T> {}
}
fn foo1<T>(_: &A<T> + Send) {}
fn foo1<T>(_: &(A<T> + Send)) {}
fn foo2<T>(_: Box<A<T> + Send + Sync>) {}
fn foo3<T>(_: Box<B<int, uint> + 'static>) {}
fn foo4<'a, T>(_: Box<C<'a, T> + 'static + Send>) {}

View file

@ -30,7 +30,7 @@ fn object_invoke1<'d>(x: &'d Trait<'d>) -> (int, int) {
}
struct Struct1<'e> {
f: &'e Trait<'e>+'e
f: &'e (Trait<'e>+'e)
}
fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) {
@ -40,7 +40,7 @@ fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) {
}
struct Struct2<'h, 'i> {
f: &'h Trait<'i>+'h
f: &'h (Trait<'i>+'h)
}
fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> int {