Rollup merge of #157737 - zedddie:gsoc-batch-7-meow, r=Teapot4195

Reorganize `tests/ui/issues` [7/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
This commit is contained in:
Jacob Pratt
2026-06-11 23:15:29 -04:00
committed by GitHub
17 changed files with 71 additions and 49 deletions
@@ -1,3 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21402>.
//@ check-pass
#![allow(dead_code)]
+14
View File
@@ -0,0 +1,14 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21160>.
//! Ensure we don't use existing hash method internally in hash derive.
struct Bar;
impl Bar {
fn hash<T>(&self, _: T) {}
}
#[derive(Hash)]
struct Foo(Bar);
//~^ error: `Bar: Hash` is not satisfied
fn main() {}
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Bar: Hash` is not satisfied
--> $DIR/issue-21160.rs:8:12
--> $DIR/ufcs-in-derive-hash.rs:11:12
|
LL | #[derive(Hash)]
| ---- in this derive macro expansion
@@ -1,9 +1,11 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21245>.
//!
//! Check that we are able to infer the types in these examples correctly.
//! It used to be that insufficient type propagation caused the type of the
//! iterator to be incorrectly unified with the `*const` type to which it is coerced.
//@ check-pass
#![allow(dead_code)]
// Regression test for issue #21245. Check that we are able to infer
// the types in these examples correctly. It used to be that
// insufficient type propagation caused the type of the iterator to be
// incorrectly unified with the `*const` type to which it is coerced.
use std::ptr;
-6
View File
@@ -1,6 +0,0 @@
//@ check-pass
pub trait Trait where Self::Out: std::fmt::Display {
type Out;
}
fn main() {}
-11
View File
@@ -1,11 +0,0 @@
struct Bar;
impl Bar {
fn hash<T>(&self, _: T) {}
}
#[derive(Hash)]
struct Foo(Bar);
//~^ error: `Bar: Hash` is not satisfied
fn main() {}
-15
View File
@@ -1,15 +0,0 @@
//@ aux-build:issue-21202.rs
extern crate issue_21202 as crate1;
use crate1::A;
mod B {
use crate1::A::Foo;
fn bar(f: Foo) {
Foo::foo(&f);
//~^ ERROR: method `foo` is private
}
}
fn main() { }
@@ -1,7 +1,8 @@
// Regression test for #20831: debruijn index account was thrown off
// by the (anonymous) lifetime in `<Self as Publisher>::Output`
// below. Note that changing to a named lifetime made the problem go
// away.
//! Regression test for <https://github.com/rust-lang/rust/issues/20831>.
//!
//! DeBruijn index account was thrown off by the (anonymous) lifetime
//! in `<Self as Publisher>::Output` below. Note that changing to a
//! named lifetime made the problem go away.
use std::cell::RefCell;
use std::ops::{Shl, Shr};
@@ -1,21 +1,21 @@
error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/issue-20831-debruijn.rs:28:33
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:33
|
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime as defined here...
--> $DIR/issue-20831-debruijn.rs:28:67
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:67
|
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^
note: ...but the lifetime must also be valid for the lifetime `'a` as defined here...
--> $DIR/issue-20831-debruijn.rs:26:6
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:27:6
|
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-20831-debruijn.rs:28:33
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:33
|
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher
found `<MyStruct<'_> as Publisher<'_>>`
error: lifetime may not live long enough
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:5
|
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
| -- lifetime `'a` defined here
@@ -35,7 +35,7 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher
| requires that `'a` must outlive `'1`
error: lifetime may not live long enough
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/implicit-lifetime-in-assoc-type-projection.rs:29:5
|
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
| -- lifetime `'a` defined here
+18
View File
@@ -0,0 +1,18 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21202>.
//! Tests cross-crate ufcs doesn't bypass privacy checks.
//!
//@ aux-build:ufcs-cross-crate.rs
extern crate ufcs_cross_crate as crate1;
use crate1::A;
mod B {
use crate1::A::Foo;
fn bar(f: Foo) {
Foo::foo(&f);
//~^ ERROR: method `foo` is private
}
}
fn main() { }
@@ -1,10 +1,10 @@
error[E0624]: method `foo` is private
--> $DIR/issue-21202.rs:10:14
--> $DIR/ufcs-cross-crate.rs:13:14
|
LL | Foo::foo(&f);
| ^^^ private method
|
::: $DIR/auxiliary/issue-21202.rs:4:9
::: $DIR/auxiliary/ufcs-cross-crate.rs:4:9
|
LL | fn foo(&self) { }
| ------------- private method defined here
@@ -1,3 +1,4 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21384>.
//@ run-pass
use ::std::ops::RangeFull;
@@ -1,3 +1,6 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/20953>.
//! Ensure both boxed and ref Iterator trait object implement Iterator.
//@ run-pass
#![allow(unused_mut)]
#![allow(unused_variables)]
@@ -0,0 +1,9 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21140>.
//! Tests we don't ICE on where clauses on self associated type.
//@ check-pass
pub trait Trait where Self::Out: std::fmt::Display {
type Out;
}
fn main() {}
@@ -1,3 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/21174>.
//@ check-pass
#![allow(dead_code)]
#![allow(unused_variables)]
@@ -1,3 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/20544>.
//@ run-pass
#![feature(unboxed_closures)]
#![feature(fn_traits)]