Skip to content

Commit 67d99d9

Browse files
committed
Auto merge of #51035 - oli-obk:unsupported_crate_type, r=eddyb
Don't ICE if crate has no valid crate types left fixes #50993
2 parents 49a97ef + 0b1b26f commit 67d99d9

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/librustc_codegen_llvm/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ fn write_metadata<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>,
642642
config::CrateTypeDylib |
643643
config::CrateTypeProcMacro => MetadataKind::Compressed,
644644
}
645-
}).max().unwrap();
645+
}).max().unwrap_or(MetadataKind::None);
646646

647647
if kind == MetadataKind::None {
648648
return (metadata_llcx,

src/test/ui/issue-50993.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: --crate-type dylib --target thumbv7em-none-eabihf
12+
// compile-pass
13+
// error-pattern: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf`
14+
15+
#![feature(no_core)]
16+
17+
#![no_std]
18+
#![no_core]

src/test/ui/issue-50993.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
warning: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf`
2+

0 commit comments

Comments
 (0)