Skip to content

rust1: internal compiler error: in visit_generic_predicates, at rust/privacy/rust-reachability.cc:56 #1128

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

Closed
Tracked by #1247
bjorn3 opened this issue Apr 18, 2022 · 0 comments · Fixed by #1190
Closed
Tracked by #1247
Assignees
Labels

Comments

@bjorn3
Copy link

bjorn3 commented Apr 18, 2022

I tried this code:

pub trait Hasher {
    fn write(&mut self, bytes: &[u8]);
    fn write_u8(&mut self, i: u8) {
        self.write(&[i])
    }
}

I expected to see this happen: It works.

Instead, this happened:

rust1: internal compiler error: in visit_generic_predicates, at rust/privacy/rust-reachability.cc:56
0x204e319 internal_error(char const*, ...)
	???:0
0x8027ef fancy_abort(char const*, int, char const*)
	???:0
0x9ceb45 Rust::Privacy::Resolver::resolve(Rust::HIR::Crate&)
	???:0
0x8c8927 Rust::Session::parse_file(char const*)
	???:0
0x8c9548 Rust::Session::parse_files(int, char const**)
	???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Meta

  • What version of Rust GCC were you using, git sha if possible.
@bjorn3 bjorn3 added the bug label Apr 18, 2022
@CohenArthur CohenArthur self-assigned this Apr 19, 2022
@philberty philberty assigned philberty and unassigned CohenArthur Apr 28, 2022
@philberty philberty added this to the Imports and visibility milestone Apr 28, 2022
philberty added a commit that referenced this issue Apr 28, 2022
During type-resolution we resolve/type-check traits in a query based way.
So when we reference a trait we look it up as required but this left a case
for the privacy pass where the type-context information on the trait when
the trait was not used meant there was no type-checking performed on the
trait.

This patch adds an interface to directly resolve the trait when as we
iterate the crate so we do it as required. There is already code in the
trait resolver to check if we have already type-resolved this trait.

Fixes #1128
bors bot added a commit that referenced this issue Apr 28, 2022
1190: Fix ICE in reachability class and refactor associated types code r=philberty a=philberty

There are several fixes going on to solve these issues which overlap with one
another so it seemed best to pack them within the same PR.

The main issue for #1128 was that we did not resolve a trait when it was unused
leading to us hitting the ICE in the privacy pass. Since the type check context was
empty for the trait since it was not resolved. To fix this we needed to refactor the
trait resolver to resolve the trait as part of iterating the crate. This resulted in some
regressions in the testsuite so this is why we need the the other commits. Which
required us to finally perform the refactor specified in #1105 to fix these.

Fixes #1105 #1128 #1132

1192: Add an assertion to avoid peeking when the stack is empty r=philberty a=philberty

This will ensure we get a proper ICE instead of memory corruption/segv.

Addresses #1130 

1193: Remove unused parameter caller from generating Call expressions r=philberty a=philberty

Within const context the fncontext maybe empty which in turn results in a
segv for generating const calls which will be evaluated by the const-expr
code anyway.

Addresses #1130


Co-authored-by: Philip Herron <[email protected]>
@bors bors bot closed this as completed in #1190 Apr 28, 2022
@philberty philberty mentioned this issue May 12, 2022
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment