rust/tests/ui/rmeta/rmeta_bin.rs
Sam McCall 607987e3e2 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
2025-03-07 18:33:05 +01:00

15 lines
372 B
Rust

//@ 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 };
}