-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following programs get wrongfully rejected since my PR #119505 (nightly-2024-01-04):
pub struct S;
trait Trait {
fn provided() {
impl S {
pub fn perform() {} //~ ERROR visibility qualifiers are not permitted here
}
}
}
pub struct S;
struct Expr<const N: u32>;
trait Trait {
fn required(_: Expr<{
impl S {
pub fn perform() {} //~ ERROR visibility qualifiers are not permitted here
}
0
}>);
}
The following program was incorrectly rejected even before my PR #119505 (nightly-2024-01-04):
#![feature(const_trait_impl, effects)]
pub struct S;
#[const_trait]
trait Trait {
fn required();
}
impl const Trait for () {
fn required() {
impl S {
pub fn perform() {} //~ ERROR visibility qualifiers are not permitted here
}
}
}
The following programs lead to an ICE even before my PR (e.g., in nightly-2023-12-31):
#![feature(const_trait_impl, effects)]
pub struct S;
#[const_trait]
trait Trait {
fn provided() {
impl S {
fn perform<T: ~const Trait>() {} // should've gotten rejected during AST validation
//~^ ICE no host param id for call in const yet no errors reported
}
}
}
#![feature(const_trait_impl, effects)]
pub struct S;
struct Expr<const N: u32>;
#[const_trait]
trait Trait {
fn required(_: Expr<{
impl S {
fn perform<T: ~const Trait>() {} // should've gotten rejected during AST validation
//~^ ICE no host param id for call in const yet no errors reported
}
0
}>);
}
#![feature(const_trait_impl, effects)]
struct S;
#[const_trait]
trait Trait<const N: u32> {}
const fn f<T: Trait<{
struct I<U: ~const Trait<0>>(U); // should've gotten rejected during AST validation
//~^ ICE no host param id for call in const yet no errors reported
0
}>>() {}
There are many more issues and probably many more ways to reproduce this, e.g. we don't visit attributes on associated functions under certain circumstances (I couldn't find a reproducer yet in which you can observe the bug).
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
pallet-contracts: Fix compilation on latest nightly
pallet-contracts: Fix compilation on latest nightly (#2986)
fmease commentedon Jan 23, 2024
Ah nice, I found another one reported by someone else ages ago while triaging
needs-triage-legacy
issues: #89342.fmease commentedon Feb 2, 2024
Lol, no code path properly accounts for
AnonConst
inAstValidator
:fmease commentedon Feb 6, 2024
Fun, the following also gets rejected (not strictly AST validation but AST passes, namely
feature_gate
):AstValidator
#120698pallet-contracts: Fix compilation on latest nightly (paritytech#2986)
Rollup merge of rust-lang#122004 - fmease:astvalidator-min-fix, r=com…
Unrolled build for rust-lang#122004
pallet-contracts: Fix compilation on latest nightly (paritytech#2986)
Rollup merge of rust-lang#139063 - fmease:fix-tait-atpit-gating, r=ol…
Unrolled build for rust-lang#139063