@@ -16,7 +16,7 @@ use rustc_macros::{Decodable, Encodable, PrintAttribute, StableHash};
1616use rustc_span:: def_id:: DefId ;
1717use rustc_span:: hygiene:: Transparency ;
1818use rustc_span:: { ErrorGuaranteed , Ident , Span , Symbol } ;
19- use rustc_structures:: { CrateType , Limit , SanitizerSet } ;
19+ use rustc_structures:: { CrateType , Limit , NativeLibKind , SanitizerSet } ;
2020use thin_vec:: ThinVec ;
2121
2222pub use crate :: canonical_symbols:: { CanonicalSymbol , CanonicalSymbols } ;
@@ -371,76 +371,6 @@ pub enum PeImportNameType {
371371 Undecorated ,
372372}
373373
374- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
375- #[ derive( Encodable , Decodable , PrintAttribute ) ]
376- #[ derive( StableHash ) ]
377- pub enum NativeLibKind {
378- /// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC)
379- Static {
380- /// Whether to bundle objects from static library into produced rlib
381- bundle : Option < bool > ,
382- /// Whether to link static library without throwing any object files away
383- whole_archive : Option < bool > ,
384- /// Whether to export c static library symbols
385- export_symbols : Option < bool > ,
386- } ,
387- /// Dynamic library (e.g. `libfoo.so` on Linux)
388- /// or an import library corresponding to a dynamic library (e.g. `foo.lib` on Windows/MSVC).
389- Dylib {
390- /// Whether the dynamic library will be linked only if it satisfies some undefined symbols
391- as_needed : Option < bool > ,
392- } ,
393- /// Dynamic library (e.g. `foo.dll` on Windows) without a corresponding import library.
394- /// On Linux, it refers to a generated shared library stub.
395- RawDylib {
396- /// Whether the dynamic library will be linked only if it satisfies some undefined symbols
397- as_needed : Option < bool > ,
398- } ,
399- /// A macOS-specific kind of dynamic libraries.
400- Framework {
401- /// Whether the framework will be linked only if it satisfies some undefined symbols
402- as_needed : Option < bool > ,
403- } ,
404- /// Argument which is passed to linker, relative order with libraries and other arguments
405- /// is preserved
406- LinkArg ,
407-
408- /// Module imported from WebAssembly
409- WasmImportModule ,
410-
411- /// The library kind wasn't specified, `Dylib` is currently used as a default.
412- Unspecified ,
413- }
414-
415- impl NativeLibKind {
416- pub fn has_modifiers ( & self ) -> bool {
417- match self {
418- NativeLibKind :: Static { bundle, whole_archive, export_symbols } => {
419- bundle. is_some ( ) || whole_archive. is_some ( ) || export_symbols. is_some ( )
420- }
421- NativeLibKind :: Dylib { as_needed }
422- | NativeLibKind :: Framework { as_needed }
423- | NativeLibKind :: RawDylib { as_needed } => as_needed. is_some ( ) ,
424- NativeLibKind :: Unspecified
425- | NativeLibKind :: LinkArg
426- | NativeLibKind :: WasmImportModule => false ,
427- }
428- }
429-
430- pub fn is_statically_included ( & self ) -> bool {
431- matches ! ( self , NativeLibKind :: Static { .. } )
432- }
433-
434- pub fn is_dllimport ( & self ) -> bool {
435- matches ! (
436- self ,
437- NativeLibKind :: Dylib { .. }
438- | NativeLibKind :: RawDylib { .. }
439- | NativeLibKind :: Unspecified
440- )
441- }
442- }
443-
444374#[ derive( Debug , Encodable , Decodable , Clone , StableHash , PrintAttribute ) ]
445375pub struct LinkEntry {
446376 pub span : Span ,
0 commit comments