Skip to content

Commit

Permalink
Rollup merge of rust-lang#63487 - sd234678:remove-meaningless-comment…
Browse files Browse the repository at this point in the history
…s-in-src/test-2, r=Centril

Remove meaningless comments in src/test

Moved from rust-lang#63411
  • Loading branch information
Centril authored Aug 15, 2019
2 parents aa3f542 + 5f50c4a commit bb62270
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 142 deletions.
2 changes: 0 additions & 2 deletions src/test/pretty/stmt_expr_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ fn _12() {
}
}

/////////////////

fn foo() { }
fn foo3(_: i32, _: (), _: ()) { }
fn qux(_: i32) { }
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,22 @@ pub trait Car : Vehicle {
fn chip_paint(&self, c: Self::Color) { }
}

///////////////////////////////////////////////////////////////////////////

struct Black;
struct ModelT;
impl Vehicle for ModelT { type Color = Black; }
impl Car for ModelT { }

///////////////////////////////////////////////////////////////////////////

struct Blue;
struct ModelU;
impl Vehicle for ModelU { type Color = Blue; }
impl Car for ModelU { }

///////////////////////////////////////////////////////////////////////////

fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
fn a() { dent(ModelT, Black); }
fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types
fn c() { dent(ModelU, Black); } //~ ERROR mismatched types
fn d() { dent(ModelU, Blue); }

///////////////////////////////////////////////////////////////////////////

fn e() { ModelT.chip_paint(Black); }
fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types
fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:33:23
--> $DIR/associated-type-projection-from-supertrait.rs:27:23
|
LL | fn b() { dent(ModelT, Blue); }
| ^^^^ expected struct `Black`, found struct `Blue`
Expand All @@ -8,7 +8,7 @@ LL | fn b() { dent(ModelT, Blue); }
found type `Blue`

error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:34:23
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
|
LL | fn c() { dent(ModelU, Black); }
| ^^^^^ expected struct `Blue`, found struct `Black`
Expand All @@ -17,7 +17,7 @@ LL | fn c() { dent(ModelU, Black); }
found type `Black`

error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:40:28
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
|
LL | fn f() { ModelT.chip_paint(Blue); }
| ^^^^ expected struct `Black`, found struct `Blue`
Expand All @@ -26,7 +26,7 @@ LL | fn f() { ModelT.chip_paint(Blue); }
found type `Blue`

error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:41:28
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
|
LL | fn g() { ModelU.chip_paint(Black); }
| ^^^^^ expected struct `Blue`, found struct `Black`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ pub trait Car : Vehicle {
fn honk(&self) { }
}

///////////////////////////////////////////////////////////////////////////

struct Black;
struct ModelT;
impl Vehicle for ModelT { type Color = Black; }
impl Car for ModelT { }

///////////////////////////////////////////////////////////////////////////

struct Blue;
struct ModelU;
impl Vehicle for ModelU { type Color = Blue; }
impl Car for ModelU { }

///////////////////////////////////////////////////////////////////////////

fn black_car<C:Car<Color=Black>>(c: C) {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:37:10
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:31:10
|
LL | fn b() { blue_car(ModelT); }
| ^^^^^^^^ expected struct `Black`, found struct `Blue`
|
= note: expected type `Black`
found type `Blue`
note: required by `blue_car`
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:33:1
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:27:1
|
LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:38:10
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10
|
LL | fn c() { black_car(ModelU); }
| ^^^^^^^^^ expected struct `Blue`, found struct `Black`
|
= note: expected type `Blue`
found type `Black`
note: required by `black_car`
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:30:1
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:24:1
|
LL | fn black_car<C:Car<Color=Black>>(c: C) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ trait Test {
fn test(&self, value: &Self::V) -> bool;
}

///////////////////////////////////////////////////////////////////////////

struct TesterPair<T:Test> {
tester: T,
value: T::V,
Expand All @@ -26,8 +24,6 @@ impl<T:Test> TesterPair<T> {
}
}

///////////////////////////////////////////////////////////////////////////

struct EqU32(u32);
impl Test for EqU32 {
type V = u32;
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/higher-rank-trait-bounds/hrtb-type-outlives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ fn want_foo<T>()
{
}

///////////////////////////////////////////////////////////////////////////
// Expressed as a where clause

struct SomeStruct<X> {
Expand All @@ -30,7 +29,6 @@ fn one() {
want_foo::<SomeStruct<usize>>();
}

///////////////////////////////////////////////////////////////////////////
// Expressed as shorthand

struct AnotherStruct<X> {
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/hrtb/hrtb-conflate-regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ fn want_foo1<T>()
{
}

///////////////////////////////////////////////////////////////////////////
// Expressed as a where clause

struct SomeStruct;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hrtb/hrtb-conflate-regions.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied
--> $DIR/hrtb-conflate-regions.rs:28:10
--> $DIR/hrtb-conflate-regions.rs:27:10
|
LL | fn b() { want_foo2::<SomeStruct>(); }
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct`
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/impl-trait/bound-normalization-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

// See issue 60414

/////////////////////////////////////////////
// Reduction to `impl Trait`

struct Foo<T>(T);
Expand All @@ -33,7 +32,6 @@ mod impl_trait {
}
}

/////////////////////////////////////////////
// Same with lifetimes in the trait

mod lifetimes {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/impl-trait/bound-normalization-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | #![feature(impl_trait_in_bindings)]
= note: `#[warn(incomplete_features)]` on by default

error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as impl_trait::Trait>::Assoc`
--> $DIR/bound-normalization-fail.rs:30:32
--> $DIR/bound-normalization-fail.rs:29:32
|
LL | fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type
Expand All @@ -17,13 +17,13 @@ LL | fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> {
= note: the return type of a function must have a statically known size

error: `impl Trait` return type cannot contain a projection or `Self` that references lifetimes from a parent scope
--> $DIR/bound-normalization-fail.rs:47:41
--> $DIR/bound-normalization-fail.rs:45:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc`
--> $DIR/bound-normalization-fail.rs:47:41
--> $DIR/bound-normalization-fail.rs:45:41
|
LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type
Expand Down
4 changes: 0 additions & 4 deletions src/test/ui/impl-trait/bound-normalization-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

// See issue 60414

/////////////////////////////////////////////
// Reduction to `impl Trait`

struct Foo<T>(T);
Expand All @@ -32,7 +31,6 @@ mod impl_trait {
}
}

/////////////////////////////////////////////
// Same with lifetimes in the trait

mod lifetimes {
Expand All @@ -59,7 +57,6 @@ mod lifetimes {
}
}

/////////////////////////////////////////////
// Reduction using `impl Trait` in bindings

mod impl_trait_in_bindings {
Expand All @@ -80,7 +77,6 @@ mod impl_trait_in_bindings {
}
}

/////////////////////////////////////////////
// The same applied to `type Foo = impl Bar`s

mod opaque_types {
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/issues/issue-12028.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ trait StreamHasher {
fn stream(&self) -> Self::S;
}

//////////////////////////////////////////////////////////////////////////////

trait StreamHash<H: StreamHasher>: Hash<H> {
fn input_stream(&self, stream: &mut H::S);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-12028.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0284]: type annotations required: cannot resolve `<_ as StreamHasher>::S == <H as StreamHasher>::S`
--> $DIR/issue-12028.rs:29:14
--> $DIR/issue-12028.rs:27:14
|
LL | self.input_stream(&mut stream);
| ^^^^^^^^^^^^
Expand Down
4 changes: 0 additions & 4 deletions src/test/ui/issues/issue-16739.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ impl FnOnce<()> for Foo {
extern "rust-call" fn call_once(mut self, _: ()) -> u32 { self.call_mut(()) }
}

/////////////////////////////////////////////////////////////////////////

impl FnMut<(u32,)> for Foo {
extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x }
}
Expand All @@ -27,8 +25,6 @@ impl FnOnce<(u32,)> for Foo {
extern "rust-call" fn call_once(mut self, args: (u32,)) -> u32 { self.call_mut(args) }
}

/////////////////////////////////////////////////////////////////////////

impl FnMut<(u32,u32)> for Foo {
extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y }
}
Expand Down
9 changes: 0 additions & 9 deletions src/test/ui/methods/method-projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Test that we can use method notation to call methods based on a
// projection bound from a trait. Issue #20469.

///////////////////////////////////////////////////////////////////////////


trait MakeString {
fn make_string(&self) -> String;
}
Expand All @@ -21,8 +18,6 @@ impl MakeString for usize {
}
}

///////////////////////////////////////////////////////////////////////////

trait Foo {
type F: MakeString;

Expand All @@ -33,8 +28,6 @@ fn foo<F:Foo>(f: &F) -> String {
f.get().make_string()
}

///////////////////////////////////////////////////////////////////////////

struct SomeStruct {
field: isize,
}
Expand All @@ -47,8 +40,6 @@ impl Foo for SomeStruct {
}
}

///////////////////////////////////////////////////////////////////////////

struct SomeOtherStruct {
field: usize,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
error[E0491]: in type `&'a WithHrAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container-hrtb.rs:35:12
--> $DIR/regions-outlives-projection-container-hrtb.rs:30:12
|
LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 32:15
--> $DIR/regions-outlives-projection-container-hrtb.rs:32:15
note: the pointer is valid for the lifetime 'a as defined on the function body at 27:15
--> $DIR/regions-outlives-projection-container-hrtb.rs:27:15
|
LL | fn with_assoc<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 32:18
--> $DIR/regions-outlives-projection-container-hrtb.rs:32:18
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 27:18
--> $DIR/regions-outlives-projection-container-hrtb.rs:27:18
|
LL | fn with_assoc<'a,'b>() {
| ^^

error[E0491]: in type `&'a WithHrAssocSub<TheType<'b>>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-projection-container-hrtb.rs:57:12
--> $DIR/regions-outlives-projection-container-hrtb.rs:50:12
|
LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime 'a as defined on the function body at 53:19
--> $DIR/regions-outlives-projection-container-hrtb.rs:53:19
note: the pointer is valid for the lifetime 'a as defined on the function body at 46:19
--> $DIR/regions-outlives-projection-container-hrtb.rs:46:19
|
LL | fn with_assoc_sub<'a,'b>() {
| ^^
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 53:22
--> $DIR/regions-outlives-projection-container-hrtb.rs:53:22
note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 46:22
--> $DIR/regions-outlives-projection-container-hrtb.rs:46:22
|
LL | fn with_assoc_sub<'a,'b>() {
| ^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/regions-outlives-projection-container-hrtb.rs:35:12
--> $DIR/regions-outlives-projection-container-hrtb.rs:30:12
|
LL | fn with_assoc<'a,'b>() {
| -- -- lifetime `'b` defined here
Expand All @@ -10,7 +10,7 @@ LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a`

error: lifetime may not live long enough
--> $DIR/regions-outlives-projection-container-hrtb.rs:57:12
--> $DIR/regions-outlives-projection-container-hrtb.rs:50:12
|
LL | fn with_assoc_sub<'a,'b>() {
| -- -- lifetime `'b` defined here
Expand Down
Loading

0 comments on commit bb62270

Please sign in to comment.