Skip to content

debuginfo: Add temporary workaround for #14871. #14909

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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,25 +232,37 @@ impl TypeMap {
// Adds a ty::t to metadata mapping to the TypeMap. The method will fail if the mapping already
// exists.
fn register_type_with_metadata(&mut self,
cx: &CrateContext,
_cx: &CrateContext,
type_: ty::t,
metadata: DIType) {
if !self.type_to_metadata.insert(ty::type_id(type_), metadata) {
cx.sess().bug(format!("Type metadata for ty::t '{}' is already in the TypeMap!",
ppaux::ty_to_str(cx.tcx(), type_)).as_slice());
// FIXME (#14871): Temporary workaround for #14871. This is a consistency check and for
// some types (e.g. slices in a recursion cycle) this check rightfully
// fails. However, there's no need to actually abort compilation as the
// inconsistency won't lead to corrupt state, due to LLVM metadata
// uniquing.
// A later, more thorough fix should remove the inconsistency altogether
// and also make this check non-fatal (we'll need a Session::bug_warn()
// method for that).
// For the time being, omit the check so people can compile their code
// with -g.
// cx.sess().bug(format!("Type metadata for ty::t '{}' is already in the TypeMap!",
// ppaux::ty_to_str(cx.tcx(), type_)).as_slice());
}
}

// Adds a UniqueTypeId to metadata mapping to the TypeMap. The method will fail if the mapping
// already exists.
fn register_unique_id_with_metadata(&mut self,
cx: &CrateContext,
_cx: &CrateContext,
unique_type_id: UniqueTypeId,
metadata: DIType) {
if !self.unique_id_to_metadata.insert(unique_type_id, metadata) {
let unique_type_id_str = self.get_unique_type_id_as_string(unique_type_id);
cx.sess().bug(format!("Type metadata for unique id '{}' is already in the TypeMap!",
unique_type_id_str.as_slice()).as_slice());
// FIXME (#14871): Temporary workaround for #14871. See comment above in
// register_type_with_metadata() for more information.
// let unique_type_id_str = self.get_unique_type_id_as_string(unique_type_id);
// cx.sess().bug(format!("Type metadata for unique id '{}' is already in the TypeMap!",
// unique_type_id_str.as_slice()).as_slice());
}
}

Expand Down