Skip to content

Don't ICE if crate has no valid crate types left #51035

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

Merged
merged 2 commits into from
May 26, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ fn write_metadata<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>,
config::CrateTypeDylib |
config::CrateTypeProcMacro => MetadataKind::Compressed,
}
}).max().unwrap();
}).max().unwrap_or(MetadataKind::None);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the source of the regression. Reaching this code is the source of the regression. But it seems a sensible change anyway imo.

If preferred I'll do a bisect and figure out where the real regression happened


if kind == MetadataKind::None {
return (metadata_llcx,
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/issue-50993.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: --crate-type dylib --target thumbv7em-none-eabihf
// compile-pass
// error-pattern: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf`

#![feature(no_core)]

#![no_std]
#![no_core]
2 changes: 2 additions & 0 deletions src/test/ui/issue-50993.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
warning: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf`