Skip to content

Commit e4b9a03

Browse files
authored
Rollup merge of #158060 - zedddie:gsoc-batch-10-meow, r=Kivooeo
Reorganize `tests/ui/issues` [10/N] Part of [GSoC'26 project](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Project.3A.20Reorganizing.20tests.2Fui.2Fissues) r? Kivooeo @Teapot4195
2 parents 5dc302c + ed1dd88 commit e4b9a03

19 files changed

Lines changed: 79 additions & 50 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/23354>.
2+
//! Check expr in [expr; N] is always being evaluated.
3+
//!
4+
//! This used to trigger an LLVM assertion during compilation
5+
//@ run-fail
6+
//@ error-pattern:panic evaluated
7+
//@ needs-subprocess
8+
9+
#[allow(unused_variables)]
10+
fn main() {
11+
let x = [panic!("panic evaluated"); 2];
12+
}

tests/ui/issues/issue-23354.rs renamed to tests/ui/array-slice-vec/eval-empty-array-expr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/23354>.
2+
//! Check expr in [expr; N] is always being evaluated.
13
//@ run-fail
24
//@ error-pattern:panic evaluated
35
//@ needs-subprocess
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/22886>.
2+
//! Test that associated type's inner state cannot be observed past
3+
//! borrow end via saved reference.
4+
//!
5+
//! This was possible as trait implementation with unconstrained lifetime
6+
//! allowed to use any lifetime for associated type, which introduced
7+
//! soundness holes.
8+
//!
9+
//! Fixed by prohibiting use of unconstrained lifetimes on associated types
10+
//! in <https://github.com/rust-lang/rust/pull/24461>.
11+
//!
12+
//! Related <https://github.com/rust-lang/rust/issues/22077>.
13+
14+
fn crash_please() {
15+
let mut iter = Newtype(Some(Box::new(0)));
16+
let saved = iter.next().unwrap();
17+
println!("{}", saved);
18+
iter.0 = None;
19+
println!("{}", saved);
20+
}
21+
22+
struct Newtype(Option<Box<usize>>);
23+
24+
impl<'a> Iterator for Newtype { //~ ERROR E0207
25+
type Item = &'a Box<usize>;
26+
27+
fn next(&mut self) -> Option<&Box<usize>> {
28+
self.0.as_ref()
29+
}
30+
}
31+
32+
fn main() { }

tests/ui/issues/issue-22886.stderr renamed to tests/ui/associated-types/associated-type-unconstrained-lifetime.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
2-
--> $DIR/issue-22886.rs:13:6
2+
--> $DIR/associated-type-unconstrained-lifetime.rs:24:6
33
|
44
LL | impl<'a> Iterator for Newtype {
55
| ^^ unconstrained lifetime parameter

tests/ui/issues/issue-23024.rs renamed to tests/ui/cast/dyn-any-to-fn-with-missing-generics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/23024>.
12
use std::any::Any;
23

34
fn main()

tests/ui/issues/issue-23024.stderr renamed to tests/ui/cast/dyn-any-to-fn-with-missing-generics.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
2-
--> $DIR/issue-23024.rs:8:39
2+
--> $DIR/dyn-any-to-fn-with-missing-generics.rs:9:39
33
|
44
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
55
| ^^ help: use parenthetical notation instead: `Fn() -> ()`
@@ -9,7 +9,7 @@ LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0107]: missing generics for trait `Fn`
12-
--> $DIR/issue-23024.rs:8:39
12+
--> $DIR/dyn-any-to-fn-with-missing-generics.rs:9:39
1313
|
1414
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
1515
| ^^ expected 1 generic argument
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/23261>.
2+
//! Matching on a DST struct should not trigger an LLVM assertion.
13
//@ run-pass
2-
// Matching on a DST struct should not trigger an LLVM assertion.
34

45
struct Foo<T: ?Sized> {
56
a: i32,

tests/ui/issues/issue-22872.rs renamed to tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/22872>.
2+
13
trait Wrap<'b> {
24
fn foo(&'b mut self);
35
}

tests/ui/issues/issue-22872.stderr renamed to tests/ui/higher-ranked/leak-check/trait-object-assoc-type-bound-unsatisfied.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0277]: `<P as Process<'_>>::Item` is not an iterator
2-
--> $DIR/issue-22872.rs:20:40
2+
--> $DIR/trait-object-assoc-type-bound-unsatisfied.rs:22:40
33
|
44
LL | let _: Box<dyn for<'b> Wrap<'b>> = Box::new(Wrapper(process));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'_>>::Item` is not an iterator
66
|
77
= help: the trait `Iterator` is not implemented for `<P as Process<'_>>::Item`
88
note: required for `Wrapper<P>` to implement `for<'b> Wrap<'b>`
9-
--> $DIR/issue-22872.rs:7:13
9+
--> $DIR/trait-object-assoc-type-bound-unsatisfied.rs:9:13
1010
|
1111
LL | impl<'b, P> Wrap<'b> for Wrapper<P>
1212
| ^^^^^^^^ ^^^^^^^^^^

tests/ui/issues/issue-23041.rs renamed to tests/ui/inference/downcast-fn-ptr-placeholder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/23041>.
2+
//! Previously ICEd with cat_expr error, fixed by delaying bug.
3+
14
use std::any::Any;
25
fn main()
36
{

0 commit comments

Comments
 (0)