about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-07 09:21:30 +0000
committerbors <bors@rust-lang.org>2019-10-07 09:21:30 +0000
commite3cb9ea15a2082f39d4d4f10a22e779701dd0d64 (patch)
treea5aec59e5cfcd213687e6e281995e4727a5a81d4 /src/librustc
parentf92f3c4bc67c003fe66afaf5d772731c074d7459 (diff)
parent68a4cfc242ef542e18bafe6046eb6e3c9cbd71dd (diff)
downloadrust-e3cb9ea15a2082f39d4d4f10a22e779701dd0d64.tar.gz
rust-e3cb9ea15a2082f39d4d4f10a22e779701dd0d64.zip
Auto merge of #65178 - Centril:rollup-ep1zztj, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #63948 (Add feature gate for raw_dylib.)
 - #65137 (remove event that causes panics in measureme tools)
 - #65164 (Add long error explanation for E0566)
 - #65173 (Update reference)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/error_codes.rs22
-rw-r--r--src/librustc/hir/mod.rs6
-rw-r--r--src/librustc/middle/cstore.rs2
3 files changed, 29 insertions, 1 deletions
diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs
index 66c51000066..502172db91c 100644
--- a/src/librustc/error_codes.rs
+++ b/src/librustc/error_codes.rs
@@ -1700,6 +1700,27 @@ To understand better how closures work in Rust, read:
 https://doc.rust-lang.org/book/ch13-01-closures.html
 "##,
 
+E0566: r##"
+Conflicting representation hints have been used on a same item.
+
+Erroneous code example:
+
+```
+#[repr(u32, u64)] // warning!
+enum Repr { A }
+```
+
+In most cases (if not all), using just one representation hint is more than
+enough. If you want to have a representation hint depending on the current
+architecture, use `cfg_attr`. Example:
+
+```
+#[cfg_attr(linux, repr(u32))]
+#[cfg_attr(not(linux), repr(u64))]
+enum Repr { A }
+```
+"##,
+
 E0580: r##"
 The `main` function was incorrectly declared.
 
@@ -2097,7 +2118,6 @@ rejected in your own crates.
     E0490, // a value of type `..` is borrowed for too long
     E0495, // cannot infer an appropriate lifetime due to conflicting
            // requirements
-    E0566, // conflicting representation hints
     E0623, // lifetime mismatch where both parameters are anonymous regions
     E0628, // generators cannot have explicit parameters
     E0631, // type mismatch in closure arguments
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index d5892794d64..30b05036688 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -2669,6 +2669,11 @@ pub struct CodegenFnAttrs {
     /// probably isn't set when this is set, this is for foreign items while
     /// `#[export_name]` is for Rust-defined functions.
     pub link_name: Option<Symbol>,
+    /// The `#[link_ordinal = "..."]` attribute, indicating an ordinal an
+    /// imported function has in the dynamic library. Note that this must not
+    /// be set when `link_name` is set. This is for foreign items with the
+    /// "raw-dylib" kind.
+    pub link_ordinal: Option<usize>,
     /// The `#[target_feature(enable = "...")]` attribute and the enabled
     /// features (only enabled features are supported right now).
     pub target_features: Vec<Symbol>,
@@ -2728,6 +2733,7 @@ impl CodegenFnAttrs {
             optimize: OptimizeAttr::None,
             export_name: None,
             link_name: None,
+            link_ordinal: None,
             target_features: vec![],
             linkage: None,
             link_section: None,
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index 510787998ad..065959ed09f 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -96,6 +96,8 @@ pub enum NativeLibraryKind {
     NativeStaticNobundle,
     /// macOS-specific
     NativeFramework,
+    /// Windows dynamic library without import library.
+    NativeRawDylib,
     /// default way to specify a dynamic library
     NativeUnknown,
 }