diff --git a/.travis.yml b/.travis.yml index 0eb700e4e3a31..c7cf94f870db9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -127,9 +127,9 @@ matrix: env: global: - SCCACHE_BUCKET=rust-lang-ci-sccache - - AWS_ACCESS_KEY_ID=AKIAIMX7VLAS3PZAVLUQ + - AWS_ACCESS_KEY_ID=AKIAJF6INZZRJHKQ3KZA # AWS_SECRET_ACCESS_KEY=... - - secure: "Pixhh0hXDqGCdOyLtGFjli3J2AtDWIpyb2btIrLe956nCBDRutRoMm6rv5DI9sFZN07Mms7VzNNvhc9wCW1y63JAm414d2Co7Ob8kWMZlz9l9t7ACHuktUiis8yr+S4Quq1Vqd6pqi7pf2J++UxC8R/uLeqVrubzr6+X7AbmEFE=" + - secure: "iz4GukJUJ9XVTivaTLMXS/5hab7d7C4aQi60Ef+0sw3DnOmntZ+/1SFFC++owccV8h0Ccw21cmmt0IGFHdlhROwq85AgLl3bXMnN/c9MISbaQvCZqRd2qnDxcYf/MF7+s1hqE7f6IxXebSbNI0hEDYHeyPY4g6wTF+yRWsD1qtc6JNLlOV979wxoCeqHL0gwKhH/5RI9lcmM7yohxSTQDS4XcAWDZFsrynocF8eialig5KAu4lqFCJIMTFpZsSLCUvosMVAolvmaiokEsRWwrhTmd/t/8hbm3OmnueNKbKuNpSHN9vDjO0vrLXFz6T4UOIPQSGr88rSHLUeKmpgbHfSfE5DiEGAoQ5aMhgnX1xo83TuvgyGHP3ifwgzXmsis3+HMluGd+6ek4rzHdxNevYbibl6jpHAeldu3borfiYQr9EHCrahMBSa22Z9YTarYStk5uo3kwalTkwMevFP3MlOLB0Q9s0LMLAJIZJ8pLh+2gzmwt2FRCR8S7fgR+9+44PKmtftA4AE3meey/gl1bes5KPPUhomeheVRVplx8PhU6boaAOCCar07s1d17AqEtouHgC3jd5TxMAQFq/MSUbkfOlefwVuDsfZvaOk0LnZbjZuwAN6ba2y8bK3AwhUfOftEAp/9f3RZjz3hjb1QKoZyQVin/XRte2UzgPjLRew=" before_install: # If we are building a pull request, do the build if $ALLOW_PR == 1 @@ -262,9 +262,9 @@ deploy: upload_dir: rustc-builds acl: public_read region: us-east-1 - access_key_id: AKIAIPQVNYF2T3DTYIWQ + access_key_id: AKIAJN7ZQ3AGSFJQSDFQ secret_access_key: - secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4=" + secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0=" on: branch: auto condition: $DEPLOY = 1 @@ -276,9 +276,9 @@ deploy: upload_dir: rustc-builds-try acl: public_read region: us-east-1 - access_key_id: AKIAIPQVNYF2T3DTYIWQ + access_key_id: AKIAJN7ZQ3AGSFJQSDFQ secret_access_key: - secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4=" + secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0=" on: branch: try condition: $DEPLOY = 1 && $ALLOW_TRY = 1 @@ -292,9 +292,9 @@ deploy: upload_dir: rustc-builds-alt acl: public_read region: us-east-1 - access_key_id: AKIAIPQVNYF2T3DTYIWQ + access_key_id: AKIAJN7ZQ3AGSFJQSDFQ secret_access_key: - secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4=" + secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0=" on: branch: auto condition: $DEPLOY_ALT = 1 diff --git a/appveyor.yml b/appveyor.yml index f548d6694c80f..d70fb84bebcb1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ environment: SCCACHE_BUCKET: rust-lang-ci-sccache - AWS_ACCESS_KEY_ID: AKIAIMX7VLAS3PZAVLUQ + AWS_ACCESS_KEY_ID: AKIAJF6INZZRJHKQ3KZA AWS_SECRET_ACCESS_KEY: - secure: 1UkmbiDd15tWtYbMm5O2Uqm0b0Ur8v1MoSlydxl4ojcroPeerRMlUges0l57py8c + secure: 55JOuLG3N+q12QH88ZYLfSXV1ocEi6At1leBKHwRsESgQ4mWCNse49J/x+9WUJFP SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c # By default schannel checks revocation of certificates unlike some other SSL @@ -185,9 +185,9 @@ before_deploy: deploy: - provider: S3 skip_cleanup: true - access_key_id: AKIAIPQVNYF2T3DTYIWQ + access_key_id: AKIAJN7ZQ3AGSFJQSDFQ secret_access_key: - secure: +11jsUNFTQ9dq5Ad1i2+PeUJaXluFJ0zIJAXESE1dFT3Kdjku4/eDdgyjgsB6GnV + secure: rEWqEEumXgn/lvc+2vhUjUHXQYU2p7ayT0BVtzsb2oX1cUpmn5TiQOK+v2yQsQzm bucket: rust-lang-ci set_public: true region: us-east-1 @@ -202,9 +202,9 @@ deploy: # different upload directory and a slightly different trigger - provider: S3 skip_cleanup: true - access_key_id: AKIAIPQVNYF2T3DTYIWQ + access_key_id: AKIAJN7ZQ3AGSFJQSDFQ secret_access_key: - secure: +11jsUNFTQ9dq5Ad1i2+PeUJaXluFJ0zIJAXESE1dFT3Kdjku4/eDdgyjgsB6GnV + secure: rEWqEEumXgn/lvc+2vhUjUHXQYU2p7ayT0BVtzsb2oX1cUpmn5TiQOK+v2yQsQzm bucket: rust-lang-ci set_public: true region: us-east-1 diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 2cbae083fc464..de9dd1e1be412 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -367,7 +367,7 @@ impl Step for Openssl { if !ok { panic!("failed to download openssl source") } - let mut shasum = if target.contains("apple") { + let mut shasum = if target.contains("apple") || build.build.contains("netbsd") { let mut cmd = Command::new("shasum"); cmd.arg("-a").arg("256"); cmd @@ -387,9 +387,10 @@ impl Step for Openssl { let dst = build.openssl_install_dir(target).unwrap(); drop(fs::remove_dir_all(&obj)); drop(fs::remove_dir_all(&dst)); - build.run(Command::new("tar").arg("xf").arg(&tarball).current_dir(&out)); + build.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out)); - let mut configure = Command::new(obj.join("Configure")); + let mut configure = Command::new("perl"); + configure.arg(obj.join("Configure")); configure.arg(format!("--prefix={}", dst.display())); configure.arg("no-dso"); configure.arg("no-ssl2"); diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 1defe308713a7..599d79104c3b0 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -221,7 +221,7 @@ mod platform { } } - #[cfg(any(target_os = "android", target_os = "redox"))] + #[cfg(any(target_os = "android", target_os = "redox", target_os = "solaris"))] #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { // On android we currently target API level 9 which unfortunately @@ -244,7 +244,7 @@ mod platform { libc::memalign(layout.align(), layout.size()) as *mut u8 } - #[cfg(not(any(target_os = "android", target_os = "redox")))] + #[cfg(not(any(target_os = "android", target_os = "redox", target_os = "solaris")))] #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { let mut out = ptr::null_mut(); diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins index 6b9281d2b2f0e..38ffaf97aa418 160000 --- a/src/libcompiler_builtins +++ b/src/libcompiler_builtins @@ -1 +1 @@ -Subproject commit 6b9281d2b2f0ebb94838814b1e8ace2de4b7035b +Subproject commit 38ffaf97aa418cc369ca0197a72a0b927cc0f622 diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 83f8f9988f448..d64c984ea7d28 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -17,18 +17,11 @@ macro_rules! panic { panic!("explicit panic") ); ($msg:expr) => ({ - static _MSG_FILE_LINE_COL: (&'static str, &'static str, u32, u32) = - ($msg, file!(), line!(), __rust_unstable_column!()); - $crate::panicking::panic(&_MSG_FILE_LINE_COL) + $crate::panicking::panic(&($msg, file!(), line!(), __rust_unstable_column!())) }); ($fmt:expr, $($arg:tt)*) => ({ - // The leading _'s are to avoid dead code warnings if this is - // used inside a dead function. Just `#[allow(dead_code)]` is - // insufficient, since the user may have - // `#[forbid(dead_code)]` and which cannot be overridden. - static _MSG_FILE_LINE_COL: (&'static str, u32, u32) = - (file!(), line!(), __rust_unstable_column!()); - $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_MSG_FILE_LINE_COL) + $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), + &(file!(), line!(), __rust_unstable_column!())) }); } diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 837ab4fd4a3cc..8d9a72723f0d8 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -112,26 +112,51 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return Vec::new(); } - match ty { - // If the global prefer_dynamic switch is turned off, first attempt - // static linkage (this can fail). - config::CrateTypeExecutable if !sess.opts.cg.prefer_dynamic => { - if let Some(v) = attempt_static(tcx) { - return v; - } - } + let preferred_linkage = match ty { + // cdylibs must have all static dependencies. + config::CrateTypeCdylib => Linkage::Static, + + // Generating a dylib without `-C prefer-dynamic` means that we're going + // to try to eagerly statically link all dependencies. This is normally + // done for end-product dylibs, not intermediate products. + config::CrateTypeDylib if !sess.opts.cg.prefer_dynamic => Linkage::Static, + config::CrateTypeDylib => Linkage::Dynamic, + + // If the global prefer_dynamic switch is turned off, or the final + // executable will be statically linked, prefer static crate linkage. + config::CrateTypeExecutable if !sess.opts.cg.prefer_dynamic || + sess.crt_static() => Linkage::Static, + config::CrateTypeExecutable => Linkage::Dynamic, + + // proc-macro crates are required to be dylibs, and they're currently + // required to link to libsyntax as well. + config::CrateTypeProcMacro => Linkage::Dynamic, // No linkage happens with rlibs, we just needed the metadata (which we // got long ago), so don't bother with anything. - config::CrateTypeRlib => return Vec::new(), - - // Staticlibs and cdylibs must have all static dependencies. If any fail - // to be found, we generate some nice pretty errors. - config::CrateTypeStaticlib | - config::CrateTypeCdylib => { - if let Some(v) = attempt_static(tcx) { - return v; - } + config::CrateTypeRlib => Linkage::NotLinked, + + // staticlibs must have all static dependencies. + config::CrateTypeStaticlib => Linkage::Static, + }; + + if preferred_linkage == Linkage::NotLinked { + // If the crate is not linked, there are no link-time dependencies. + return Vec::new(); + } + + if preferred_linkage == Linkage::Static { + // Attempt static linkage first. For dylibs and executables, we may be + // able to retry below with dynamic linkage. + if let Some(v) = attempt_static(tcx) { + return v; + } + + // Staticlibs, cdylibs, and static executables must have all static + // dependencies. If any are not found, generate some nice pretty errors. + if ty == config::CrateTypeCdylib || ty == config::CrateTypeStaticlib || + (ty == config::CrateTypeExecutable && sess.crt_static() && + !sess.target.target.options.crt_static_allows_dylibs) { for cnum in sess.cstore.crates() { if sess.cstore.dep_kind(cnum).macros_only() { continue } let src = sess.cstore.used_crate_source(cnum); @@ -141,23 +166,6 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } return Vec::new(); } - - // Generating a dylib without `-C prefer-dynamic` means that we're going - // to try to eagerly statically link all dependencies. This is normally - // done for end-product dylibs, not intermediate products. - config::CrateTypeDylib if !sess.opts.cg.prefer_dynamic => { - if let Some(v) = attempt_static(tcx) { - return v; - } - } - - // Everything else falls through below. This will happen either with the - // `-C prefer-dynamic` or because we're a proc-macro crate. Note that - // proc-macro crates are required to be dylibs, and they're currently - // required to link to libsyntax as well. - config::CrateTypeExecutable | - config::CrateTypeDylib | - config::CrateTypeProcMacro => {}, } let mut formats = FxHashMap(); diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 417083c4ff801..d6477f2babf76 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -29,7 +29,6 @@ use syntax::ast; use syntax_pos::Span; use std::fmt; -use std::u32; pub struct ElaborateDrops; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3f210ea1737b7..585b69cd387cb 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1554,9 +1554,12 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let repr_type_ty = def.repr.discr_type().to_ty(tcx); if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 { - if !tcx.sess.features.borrow().i128_type { + if !tcx.sess.features.borrow().repr128 { emit_feature_err(&tcx.sess.parse_sess, - "i128_type", sp, GateIssue::Language, "128-bit type is unstable"); + "repr128", + sp, + GateIssue::Language, + "repr with 128-bit type is unstable"); } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 46bb119cf9c9d..227cdb8645533 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -660,9 +660,13 @@ fn render_difference(diff: &html_diff::Difference) { elem.path, elem.element_name, elem_attributes, opposite_elem_attributes); } html_diff::Difference::NodeText { ref elem, ref elem_text, ref opposite_elem_text, .. } => { - let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text); - println!(" {} Text differs:\n expected: `{}`\n found: `{}`", - elem.path, s1, s2); + if elem_text.split("\n") + .zip(opposite_elem_text.split("\n")) + .any(|(a, b)| a.trim() != b.trim()) { + let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text); + println!(" {} Text differs:\n expected: `{}`\n found: `{}`", + elem.path, s1, s2); + } } html_diff::Difference::NotPresent { ref elem, ref opposite_elem } => { if let Some(ref elem) = *elem { diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 7392a153e3b87..7992aefcb4203 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -545,7 +545,7 @@ impl fmt::Debug for CStr { #[stable(feature = "cstr_default", since = "1.10.0")] impl<'a> Default for &'a CStr { fn default() -> &'a CStr { - static SLICE: &'static [c_char] = &[0]; + const SLICE: &'static [c_char] = &[0]; unsafe { CStr::from_ptr(SLICE.as_ptr()) } } } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 72d561fae3bd9..8089671f309d2 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -66,23 +66,11 @@ macro_rules! panic { panic!("explicit panic") }); ($msg:expr) => ({ - $crate::rt::begin_panic($msg, { - // static requires less code at runtime, more constant data - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), - __rust_unstable_column!()); - &_FILE_LINE_COL - }) + $crate::rt::begin_panic($msg, &(file!(), line!(), __rust_unstable_column!())) }); ($fmt:expr, $($arg:tt)+) => ({ - $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+), { - // The leading _'s are to avoid dead code warnings if this is - // used inside a dead function. Just `#[allow(dead_code)]` is - // insufficient, since the user may have - // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), - __rust_unstable_column!()); - &_FILE_LINE_COL - }) + $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+), + &(file!(), line!(), __rust_unstable_column!())) }); } diff --git a/src/libstd/sys/unix/backtrace/printing/dladdr.rs b/src/libstd/sys/unix/backtrace/printing/dladdr.rs index 05a071a797838..2c0cda2c8f1cc 100644 --- a/src/libstd/sys/unix/backtrace/printing/dladdr.rs +++ b/src/libstd/sys/unix/backtrace/printing/dladdr.rs @@ -22,7 +22,8 @@ pub fn resolve_symname(frame: Frame, { unsafe { let mut info: Dl_info = intrinsics::init(); - let symname = if dladdr(frame.exact_position, &mut info) == 0 { + let symname = if dladdr(frame.exact_position, &mut info) == 0 || + info.dli_sname.is_null() { None } else { CStr::from_ptr(info.dli_sname).to_str().ok() diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 4ee8132f55cee..a53c76a333a99 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -31,6 +31,10 @@ use mem; /// within a thread, and values that implement [`Drop`] get destructed when a /// thread exits. Some caveats apply, which are explained below. /// +/// A `LocalKey`'s initializer cannot recursively depend on itself, and using +/// a `LocalKey` in this way will cause the initializer to infinitely recurse +/// on the first call to `with`. +/// /// # Examples /// /// ``` diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 54d41a030fd77..e9e9c6bf4eaca 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -312,6 +312,9 @@ declare_features! ( // The `i128` type (active, i128_type, "1.16.0", Some(35118)), + // The `repr(i128)` annotation for enums + (active, repr128, "1.16.0", Some(35118)), + // The `unadjusted` ABI. Perma unstable. (active, abi_unadjusted, "1.16.0", None), diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 3e20bc481bde8..63c533df198d0 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -19,7 +19,7 @@ use syntax::ext::base; use syntax::ext::build::AstBuilder; use syntax::parse::token; use syntax::ptr::P; -use syntax::symbol::{Symbol, keywords}; +use syntax::symbol::Symbol; use syntax_pos::{Span, DUMMY_SP}; use syntax::tokenstream; @@ -501,32 +501,6 @@ impl<'a, 'b> Context<'a, 'b> { } } - fn static_array(ecx: &mut ExtCtxt, - name: &str, - piece_ty: P, - pieces: Vec>) - -> P { - let sp = piece_ty.span; - let ty = ecx.ty_rptr(sp, - ecx.ty(sp, ast::TyKind::Slice(piece_ty)), - Some(ecx.lifetime(sp, keywords::StaticLifetime.ident())), - ast::Mutability::Immutable); - let slice = ecx.expr_vec_slice(sp, pieces); - // static instead of const to speed up codegen by not requiring this to be inlined - let st = ast::ItemKind::Static(ty, ast::Mutability::Immutable, slice); - - let name = ecx.ident_of(name); - let item = ecx.item(sp, name, vec![], st); - let stmt = ast::Stmt { - id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Item(item), - span: sp, - }; - - // Wrap the declaration in a block so that it forms a single expression. - ecx.expr_block(ecx.block(sp, vec![stmt, ecx.stmt_expr(ecx.expr_ident(sp, name))])) - } - /// Actually builds the expression which the format_args! block will be /// expanded to fn into_expr(self) -> P { @@ -537,12 +511,7 @@ impl<'a, 'b> Context<'a, 'b> { // First, build up the static array which will become our precompiled // format "string" - let static_lifetime = self.ecx.lifetime(self.fmtsp, keywords::StaticLifetime.ident()); - let piece_ty = self.ecx.ty_rptr(self.fmtsp, - self.ecx.ty_ident(self.fmtsp, self.ecx.ident_of("str")), - Some(static_lifetime), - ast::Mutability::Immutable); - let pieces = Context::static_array(self.ecx, "__STATIC_FMTSTR", piece_ty, self.str_pieces); + let pieces = self.ecx.expr_vec_slice(self.fmtsp, self.str_pieces); // Before consuming the expressions, we have to remember spans for // count arguments as they are now generated separate from other @@ -623,9 +592,7 @@ impl<'a, 'b> Context<'a, 'b> { } else { // Build up the static array which will store our precompiled // nonstandard placeholders, if there are any. - let piece_ty = self.ecx - .ty_path(self.ecx.path_global(self.macsp, Context::rtpath(self.ecx, "Argument"))); - let fmt = Context::static_array(self.ecx, "__STATIC_FMTARGS", piece_ty, self.pieces); + let fmt = self.ecx.expr_vec_slice(self.macsp, self.pieces); ("new_v1_formatted", vec![pieces, args_slice, fmt]) }; diff --git a/src/test/compile-fail/feature-gate-repr128.rs b/src/test/compile-fail/feature-gate-repr128.rs new file mode 100644 index 0000000000000..96fffa6cdd0dc --- /dev/null +++ b/src/test/compile-fail/feature-gate-repr128.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(u128)] +enum A { //~ ERROR repr with 128-bit type is unstable + //~| HELP: add #![feature(repr128)] + A(u64) +} + +fn main() {}