Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! Regression test for https://github.com/rust-lang/rust/issues/113870

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

const fn allow<'b, 'b>() -> usize
//~^ ERROR the name `'b` is already used for a generic parameter in this item's generic parameters
where
for<'b> [u8; foo::<'a, 'b>()]: Sized,
//~^ ERROR lifetime name `'b` shadows a lifetime name that is already in scope
//~| ERROR use of undeclared lifetime name `'a`
//~| ERROR cannot capture late-bound lifetime in constant
{
4
}

const fn foo<'a, 'b>() -> usize
where
&'a (): Sized,
&'b (): Sized,
{
4
}
//~^ ERROR `main` function not found in crate
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
error[E0403]: the name `'b` is already used for a generic parameter in this item's generic parameters
--> $DIR/escaping-late-bound-region-in-canonical-ice-113870.rs:6:20
|
LL | const fn allow<'b, 'b>() -> usize
| -- ^^ already used
| |
| first use of `'b`

error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope
--> $DIR/escaping-late-bound-region-in-canonical-ice-113870.rs:9:9
|
LL | const fn allow<'b, 'b>() -> usize
| -- first declared here
...
LL | for<'b> [u8; foo::<'a, 'b>()]: Sized,
| ^^ lifetime `'b` already in scope

error[E0261]: use of undeclared lifetime name `'a`
--> $DIR/escaping-late-bound-region-in-canonical-ice-113870.rs:9:24
|
LL | for<'b> [u8; foo::<'a, 'b>()]: Sized,
| ^^ undeclared lifetime
|
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'a` lifetime
|
LL | for<'a, 'b> [u8; foo::<'a, 'b>()]: Sized,
| +++
help: consider introducing lifetime `'a` here
|
LL | const fn allow<'a, 'b, 'b>() -> usize
| +++

error[E0601]: `main` function not found in crate `escaping_late_bound_region_in_canonical_ice_113870`
--> $DIR/escaping-late-bound-region-in-canonical-ice-113870.rs:23:2
|
LL | }
| ^ consider adding a `main` function to `$DIR/escaping-late-bound-region-in-canonical-ice-113870.rs`

error: cannot capture late-bound lifetime in constant
--> $DIR/escaping-late-bound-region-in-canonical-ice-113870.rs:9:28
|
LL | const fn allow<'b, 'b>() -> usize
| -- lifetime defined here
...
LL | for<'b> [u8; foo::<'a, 'b>()]: Sized,
| ^^

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0261, E0403, E0496, E0601.
For more information about an error, try `rustc --explain E0261`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! Regression test for https://github.com/rust-lang/rust/issues/118278
//@ check-pass

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

pub trait Foo {
const SIZE: usize;
}

impl Foo for u64 {
const SIZE: usize = 8;
}

pub struct Wrapper<T>
where
T: Foo,
[(); T::SIZE]:,
{
pub t: T,
}

pub fn bar() -> Wrapper<impl Foo> {
Wrapper { t: 10 }
}

fn main() {}
12 changes: 12 additions & 0 deletions tests/ui/typeck/index-out-of-bounds-on-partial-cmp-ice-114056.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Regression test for https://github.com/rust-lang/rust/issues/114056

struct P<Q>(Q);

impl<Q> P<Q> {
fn foo(&self) {
self.partial_cmp(())
//~^ ERROR the method `partial_cmp` exists for reference `&P<Q>`, but its trait bounds were not satisfied
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
error[E0599]: the method `partial_cmp` exists for reference `&P<Q>`, but its trait bounds were not satisfied
--> $DIR/index-out-of-bounds-on-partial-cmp-ice-114056.rs:7:14
|
LL | struct P<Q>(Q);
| ----------- doesn't satisfy `P<Q>: Iterator` or `P<Q>: PartialOrd<_>`
...
LL | self.partial_cmp(())
| ^^^^^^^^^^^ method cannot be called on `&P<Q>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`P<Q>: PartialOrd<_>`
which is required by `&P<Q>: PartialOrd<&_>`
`&P<Q>: Iterator`
which is required by `&mut &P<Q>: Iterator`
`P<Q>: Iterator`
which is required by `&mut P<Q>: Iterator`
note: the trait `Iterator` must be implemented
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider annotating `P<Q>` with `#[derive(PartialEq, PartialOrd)]`
|
LL + #[derive(PartialEq, PartialOrd)]
LL | struct P<Q>(Q);
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0599`.
Loading