Skip to content

Commit

Permalink
Bless tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 5, 2021
1 parent 7dcd42d commit cf0a7cf
Show file tree
Hide file tree
Showing 56 changed files with 864 additions and 1,015 deletions.
11 changes: 10 additions & 1 deletion src/test/ui/const-generics/issues/issue-56445-1.min.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>

error: aborting due to previous error
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/issue-56445-1.rs:9:25
|
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#![feature(adt_const_params)]`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0771`.
1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-56445-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ use std::marker::PhantomData;

struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
//~^ ERROR: use of non-static lifetime `'a` in const generic
//[min]~| ERROR: `&'static str` is forbidden as the type of a const generic parameter

impl Bug<'_, ""> {}
2 changes: 0 additions & 2 deletions src/test/ui/error-codes/E0261.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ LL | struct Foo {
| - help: consider introducing lifetime `'a` here: `<'a>`
LL | x: &'a str,
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error: aborting due to 2 previous errors

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0263.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ error[E0263]: lifetime name `'a` declared twice in the same scope
--> $DIR/E0263.rs:1:16
|
LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
| -- ^^ declared twice
| -- ^^ lifetime `'a` already in scope
| |
| previous declaration here
| first declared here

error: aborting due to previous error

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/error-codes/E0637.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
| ------- ------- ^^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `str1` or `str2`
help: consider introducing a named lifetime parameter
help: consider using the `'_` lifetime
|
LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str {
| +++ ~~ ~~ ~~
LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
| ~~

error: aborting due to 3 previous errors

Expand Down
16 changes: 8 additions & 8 deletions src/test/ui/error-codes/E0771.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/E0771.rs:4:41
|
LL | fn function_with_str<'a, const STRING: &'a str>() {}
| ^^
|
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>

warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/E0771.rs:1:12
|
Expand All @@ -7,14 +15,6 @@ LL | #![feature(adt_const_params)]
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/E0771.rs:4:41
|
LL | fn function_with_str<'a, const STRING: &'a str>() {}
| ^^
|
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0771`.
170 changes: 86 additions & 84 deletions src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -1,87 +1,3 @@
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:50:14
|
LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:50:25
|
LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:53:31
|
LL | fn my_lifetime(&self) -> &'a u8 { self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | impl<'a> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'a` here
|
LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:55:27
|
LL | fn any_lifetime() -> &'b u8 { &0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn any_lifetime<'b>() -> &'b u8 { &0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:57:27
|
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:57:40
|
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
| ++++

error[E0261]: use of undeclared lifetime name `'x`
--> $DIR/feature-gate-in_band_lifetimes.rs:3:12
|
Expand Down Expand Up @@ -109,6 +25,8 @@ LL | impl<'a> X<'b> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'b` here: `'b,`
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:17:27
Expand Down Expand Up @@ -226,6 +144,90 @@ help: consider introducing lifetime `'b` here
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8;
| ++++

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:50:14
|
LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:50:25
|
LL | impl MyTrait<'a> for Y<&'a u8> {
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/feature-gate-in_band_lifetimes.rs:53:31
|
LL | fn my_lifetime(&self) -> &'a u8 { self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | impl<'a> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'a` here
|
LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:55:27
|
LL | fn any_lifetime() -> &'b u8 { &0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn any_lifetime<'b>() -> &'b u8 { &0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:57:27
|
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
| ++++

error[E0261]: use of undeclared lifetime name `'b`
--> $DIR/feature-gate-in_band_lifetimes.rs:57:40
|
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'b` here
|
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
| ++++
help: consider introducing lifetime `'b` here
|
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
| ++++

error: aborting due to 17 previous errors

For more information about this error, try `rustc --explain E0261`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ error[E0261]: use of undeclared lifetime name `'x`
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:35
|
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'x` here: `<'x>`
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'x` here
|
LL | fn _f<'x>(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
| ++++
help: consider making the bound lifetime-generic with a new `'x` lifetime
|
LL | fn _f(arg : Box<dyn for<'x, 'a> X<Y<'x> = &'a [u32]>>) {}
| +++

error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0261]: use of undeclared lifetime name `'b`
LL | + Deref<Target = Self::Item<'b>>;
| ^^ undeclared lifetime
|
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider introducing lifetime `'b` here
|
LL | trait Iterable<'b> {
Expand All @@ -13,6 +13,10 @@ help: consider introducing lifetime `'b` here
|
LL | type Iter<'b, 'a>: Iterator<Item = Self::Item<'a>>
| +++
help: consider making the bound lifetime-generic with a new `'b` lifetime
|
LL | + for<'b> Deref<Target = Self::Item<'b>>;
| +++++++

error[E0261]: use of undeclared lifetime name `'undeclared`
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:41
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/generic-associated-types/issue-67510.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ trait X {
type Y<'a>;
}

fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
//~^ ERROR: use of undeclared lifetime name `'a`
//~| ERROR: use of undeclared lifetime name `'a`

fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
//~^ ERROR: use of undeclared lifetime name `'a`
//~| ERROR: use of undeclared lifetime name `'a`
//~| ERROR: the trait `X` cannot be made into an object [E0038]

fn main() {}
52 changes: 41 additions & 11 deletions src/test/ui/generic-associated-types/issue-67510.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,53 @@
error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/issue-67510.rs:7:21
|
LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
| ++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
| +++++++

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/issue-67510.rs:7:26
--> $DIR/issue-67510.rs:7:28
|
LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
| - ^^ undeclared lifetime
| |
| help: consider introducing lifetime `'a` here: `<'a>`
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
help: consider introducing lifetime `'a` here
|
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
| ++++
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
| +++++++

error[E0038]: the trait `X` cannot be made into an object
--> $DIR/issue-67510.rs:7:13
|
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-67510.rs:4:10
|
LL | trait X {
| - this trait cannot be made into an object...
LL | type Y<'a>;
| ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait

error: aborting due to 2 previous errors
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0261`.
Some errors have detailed explanations: E0038, E0261.
For more information about an error, try `rustc --explain E0038`.
Loading

0 comments on commit cf0a7cf

Please sign in to comment.