-
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
Fix ICEs related to Deref<Target=[T; N]>
on newtypes
#92640
Fix ICEs related to Deref<Target=[T; N]>
on newtypes
#92640
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
r? @lcnr alright, so 1. looks correct to me, have to take some time to fully grep the second issue but it seems preferable to implement |
52c64df
to
2de9a50
Compare
i personally would prefer you trying to implement the better fix first, we could merge the first change of this PR by itself. |
Closing in favor of the better solution, #92652 |
Reviving this PR :-) |
2de9a50
to
e24390a
Compare
1 nit, after that r=me, thanks 👍 |
@@ -182,10 +182,15 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { | |||
target, | |||
}); | |||
|
|||
if let Some(unsize_target) = unsize { | |||
if *unsize { |
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.
can you change l168 from match &pick.autoref_or_ptr_adjustment {
to match pick.autoref_or_ptr_adjustment {
?
e24390a
to
7bf0cb7
Compare
|
||
let mut target = | ||
self.structurally_resolved_type(autoderef.span(), autoderef.final_ty(false)); |
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.
afaict autoderef.final_ty
is identical to the type returned by autoderef.nth
, so this was a bit redundant
@bors r+ rollup |
@bors r=lcnr rollup |
📌 Commit 7bf0cb7 has been approved by |
…askrgr Rollup of 14 pull requests Successful merges: - rust-lang#92629 (Pick themes on settings page, not every page) - rust-lang#92640 (Fix ICEs related to `Deref<Target=[T; N]>` on newtypes) - rust-lang#92701 (Add some more attribute validation) - rust-lang#92803 (Hide mobile sidebar on some clicks) - rust-lang#92830 (Rustdoc style cleanups) - rust-lang#92866 ("Does exists" typos fix) - rust-lang#92870 (add `rustc_diagnostic_item` attribute to `AtomicBool` type) - rust-lang#92914 (htmldocck: Add support for `/text()` in ``@snapshot`)` - rust-lang#92923 (Abstract the pretty printer's ringbuffer to be infinitely sized) - rust-lang#92946 (Exclude llvm-libunwind from the self-contained set on s390x-musl targets) - rust-lang#92947 (rustdoc: Use `intersperse` in a `visit_path` function) - rust-lang#92997 (Add `~const` bound test for negative impls) - rust-lang#93004 (update codegen test for LLVM 14) - rust-lang#93016 (Stabilize vec_spare_capacity) Failed merges: - rust-lang#92924 (Delete pretty printer tracing) r? `@ghost` `@rustbot` modify labels: rollup
Stash a const infer's type into the canonical var during canonicalization, so we can recreate the fresh const infer with that same type.
For example, given
[T; _]
we know_
is ausize
. If we go from infer => canonical => infer, we shouldn't forget that variable is a usize.Fixes Inferring const parameters to wrapper type causes rustc to panic. #92626
Fixes ICE on Rust 1.51 with min const generics and Deref<Target=[T; N]> #83704
Don't stash the autoderef'd slice type that we get from method lookup, but instead recreate it during method confirmation. We need to do this because the type we receive back after picking the method references a type variable that does not exist after probing is done.
Fixes Calling slice method on newtype wrapper that implements
Deref<Target=[_; 1]>
causes ICE #92637... A better solution for the second issue would be to actually properly implement
Deref
for[T; N]
instead of fixing this autoderef hack to stop leaking inference variables. But I actually looked into this, and there are many complications with const impls.