Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
2fcea9fb68c8e04f10e5cb15bbfb486de9800afa
rust/tests/ui/traits/const-traits/function-pointer-does-not-require-const.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
209 B
Rust
Raw Normal View History

Move const trait bounds checks to MIR constck Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck.
2023-03-24 09:17:51 +00:00
//@ check-pass
#![feature(const_trait_impl)]
#[const_trait]
pub trait Test {}
impl Test for () {}
Change const trait bound syntax from ~const to [const]
2025-03-11 12:08:45 +00:00
pub const fn test<T: [const] Test>() {}
Move const trait bounds checks to MIR constck Fixes #109543. When checking paths in HIR typeck, we don't want to check for const predicates since all we want might just be a function pointer. Therefore we move this to MIR constck and check that bounds are met during MIR constck.
2023-03-24 09:17:51 +00:00
pub const fn min_by_i32() -> fn() {
test::<()>
}
fn main() {}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1456ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API