Skip to content

Don't ICE in is_trivially_sized when encountering late-bound self ty #114876

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

compiler-errors
Copy link
Member

We can see a bound ty var here:

fn try_fast_path(
tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
// Proving Sized, very often on "obviously sized" types like
// `&T`, accounts for about 60% percentage of the predicates
// we have to prove. No need to canonicalize and all that for
// such cases.
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_ref)) =
key.value.predicate.kind().skip_binder()
{
if let Some(sized_def_id) = tcx.lang_items().sized_trait() {
if trait_ref.def_id() == sized_def_id {
if trait_ref.self_ty().is_trivially_sized(tcx) {
return Some(());
}
}
}
}
None
}

Fixes #114872

@rustbot
Copy link
Collaborator

rustbot commented Aug 16, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 16, 2023
@wesleywiser
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 16, 2023

📌 Commit c31aedf has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 17, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#112751 (rustdoc: Fixes with --test-run-directory and relative paths.)
 - rust-lang#114749 (Update `mpsc::Sender` doc to reflect that it implements `Sync`)
 - rust-lang#114876 (Don't ICE in `is_trivially_sized` when encountering late-bound self ty)
 - rust-lang#114881 (clarify CStr lack of layout guarnatees)
 - rust-lang#114921 (Remove Folyd from librustdoc static files)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 084c87d into rust-lang:master Aug 17, 2023
@rustbot rustbot added this to the 1.73.0 milestone Aug 17, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: 'is_trivially_sized' applied to unexpected type
4 participants