-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function pointers as const generic arguments #64986
Function pointers as const generic arguments #64986
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
It would definitely be good not to ICE, or emit a link error here. Let's put the ability to use pointers in const arguments behind |
Oh I wasn't even worried about that, but UX is a good point, too. I worry about unsoundness because of differences between runtime and compile time for the same const evaluable code. |
I gated the use of both raw pointers and function pointers behind the feature gate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks great! Minor diagnostic suggestion, and then it looks good to go!
(@Skinny121: you'll need to run |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
function pointer const parameters.
const_compare_raw_pointers.
Co-Authored-By: varkor <github@varkor.com>
fb4631d
to
5986fe2
Compare
I forgot that I would have to do that :). I also rebased so that the stderr files reflect the changes from #65154. |
--> $DIR/raw-ptr-const-param.rs:7:38 | ||
| | ||
LL | let _: Const<{15 as *const _}> = Const::<{10 as *const _}>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Scalar(0x000000000000000f) : *const u32`, found `Scalar(0x000000000000000a) : *const u32` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These diagnostics are not great, but we can file an issue for that.
Thanks! @bors r+ rollup |
📌 Commit 5986fe2 has been approved by |
…varkor Function pointers as const generic arguments Makes function pointers as const generic arguments usable. Fixes rust-lang#62395 r? @varkor
Rollup of 6 pull requests Successful merges: - #64656 (Implement (HashMap) Entry::insert as per #60142) - #64986 (Function pointers as const generic arguments) - #65037 (`#[track_caller]` feature gate (RFC 2091 1/N)) - #65166 (Suggest to add `move` keyword for generator capture) - #65175 (add more info in debug traces for gcu merging) - #65220 (Update LLVM for Emscripten exception handling support) Failed merges: r? @ghost
Failed in #65227 (comment), @bors r- |
Maybe we should normalise the printing of pointers to |
I changed the printing of point to |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r+ |
📌 Commit 8569dd1 has been approved by |
…varkor Function pointers as const generic arguments Makes function pointers as const generic arguments usable. Fixes rust-lang#62395 r? @varkor
…varkor Function pointers as const generic arguments Makes function pointers as const generic arguments usable. Fixes rust-lang#62395 r? @varkor
Rollup of 16 pull requests Successful merges: - rust-lang#64337 (libstd: Fix typos in doc) - rust-lang#64986 (Function pointers as const generic arguments) - rust-lang#65048 (Added doc about behavior of extend on HashMap) - rust-lang#65191 (Add some regression tests) - rust-lang#65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation) - rust-lang#65205 (Add long error explanation for E0568) - rust-lang#65240 (self-profiling: Add events for metadata loading (plus a small dep-tracking optimization)) - rust-lang#65248 (Suggest `if let` on `let` refutable binding) - rust-lang#65252 (expand: Simplify expansion of derives) - rust-lang#65263 (Deduplicate is_{freeze,copy,sized}_raw) - rust-lang#65265 (Cleanup librustc mir err codes) - rust-lang#65266 (Mark Path::join as must_use) - rust-lang#65276 (Don't cc rust-lang/compiler for toolstate changes) - rust-lang#65277 (Query generator kind for error reporting) - rust-lang#65283 (stability: Do not use `buffer_lint` after lowering to HIR) - rust-lang#65289 (Fix suggested bound addition diagnostic) Failed merges: r? @ghost
Rollup of 16 pull requests Successful merges: - rust-lang#64337 (libstd: Fix typos in doc) - rust-lang#64986 (Function pointers as const generic arguments) - rust-lang#65048 (Added doc about behavior of extend on HashMap) - rust-lang#65191 (Add some regression tests) - rust-lang#65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation) - rust-lang#65205 (Add long error explanation for E0568) - rust-lang#65240 (self-profiling: Add events for metadata loading (plus a small dep-tracking optimization)) - rust-lang#65248 (Suggest `if let` on `let` refutable binding) - rust-lang#65252 (expand: Simplify expansion of derives) - rust-lang#65263 (Deduplicate is_{freeze,copy,sized}_raw) - rust-lang#65265 (Cleanup librustc mir err codes) - rust-lang#65266 (Mark Path::join as must_use) - rust-lang#65276 (Don't cc rust-lang/compiler for toolstate changes) - rust-lang#65277 (Query generator kind for error reporting) - rust-lang#65283 (stability: Do not use `buffer_lint` after lowering to HIR) - rust-lang#65289 (Fix suggested bound addition diagnostic) Failed merges: r? @ghost
…varkor Function pointers as const generic arguments Makes function pointers as const generic arguments usable. Fixes rust-lang#62395 r? @varkor
Rollup of 15 pull requests Successful merges: - #64337 (libstd: Fix typos in doc) - #64986 (Function pointers as const generic arguments) - #65048 (Added doc about behavior of extend on HashMap) - #65191 (Add some regression tests) - #65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation) - #65205 (Add long error explanation for E0568) - #65220 (Update LLVM for Emscripten exception handling support) - #65263 (Deduplicate is_{freeze,copy,sized}_raw) - #65266 (Mark Path::join as must_use) - #65276 (Don't cc rust-lang/compiler for toolstate changes) - #65277 (Query generator kind for error reporting) - #65283 (stability: Do not use `buffer_lint` after lowering to HIR) - #65289 (Fix suggested bound addition diagnostic) - #65310 (deriving: avoid dummy Span on an artificial `type_ident` path) - #65321 (Remove painful test that is not pulling its weight) Failed merges: r? @ghost
If there wasn't an issue opened for fixing this, there should be, so we won't forget about it. |
Makes function pointers as const generic arguments usable.
Fixes #62395
r? @varkor