Fixed ICE when using function pointer as const generic parameter#151219
Fixed ICE when using function pointer as const generic parameter#151219rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
HIR ty lowering was modified cc @fmease |
|
rustbot has assigned @WaffleLapkin. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2cc5c51 to
1db0e70
Compare
|
also fixes #137084 |
Please mention all issues in the PR description via e.g., Moreover, please remove the |
d7a40b3 to
87f1829
Compare
5cd5886 to
f0865a1
Compare
|
r? BoxyUwU |
| } | ||
|
|
||
| if let Some(span_late) = def.has_late_bound_regions { | ||
| if let Some(span_late) = def.has_late_bound_regions |
There was a problem hiding this comment.
this function is somewhat confusing to me 🤔
Can you try doing two things for me:
- remove the
infer_lifetimescase above, it seems unnecessary if we only emit an error/fcw if there's explicit arguments given - use
args.has_lifetime_params()instead of!args.args.is_empty(), I think this is closer to the logic we want, especially for cases like this where there are arguments but they're not lifetimes
I think both of these together would make it a lot easier to read this fn 😅
There was a problem hiding this comment.
hi again! thanks for the review! implemented all of your suggestions, now waiting for CI check, tests passed, fn now looking better and more consistent :3
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
| let Some(first_lifetime_arg) = | ||
| args.args.iter().find(|arg| matches!(arg, GenericArg::Lifetime(_))) | ||
| else { | ||
| return ExplicitLateBound::No; | ||
| }; | ||
| let span = first_lifetime_arg.span(); |
There was a problem hiding this comment.
why change this? if args isnt empty then args.args[0] should work fine
There was a problem hiding this comment.
sorry, overcomplicated it, was a little bit confused
c9e6735 to
ce65294
Compare
done, thanks for the tips on working at this PR! |
|
@bors r=BoxyUwU |
Fixed ICE when using function pointer as const generic parameter added bounds check in prohibit_explicit_late_bound_lifetimes to prevent index out of bounds panic when args.args is empty. also regression test here to ensure function pointers in const generics produce proper error messages instead of ICE. Fixes rust-lang#151186 Fixes rust-lang#137084
…uwer Rollup of 5 pull requests Successful merges: - #151010 (std: use `ByteStr`'s `Display` for `OsStr`) - #151156 (Add GCC and the GCC codegen backend to build-manifest and rustup) - #151219 (Fixed ICE when using function pointer as const generic parameter) - #151343 (Port some crate level attrs to the attribute parser) - #151463 (add x86_64-unknown-linux-gnuasan to CI) r? @ghost
Rollup merge of #151219 - enthropy7:main, r=BoxyUwU Fixed ICE when using function pointer as const generic parameter added bounds check in prohibit_explicit_late_bound_lifetimes to prevent index out of bounds panic when args.args is empty. also regression test here to ensure function pointers in const generics produce proper error messages instead of ICE. Fixes #151186 Fixes #137084
added bounds check in prohibit_explicit_late_bound_lifetimes to prevent index out of bounds panic when args.args is empty. also regression test here to ensure function pointers in const generics produce proper error messages instead of ICE.
Fixes #151186
Fixes #137084