-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support rmeta inputs for --crate-type=bin --emit=obj
This already works for --emit=metadata, but is possible anytime we're not linking. Tests: `rmeta_bin` checks we're not changing --emit=link (already passes) `rmeta_bin-pass` tests the new behavior for --emit=obj (would fail today) and also --emit=metadata which isn't changing
- Loading branch information
1 parent
91a0e16
commit 607987e
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ compile-flags: --emit=obj,metadata --crate-type=bin | ||
//@ aux-build:rmeta-meta.rs | ||
//@ no-prefer-dynamic | ||
//@ build-pass | ||
|
||
// Check that building a metadata bin crate works with a dependent, metadata | ||
// crate if linking is not requested. | ||
|
||
extern crate rmeta_meta; | ||
use rmeta_meta::Foo; | ||
|
||
pub fn main() { | ||
let _ = Foo { field: 42 }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ build-fail | ||
//@ compile-flags: --crate-type=bin | ||
//@ aux-build:rmeta-meta.rs | ||
//@ no-prefer-dynamic | ||
//@ error-pattern: crate `rmeta_meta` required to be available in rlib format, but was not found | ||
|
||
// Check that building a bin crate fails if a dependent crate is metadata-only. | ||
|
||
extern crate rmeta_meta; | ||
use rmeta_meta::Foo; | ||
|
||
fn main() { | ||
let _ = Foo { field: 42 }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
error: crate `rmeta_meta` required to be available in rlib format, but was not found in this form | ||
|
||
error: aborting due to 1 previous error | ||
|