ronantakizawa/codereview-bench huggingface dataset:
Repository: rust-lang/rust
File: src/librustdoc/html/static/js/storage.js (JavaScript)

Code before:
 *
 * @param {string} name
 * @returns {string|null}
 */
function getCurrentValue(name) {
    try {
        return window.localStorage.getItem("rustdoc-" + name);
    } catch {
        return null;
    }
}

/**
 * Get a value from the rustdoc-vars div, which is used to convey data from
 * Rust to the JS. If there is no such element, return null.
 *
 * @param {rustdoc.VarName} name
 * @returns {string}
 */
function getVar(name) {
    const el = document.querySelector("head > meta[name='rustdoc-vars']");
    const v = el ? el.getAttribute("data-" + name) : null;
    if (v !== null) {
        return v;
    }
    throw "rustdoc var " + name + " is missing";
}

/**
 * Change the current theme.
 * @param {string|null} newThemeName
 * @param {boolean} saveTheme
 */
function switchTheme(newThemeName, saveTheme) {
    const themeNames = (getVar("themes") || "").split(",").filter(t => t);
    themeNames.push(...builtinThemes);

    // Ensure that the new theme name is among the defined themes
    if (newThemeName === null || themeNames.indexOf(newThemeName) === -1) {
        return;
    }

    // If this new value comes from a system setting or from the previously
    // saved theme, no need to save it.
    if (saveTheme) {
        updateLocalStorage("theme", newThemeName);
    }

    document.documentElement.setAttribute("data-theme", newThemeName);

    if (builtinThemes.indexOf(newThemeName) !== -1) {

Review comment (suggestion):
```suggestion
    throw `rustdoc var "${name}" is missing`;
```

Code after:
 *
 * @param {string} name
 * @returns {string|null}
 */
function getCurrentValue(name) {
    try {
        return window.localStorage.getItem("rustdoc-" + name);
    } catch {
        return null;
    }
}

/**
 * Get a value from the rustdoc-vars div, which is used to convey data from
 * Rust to the JS. If there is no such element, return null.
 *
 * @param {rustdoc.VarName} name
 * @returns {string}
 */
function getVar(name) {
    const el = document.querySelector("head > meta[name='rustdoc-vars']");
    const v = el ? el.getAttribute("data-" + name) : null;
    if (v !== null) {
        return v;
    }
    throw `rustdoc var "${name}" is missing`;
}

/**
 * Change the current theme.
 * @param {string|null} newThemeName
 * @param {boolean} saveTheme
 */
function switchTheme(newThemeName, saveTheme) {
    const themeNames = (getVar("themes") || "").split(",").filter(t => t);
    themeNames.push(...builtinThemes);

    // Ensure that the new theme name is among the defined themes
    if (newThemeName === null || themeNames.indexOf(newThemeName) === -1) {
        return;
    }

    // If this new value comes from a system setting or from the previously
    // saved theme, no need to save it.
    if (saveTheme) {
        updateLocalStorage("theme", newThemeName);
    }

    document.documentElement.setAttribute("data-theme", newThemeName);

    if (builtinThemes.indexOf(newThemeName) !== -1) {
Repository: rust-lang/rust
File: tests/codegen-llvm/simd/array-repeat.rs (Rust)

Code before:
//@ compile-flags: -Copt-level=3
#![crate_type = "lib"]
#![feature(portable_simd)]

// Regression test for https://github.com/rust-lang/rust/issues/97804.

use std::mem;
use std::simd::u8x16;

#[unsafe(no_mangle)]
fn foo(v: u16, p: &mut [u8; 16]) {
    // An array repeat transmuted into a SIMD type should emit a canonical LLVM splat sequence:
    //
    // CHECK-LABEL: foo
    // CHECK: start
    // CHECK-NEXT: %0 = insertelement <8 x i16> poison, i16 %v, i64 0
    // CHECK-NEXT: %1 = shufflevector <8 x i16> %0, <8 x i16> poison, <8 x i32> zeroinitializer
    // CHECK-NEXT: store <8 x i16> %1, ptr %p, align 1
    // CHECK-NEXT: ret void
    unsafe {
        let v: u8x16 = mem::transmute([v; 8]);
        *p = mem::transmute(v);
    }
}


Review comment (suggestion):
shouldn't this be `pub`? being private means it can be deleted as dead code.
```suggestion
pub fn foo(v: u16, p: &mut [u8; 16]) {
```

Code after:
//@ revisions: X86 AARCH64 RISCV S390X
//@ [X86] compile-flags: -Copt-level=3 --target=x86_64-unknown-linux-gnu
//@ [X86] needs-llvm-components: x86
//@ [AARCH64] compile-flags: -Copt-level=3 --target=aarch64-unknown-linux-gnu
//@ [AARCH64] needs-llvm-components: aarch64
//@ [RISCV] compile-flags: -Copt-level=3 --target riscv64gc-unknown-linux-gnu -Ctarget-feature=+v
//@ [RISCV] needs-llvm-components: riscv
//@ [S390X] compile-flags: -Copt-level=3 --target s390x-unknown-linux-gnu -Ctarget-feature=+vector
//@ [S390X] needs-llvm-components: systemz
#![crate_type = "lib"]
#![feature(repr_simd)]
#![feature(no_core)]
#![no_std]
#![no_core]
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct Simd<T, const N: usize>(pub [T; N]);

pub type u8x16 = Simd<u8, 16>;

// Regression test for https://github.com/rust-lang/rust/issues/97804.

#[unsafe(no_mangle)]
fn foo(v: u16, p: &mut [u8; 16]) {
    // An array repeat transmuted into a SIMD type should emit a canonical LLVM splat sequence:
    //
    // CHECK-LABEL: foo
    // CHECK: start
    // CHECK-NEXT: %0 = insertelement <8 x i16> poison, i16 %v, i64 0
    // CHECK-NEXT: %1 = shufflevector <8 x i16> %0, <8 x i16> poison, <8 x i32> zeroinitializer
    // CHECK-NEXT: store <8 x i16> %1, ptr %p, align 1
    // CHECK-NEXT: ret void
    unsafe {
        let v: u8x16 = mem::transmute([v; 8]);
        *p = mem::transmute(v);
    }
}
Repository: rust-lang/rust
File: tests/codegen-llvm/simd/array-repeat.rs (Rust)

Code before:
//@ add-minicore
//@ revisions: X86 AARCH64 RISCV S390X
//@ [X86] compile-flags: -Copt-level=3 --target=x86_64-unknown-linux-gnu
//@ [X86] needs-llvm-components: x86
//@ [AARCH64] compile-flags: -Copt-level=3 --target=aarch64-unknown-linux-gnu
//@ [AARCH64] needs-llvm-components: aarch64
//@ [RISCV] compile-flags: --target riscv64gc-unknown-linux-gnu -Ctarget-feature=+v
//@ [RISCV] needs-llvm-components: riscv
//@ [S390X] compile-flags: --target s390x-unknown-linux-gnu -Ctarget-feature=+vector
//@ [S390X] needs-llvm-components: systemz
#![crate_type = "lib"]
#![feature(repr_simd)]
#![feature(no_core)]
#![no_std]
#![no_core]
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct Simd<T, const N: usize>(pub [T; N]);

pub type u8x16 = Simd<u8, 16>;

// Regression test for https://github.com/rust-lang/rust/issues/97804.

#[unsafe(no_mangle)]
fn foo(v: u16, p: &mut [u8; 16]) {
    // An array repeat transmuted into a SIMD type should emit a canonical LLVM splat sequence:

Review comment (suggestion):
Should have `-Copt-level=3` on all the revisions? (Or just specify that part separately.)

Code after:
//@ add-minicore
//@ revisions: X86 AARCH64 RISCV S390X
//@ [X86] compile-flags: -Copt-level=3 --target=x86_64-unknown-linux-gnu
//@ [X86] needs-llvm-components: x86
//@ [AARCH64] compile-flags: -Copt-level=3 --target=aarch64-unknown-linux-gnu
//@ [AARCH64] needs-llvm-components: aarch64
//@ [RISCV] compile-flags: -Copt-level=3 --target riscv64gc-unknown-linux-gnu -Ctarget-feature=+v
//@ [RISCV] needs-llvm-components: riscv
//@ [S390X] compile-flags: -Copt-level=3 --target s390x-unknown-linux-gnu -Ctarget-feature=+vector
//@ [S390X] needs-llvm-components: systemz
#![crate_type = "lib"]
#![feature(repr_simd)]
#![feature(no_core)]
#![no_std]
#![no_core]
extern crate minicore;
use minicore::*;

#[repr(simd)]
pub struct Simd<T, const N: usize>(pub [T; N]);

pub type u8x16 = Simd<u8, 16>;

// Regression test for https://github.com/rust-lang/rust/issues/97804.

#[unsafe(no_mangle)]
fn foo(v: u16, p: &mut [u8; 16]) {
    // An array repeat transmuted into a SIMD type should emit a canonical LLVM splat sequence:
Repository: rust-lang/rust
File: compiler/rustc_macros/src/query.rs (Rust)

Code before:
            (
                // The macro to invoke once, on all queries (plus extras).
                $macro:ident!

                // Within [], an optional list of extra "query" signatures to
                // pass to the given macro, in addition to the actual queries.
                $( [$($extra_fake_queries:tt)*] )?
            ) => {
                $macro! {
                    $( $($extra_fake_queries)* )?
                    #query_stream
                }
            }
        }
        macro_rules! rustc_feedable_queries {
            ( $macro:ident! ) => {
                $macro!(#feedable_queries);
            }
        }
        pub mod descs {
            use super::*;
            #description_fns_stream
        }

        // FIXME(Zalathar): Instead of declaring these functions directly, can
        // we put them in a macro and then expand that macro downstream in
        // `rustc_query_impl`, where the functions are actually used?
        pub mod _cache_on_disk_if_fns {
            use super::*;
            #cache_on_disk_if_fns_stream
        }

        #errors
    })
}


Review comment (suggestion):
We kind of want to keep `rustc_query_impl` small (for compile-time reasons), so having it point to functions (which won't be inlined) in `rustc_middle` isn't terrible.

Code after:
                // The macro to invoke once, on all queries (plus extras).
                $macro:ident!

                // Within [], an optional list of extra "query" signatures to
                // pass to the given macro, in addition to the actual queries.
                $( [$($extra_fake_queries:tt)*] )?
            ) => {
                $macro! {
                    $( $($extra_fake_queries)* )?
                    #query_stream
                }
            }
        }
        macro_rules! rustc_feedable_queries {
            ( $macro:ident! ) => {
                $macro!(#feedable_queries);
            }
        }
        pub mod descs {
            use super::*;
            #description_fns_stream
        }

        // FIXME(Zalathar): Instead of declaring these functions directly, can
        // we put them in a macro and then expand that macro downstream in
        // `rustc_query_impl`, where the functions are actually used?
        pub mod _cache_on_disk_if_fns {
            use super::*;
            #cache_on_disk_if_fns_stream
        }

        #errors
    })
}
Repository: rust-lang/rust
File: tests/ui/inference/issue-103587.rs (Rust)

Code before:
fn main() {
    let x = Some(123);

    if let Some(_) == x {}
    //~^ ERROR expected `=`, found `==`

    if Some(_) = x {}
    //~^ ERROR missing `let`

    if None = x { }
    //~^ ERROR mismatched types
}


Review comment (suggestion):
Wait, this renders `if Some(_) = x {}` syntactically invalid whereas on main it's merely semantically invalid, right? If so, this constitutes a breaking change and is generally not acceptable[^1].

[^1]: Unless T-lang is in favor of it (which I doubt) and crater is happy

Code after:
fn main() {
    let x = Some(123);

    if let Some(_) == x {}
    //~^ ERROR expected `=`, found `==`

    if Some(_) = x {}
    //~^ ERROR mismatched types

    if None = x { }
    //~^ ERROR mismatched types
}
Repository: rust-lang/rust
File: tests/ui/cycle-trait/pointee-sized-next-solver-ice.rs (Rust)

Code before:
//@ compile-flags: -Znext-solver=globally

// Regression test for https://github.com/rust-lang/rust/issues/151957

trait PointeeSized {
    type Undefined;
}

struct T;

impl PointeeSized for T
//~^ ERROR not all trait items implemented, missing: `Undefined`
//~| ERROR the trait bound `T: PointeeSized` is not satisfied
where
    <T as PointeeSized>::Undefined: PointeeSized,
//~^ ERROR the trait bound `T: PointeeSized` is not satisfied
//~| ERROR the trait bound `T: PointeeSized` is not satisfied
{}

fn main() {}


Review comment (suggestion):
i personally prefer this reproducer as a test https://github.com/rust-lang/rust/issues/151957#issuecomment-3918401967
```rust
trait PointeeSized {}

fn require_trait<T: PointeeSized>() {}

fn main() {
    require_trait::<i32>();
}
```
please also explain why this errors (and add revisions to test with both solvers)

Code after:
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)

// Regression test for https://github.com/rust-lang/rust/issues/151957
//
// When a user-defined trait shares the name `PointeeSized` with
// `core::marker::PointeeSized`, error reporting tries to check whether
// the type implements the lang-item `PointeeSized` trait via
// `predicate_must_hold_modulo_regions`. This creates a `PointeeSized`
// solver obligation which causes an ICE. We avoid this by skipping the
// `PointeeSized` lang item during the "similarly named trait" suggestion.

trait PointeeSized {}

fn require_trait<T: PointeeSized>() {}

fn main() {
    require_trait::<i32>();
    //~^ ERROR the trait bound `i32: PointeeSized` is not satisfied
}
Repository: rust-lang/rust
File: library/coretests/tests/mem/type_info.rs (Rust)

Code before:

        let foo = pred(preds, TypeId::of::<dyn for<'a> FooTrait<'a, 'a, 7>>());
        assert!(!foo.trait_ty.is_auto);

        let send = pred(preds, TypeId::of::<dyn Send>());
        assert!(send.trait_ty.is_auto);

        let sync = pred(preds, TypeId::of::<dyn Sync>());
        assert!(sync.trait_ty.is_auto);
    }
}

#[test]
fn test_implements_trait() {
    struct Garlic(i32);
    trait Blah {
        fn get_truth(&self) -> i32;
    }
    impl Blah for Garlic {
        fn get_truth(&self) -> i32 {
            self.0 * 21
        }
    }

    const {
        assert!(TypeId::of::<Garlic>().trait_info_of::<dyn Blah>().is_some());
        assert!(TypeId::of::<Garlic>().trait_info_of::<dyn Blah + Send>().is_some());
        assert!(TypeId::of::<*const Box<Garlic>>().trait_info_of::<dyn Sync>().is_none());
        assert!(TypeId::of::<u8>().trait_info_of_trait_type_id(TypeId::of::<dyn Blah>()).is_none());
    }

    let garlic = Garlic(2);
    unsafe {
        assert_eq!(
            std::ptr::from_raw_parts::<dyn Blah>(
                &raw const garlic,
                const { TypeId::of::<Garlic>().trait_info_of::<dyn Blah>() }.unwrap().get_vtable()
            )
            .as_ref()
            .unwrap()
            .get_truth(),
            42
        );
    }

    assert_eq!(
        const {
            TypeId::of::<Garlic>()
            .trait_info_of_trait_type_id(TypeId::of::<dyn Blah>())
            .unwrap()
        }.get_vtable(),

Review comment (suggestion):
there should probably be some tests of what happens when you pass something that's not a `dyn Trait` to `trait_info_of`, e.g. `TypeId::of::<i32>().trait_info_of::<u32>()`

Code after:
        _ => unreachable!(),
    }
}

#[test]
fn test_pointers() {
    // Immutable pointer.
    match const { Type::of::<*const u8>() }.kind {
        TypeKind::Pointer(pointer) => {
            assert_eq!(pointer.pointee, TypeId::of::<u8>());
            assert!(!pointer.mutable);
        }
        _ => unreachable!(),
    }

    // Mutable pointer.
    match const { Type::of::<*mut u64>() }.kind {
        TypeKind::Pointer(pointer) => {
            assert_eq!(pointer.pointee, TypeId::of::<u64>());
            assert!(pointer.mutable);
        }
        _ => unreachable!(),
    }

    // Wide pointer.
    match const { Type::of::<*const dyn Any>() }.kind {
        TypeKind::Pointer(pointer) => {
            assert_eq!(pointer.pointee, TypeId::of::<dyn Any>());
            assert!(!pointer.mutable);
        }
        _ => unreachable!(),
    }
}

#[test]
fn test_dynamic_traits() {
    use std::collections::HashSet;
    use std::mem::type_info::DynTraitPredicate;
    trait A<T> {}

    trait B<const CONST_NUM: i32> {
        type Foo;
    }

    trait FooTrait<'a, 'b, const CONST_NUM: i32> {}

    trait ProjectorTrait<'a, 'b> {}

    fn preds_of<T: ?Sized + 'static>() -> &'static [DynTraitPredicate] {
        match const { Type::of::<T>() }.kind {
            TypeKind::DynTrait(d) => d.predicates,
Repository: rust-lang/rust
File: tests/run-make/autodiff/type-trees/array-typetree/rmake.rs (Rust)

Code before:
//@ needs-enzyme
//@ ignore-cross-compile

use run_make_support::{llvm_filecheck, rfs, rustc};

fn main() {
    rustc().input("test.rs").arg("-Zautodiff=Enable").emit("llvm-ir").run();
    llvm_filecheck().patterns("array.check").stdin_buf(rfs::read("test.ll")).run();
}


Review comment (bug):
Ok, this gave the right error on my system, when I ran it individually:
```
error: using the autodiff feature requires setting `lto="fat"` in your Cargo.toml

error: aborting due to 1 previous error
```
I probably didn't notice it between all the other failures.

Code after:
//@ needs-enzyme
//@ ignore-cross-compile

use run_make_support::{llvm_filecheck, rfs, rustc};

fn main() {
    rustc().input("test.rs").arg("-Zautodiff=Enable").arg("-Clto=fat").emit("llvm-ir").run();
    llvm_filecheck().patterns("array.check").stdin_buf(rfs::read("test.ll")).run();
}
Repository: rust-lang/rust
File: tests/ui/resolve/enum-variant-import-2904.rs (Rust)

Code before:
//! Regression test for https://github.com/rust-lang/rust/issues/2904

//@ build-pass
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_mut)]
#![allow(non_camel_case_types)]

// Map representation

use square::{bot, closed_lift, earth, empty, lambda, open_lift, rock, wall};
use std::fmt;
use std::io::prelude::*;

enum square {
    bot,
    wall,
    rock,
    lambda,
    closed_lift,
    open_lift,
    earth,
    empty,
}

impl fmt::Debug for square {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "{}",
            match *self {
                bot => {

Review comment (suggestion):
I don't think it's necessary to allow `non_camel_case_types` in this test, so it's probably better to disallow them.

Code after:
//! Regression test for https://github.com/rust-lang/rust/issues/2904

//@ build-pass
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_mut)]

// Map representation

use Square::{Bot, ClosedLift, Earth, Empty, Lambda, OpenLift, Rock, Wall};
use std::fmt;
use std::io::prelude::*;

enum Square {
    Bot,
    Wall,
    Rock,
    Lambda,
    ClosedLift,
    OpenLift,
    Earth,
    Empty,
}

impl fmt::Debug for Square {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "{}",
            match *self {
                Bot => {
                    "R".to_string()
Repository: rust-lang/rust
File: tests/ui/const-generics/associated-const-bindings/wf-mismatch-1.rs (Rust)

Code before:
//@ known-bug: unknown
//@ check-pass

#![feature(min_generic_const_args)]
#![expect(incomplete_features)]

trait Trait { #[type_const] const CT: bool; }

// FIXME: this should yield a type mismatch (`bool` v `i32`)
fn f<const N: i32>(_: impl Trait<CT = { N }>) {}

fn main() {}


Review comment (suggestion):
This will get fixed once you add wf checks for `T: Trait<ASSOC = N>` where clauses.

You can do this by adding fairly similar logic to what you've already done, but in `rustc_hir_analysis/src/check/wfcheck.rs` in the `check_where_clause` function

You should be able to similarly iterate over all of the predicates and filter to only those that are associated const bindings 

Code after:
//! Check that we correctly handle associated const bindings
//! in `impl Trait` where the RHS is a const param (#151642).

#![feature(min_generic_const_args)]
#![expect(incomplete_features)]

trait Trait { type const CT: bool; }

fn f<const N: i32>(_: impl Trait<CT = { N }>) {}
//~^ ERROR the constant `N` is not of type `bool`
fn main() {}
Repository: rust-lang/rust
File: tests/ui/traits/next-solver/opaques/eventually-constrained-region.rs (Rust)

Code before:
#![feature(type_alias_impl_trait)]

struct Invar<'a>(*mut &'a ());


fn mk_invar<'a>(a: &'a i32) -> Invar<'a> {
    todo!()
}

fn mk_static() -> Invar<'static> {
    todo!()
}

fn guide_closure_sig<'a>(f: impl FnOnce() -> Invar<'a>) {}

type MultiUse1 = impl Sized;

#[define_opaque(MultiUse1)]
fn unconstrained_in_closure() -> MultiUse1 {
    guide_closure_sig(|| unconstrained_in_closure());
    mk_static()
}

type MultiUse2 = impl Sized;
#[define_opaque(MultiUse2)]
fn capture_different_universals_not_on_bounds<'a, 'b, 'c>(a: &'a i32, b: &'b i32, c: &'c i32)  {
    let _ = || -> MultiUse2 {
        //~^ ERROR: hidden type for `MultiUse2` captures lifetime that does not appear in bounds [E0700]
        mk_invar(a)
    };
    let _ = || -> MultiUse2 {
        //~^ ERROR: hidden type for `MultiUse2` captures lifetime that does not appear in bounds [E0700]
        mk_invar(b)
    };
    let _ = || {
        let _ = || -> MultiUse2 {
            //~^ ERROR: hidden type for `MultiUse2` captures lifetime that does not appear in bounds [E0700]
            mk_invar(c)
        };
    };
}


fn main() {}


Review comment (suggestion):
Just make sure that we report error for each invalid capture. 
In my other attempt, only one unconstrained error per opaque definition is reported.

Code after:
//@ check-pass
//@ compile-flags: -Znext-solver

// Regression test for trait-system-refactor-initiative#264.
//
// Some defining uses of opaque types can't constrain captured regions to universals.
// Previouly, we eagerly report error in this case.
// Now we report error only if there's no fully defining use from all bodies of the typeck root.

struct Inv<'a>(*mut &'a ());

fn mk_static() -> Inv<'static> { todo!() }

fn guide_closure_sig<'a>(f: impl FnOnce() -> Inv<'a>) {}

fn unconstrained_in_closure() -> impl Sized {
    guide_closure_sig(|| unconstrained_in_closure());
    mk_static()
}

fn main() {}
Repository: rust-lang/rust
File: tests/ui/traits/next-solver/opaques/eventually-constrained-region.rs (Rust)

Code before:
//@ check-pass
//@ compile-flags: -Znext-solver

// Regression test for trait-system-refactor-initiative#264.
//
// Some defining uses of opaque types can't constrain captured regions to universals.
// Previouly, we eagerly report error in this case.
// Now we report error only if there's no fully defining use from all bodies of the typeck root.

#![feature(type_alias_impl_trait)]

struct Invar<'a>(*mut &'a ());

fn mk_static() -> Invar<'static> { todo!() }

fn guide_closure_sig<'a>(f: impl FnOnce() -> Invar<'a>) {}

type MultiUse = impl Sized;

#[define_opaque(MultiUse)]
fn unconstrained_in_closure() -> MultiUse {
    guide_closure_sig(|| unconstrained_in_closure());
    mk_static()
}

fn main() {}


Review comment (suggestion):
```suggestion
struct Inv<'a>(*mut &'a ());
```
sorry, this is the convention we generally use and `Invar` is confusing to me. Please also change this test to use RPIT instead of tait

Code after:
//@ check-pass
//@ compile-flags: -Znext-solver

// Regression test for trait-system-refactor-initiative#264.
//
// Some defining uses of opaque types can't constrain captured regions to universals.
// Previouly, we eagerly report error in this case.
// Now we report error only if there's no fully defining use from all bodies of the typeck root.

struct Inv<'a>(*mut &'a ());

fn mk_static() -> Inv<'static> { todo!() }

fn guide_closure_sig<'a>(f: impl FnOnce() -> Inv<'a>) {}

fn unconstrained_in_closure() -> impl Sized {
    guide_closure_sig(|| unconstrained_in_closure());
    mk_static()
}

fn main() {}
Repository: rust-lang/rust
File: tests/ui/associated-type-bounds/return-type-notation/trait-alias.rs (Rust)

Code before:
// Regression test for #152158.

//@ check-pass

#![feature(return_type_notation, trait_alias)]

trait Tr {
    fn f() -> impl Sized;
}

trait Al = Tr;

fn f<T: Al<f(..): Copy>>() {}

fn main() {}


Review comment (suggestion):
That's a lot of unnecessary vertical spacing, could you remove some of it? Lastly, could you use a full URL for the issue (that makes it easily clickable)?


```suggestion
// Regression test for <https://github.com/rust-lang/rust/issues/152158>.
//@ check-pass
#![feature(return_type_notation, trait_alias)]
```

Code after:
// Regression test for <https://github.com/rust-lang/rust/issues/152158>.
//@ check-pass
#![feature(return_type_notation, trait_alias)]

trait Tr {
    fn f() -> impl Sized;
}

trait Al = Tr;

fn f<T: Al<f(..): Copy>>() {}

fn main() {}