]> git.lizzy.rs Git - rust.git/commit
Workaround ODR violations in enum debuginfo
authorBjörn Steinbrink <bsteinbr@gmail.com>
Wed, 29 Jul 2015 11:53:59 +0000 (13:53 +0200)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Wed, 12 Aug 2015 05:42:31 +0000 (07:42 +0200)
commitd17d2dd48e7f6baabfdeeef567b79013caec1a01
treeee8355b28cc3d2ca152ddaf193e09f21b748d74c
parent58b0aa5e420643d454cf141263652a8bcb6a35f1
Workaround ODR violations in enum debuginfo

When using a generic enum type that was defined in an external crate,
our debuginfo currently claims that the concrete type (e.g. Option<i32>)
was defined in the current crate, where it was first used.

This means that if there are multiple crates that all use, for example,
Option<i32> values, they'll have conflicting debuginfo, each crate
claiming to have defined that type. This doesn't cause problems in
regular builds, but with LTO enabled, LLVM complains because it tries to
merge the debuginfo for those types and sees the ODR violations.

Since I couldn't find a way to get the file info for the external crate
that actually defined the enum, I'm working around the issue by using
"<unknown>" as the file for enum types. We'll want to re-visit and fix
this later, but this at least this fixes the ICE. And with the file
being unknown instead of wrong, the debuginfo isn't really worse than
before either.

Fixes #26447
src/librustc_trans/trans/debuginfo/metadata.rs