Backed out changeset f18666cc5793 (bug 1530028) for build bustages on a CLOSED TREE.
authorGurzau Raul <rgurzau@mozilla.com>
Mon, 25 Feb 2019 16:55:00 +0200
changeset 460892 2e90088a492ac891387ddba6b35e8b8dd91a2e71
parent 460891 f18666cc57932782a7cc4c090345ec9641de1e16
child 460893 29f06630e00e44ef1723813a38833dce52aea239
push id35613
push usernerli@mozilla.com
push dateTue, 26 Feb 2019 03:52:35 +0000
treeherdermozilla-central@faec87a80ed1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1530028
milestone67.0a1
backs outf18666cc57932782a7cc4c090345ec9641de1e16
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset f18666cc5793 (bug 1530028) for build bustages on a CLOSED TREE.
storage/variant/src/lib.rs
toolkit/components/kvstore/src/error.rs
toolkit/components/kvstore/src/owned_value.rs
toolkit/components/kvstore/src/task.rs
xpcom/idl-parser/xpidl/rust.py
xpcom/rust/gtest/xpcom/test.rs
xpcom/rust/moz_task/src/lib.rs
xpcom/rust/nserror/src/lib.rs
xpcom/rust/xpcom/src/base.rs
xpcom/rust/xpcom/src/reexports.rs
xpcom/rust/xpcom/src/refptr.rs
xpcom/rust/xpcom/src/statics.rs
xpcom/rust/xpcom/xpcom_macros/src/lib.rs
--- a/storage/variant/src/lib.rs
+++ b/storage/variant/src/lib.rs
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 extern crate libc;
 extern crate nserror;
 extern crate nsstring;
 extern crate xpcom;
 
 use libc::{c_double, int64_t, uint16_t};
-use nserror::{nsresult, NS_OK};
+use nserror::{nsresult, NsresultExt, NS_OK};
 use nsstring::{nsACString, nsAString, nsCString, nsString};
 use xpcom::{getter_addrefs, interfaces::nsIVariant, RefPtr};
 
 extern "C" {
     fn NS_GetDataType(variant: *const nsIVariant) -> uint16_t;
     fn NS_NewStorageNullVariant(result: *mut *const nsIVariant);
     fn NS_NewStorageBooleanVariant(value: bool, result: *mut *const nsIVariant);
     fn NS_NewStorageIntegerVariant(value: int64_t, result: *mut *const nsIVariant);
--- a/toolkit/components/kvstore/src/error.rs
+++ b/toolkit/components/kvstore/src/error.rs
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use libc::uint16_t;
 use nserror::{
-    nsresult, NS_ERROR_FAILURE, NS_ERROR_NOT_IMPLEMENTED, NS_ERROR_NO_INTERFACE,
+    nsresult, NsresultExt, NS_ERROR_FAILURE, NS_ERROR_NOT_IMPLEMENTED, NS_ERROR_NO_INTERFACE,
     NS_ERROR_NULL_POINTER, NS_ERROR_UNEXPECTED,
 };
 use nsstring::nsCString;
 use rkv::StoreError;
 use std::{str::Utf8Error, string::FromUtf16Error, sync::PoisonError};
 
 #[derive(Debug, Fail)]
 pub enum KeyValueError {
--- a/toolkit/components/kvstore/src/owned_value.rs
+++ b/toolkit/components/kvstore/src/owned_value.rs
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use error::KeyValueError;
 use libc::int32_t;
+use nserror::NsresultExt;
 use nsstring::nsString;
 use rkv::OwnedValue;
 use storage_variant::{
     GetDataType, VariantType, DATA_TYPE_BOOL, DATA_TYPE_DOUBLE, DATA_TYPE_EMPTY, DATA_TYPE_INT32,
     DATA_TYPE_VOID, DATA_TYPE_WSTRING,
 };
 use xpcom::{interfaces::nsIVariant, RefPtr};
 
--- a/toolkit/components/kvstore/src/task.rs
+++ b/toolkit/components/kvstore/src/task.rs
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 extern crate xpcom;
 
 use crossbeam_utils::atomic::AtomicCell;
 use error::KeyValueError;
 use moz_task::Task;
-use nserror::{nsresult, NS_ERROR_FAILURE};
+use nserror::{nsresult, NsresultExt, NS_ERROR_FAILURE};
 use nsstring::nsCString;
 use owned_value::owned_to_variant;
 use rkv::{Manager, OwnedValue, Rkv, SingleStore, StoreError, StoreOptions, Value};
 use std::{
     path::Path,
     str,
     sync::{Arc, RwLock},
 };
--- a/xpcom/idl-parser/xpidl/rust.py
+++ b/xpcom/idl-parser/xpidl/rust.py
@@ -237,17 +237,17 @@ def methodAsWrapper(iface, m):
         return "const _%s: () = ();" % methodNativeName(m)
 
 
 infallible_impl_tmpl = """\
 #[inline]
 pub unsafe fn %(name)s(&self) -> %(realtype)s {
     let mut result = <%(realtype)s as ::std::default::Default>::default();
     let _rv = ((*self.vtable).%(name)s)(self, &mut result);
-    debug_assert!(_rv.suceeded());
+    debug_assert!(::nserror::NsresultExt::succeeded(_rv));
     result
 }
 """
 
 
 def attrAsWrapper(iface, m, getter):
     try:
         if m.implicit_jscontext:
--- a/xpcom/rust/gtest/xpcom/test.rs
+++ b/xpcom/rust/gtest/xpcom/test.rs
@@ -8,17 +8,17 @@
 extern crate xpcom;
 
 extern crate nserror;
 
 use std::os::raw::c_char;
 use std::ptr;
 use std::ffi::{CStr, CString};
 use xpcom::interfaces;
-use nserror::{nsresult, NS_OK};
+use nserror::{NsresultExt, nsresult, NS_OK};
 
 #[no_mangle]
 pub unsafe extern fn Rust_ObserveFromRust() -> *const interfaces::nsIObserverService {
     let obssvc = xpcom::services::get_ObserverService().unwrap();
 
     // Define an observer
     #[derive(xpcom)]
     #[xpimplements(nsIObserver)]
--- a/xpcom/rust/moz_task/src/lib.rs
+++ b/xpcom/rust/moz_task/src/lib.rs
@@ -7,17 +7,17 @@
 //! It also provides the Task trait and TaskRunnable struct,
 //! which make it easier to dispatch tasks to threads.
 
 extern crate nserror;
 extern crate nsstring;
 #[macro_use]
 extern crate xpcom;
 
-use nserror::{nsresult, NS_OK};
+use nserror::{nsresult, NsresultExt, NS_OK};
 use nsstring::{nsACString, nsCString};
 use std::{
     ptr,
     sync::atomic::{AtomicBool, Ordering},
 };
 use xpcom::{
     getter_addrefs,
     interfaces::{nsIEventTarget, nsIRunnable, nsIThread},
--- a/xpcom/rust/nserror/src/lib.rs
+++ b/xpcom/rust/nserror/src/lib.rs
@@ -2,39 +2,48 @@ extern crate nsstring;
 
 use nsstring::{nsCString, nsACString};
 
 /// The type of errors in gecko.  Uses a newtype to provide additional type
 /// safety in Rust and #[repr(transparent)] to ensure the same representation
 /// as the C++ equivalent.
 #[repr(transparent)]
 #[allow(non_camel_case_types)]
-#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
+#[derive(Clone, Copy, Debug)]
 pub struct nsresult(pub u32);
 
-impl nsresult {
-    pub fn failed(self) -> bool {
+/// An extension trait that adds methods to `nsresult` types.
+pub trait NsresultExt {
+    fn failed(self) -> bool;
+    fn succeeded(self) -> bool;
+    fn to_result(self) -> Result<(), nsresult>;
+
+    /// Get a printable name for the nsresult error code. This function returns
+    /// a nsCString<'static>, which implements `Display`.
+    fn error_name(self) -> nsCString;
+}
+
+impl NsresultExt for nsresult {
+    fn failed(self) -> bool {
         (self.0 >> 31) != 0
     }
 
-    pub fn succeeded(self) -> bool {
+    fn succeeded(self) -> bool {
         !self.failed()
     }
 
-    pub fn to_result(self) -> Result<(), nsresult> {
+    fn to_result(self) -> Result<(), nsresult> {
         if self.failed() {
             Err(self)
         } else {
             Ok(())
         }
     }
 
-    /// Get a printable name for the nsresult error code. This function returns
-    /// a nsCString<'static>, which implements `Display`.
-    pub fn error_name(self) -> nsCString {
+    fn error_name(self) -> nsCString {
         let mut cstr = nsCString::new();
         unsafe {
             Gecko_GetErrorName(self, &mut *cstr);
         }
         cstr
     }
 }
 
--- a/xpcom/rust/xpcom/src/base.rs
+++ b/xpcom/rust/xpcom/src/base.rs
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use {
     RefCounted,
     RefPtr,
     GetterAddrefs
 };
 use interfaces::nsISupports;
+use nserror::NsresultExt;
 
 #[repr(C)]
 #[derive(Copy, Clone, Eq, PartialEq)]
 /// A "unique identifier". This is modeled after OSF DCE UUIDs.
 pub struct nsID(pub u32, pub u16, pub u16, pub [u8; 8]);
 
 /// Interface IDs
 pub type nsIID = nsID;
--- a/xpcom/rust/xpcom/src/reexports.rs
+++ b/xpcom/rust/xpcom/src/reexports.rs
@@ -8,11 +8,11 @@
 /// module re-exports those types from `xpcom` so that they can be used from the
 /// macro.
 
 // re-export libc so it can be used by the procedural macro.
 pub extern crate libc;
 
 pub use nsstring::{nsACString, nsAString, nsCString, nsString};
 
-pub use nserror::{nsresult, NS_ERROR_NO_INTERFACE, NS_OK};
+pub use nserror::{nsresult, NsresultExt, NS_ERROR_NO_INTERFACE, NS_OK};
 
 pub use std::ops::Deref;
--- a/xpcom/rust/xpcom/src/refptr.rs
+++ b/xpcom/rust/xpcom/src/refptr.rs
@@ -4,17 +4,17 @@
 
 use std::mem;
 use std::ptr;
 use std::ops::Deref;
 use std::marker::PhantomData;
 use std::cell::Cell;
 use std::sync::atomic::{self, AtomicUsize, Ordering};
 
-use nserror::{nsresult, NS_OK};
+use nserror::{NsresultExt, nsresult, NS_OK};
 
 use libc;
 
 use interfaces::nsrefcnt;
 
 use threadbound::ThreadBound;
 
 /// A trait representing a type which can be reference counted invasively.
--- a/xpcom/rust/xpcom/src/statics.rs
+++ b/xpcom/rust/xpcom/src/statics.rs
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use std::ffi::CStr;
 use std::ptr;
+use nserror::NsresultExt;
 use {
     RefPtr,
     GetterAddrefs,
     XpCom,
 };
 
 use interfaces::{
     nsIComponentManager,
--- a/xpcom/rust/xpcom/xpcom_macros/src/lib.rs
+++ b/xpcom/rust/xpcom/xpcom_macros/src/lib.rs
@@ -614,17 +614,19 @@ fn xpcom(init: DeriveInput) -> Result<To
             /// Perform a QueryInterface call on this object, attempting to
             /// dynamically cast it to the requested interface type. Returns
             /// Some(RefPtr<T>) if the cast succeeded, and None otherwise.
             #vis fn query_interface<T: ::xpcom::XpCom>(&self) ->
                 ::std::option::Option<::xpcom::RefPtr<T>>
             {
                 let mut ga = ::xpcom::GetterAddrefs::<T>::new();
                 unsafe {
-                    if self.QueryInterface(&T::IID, ga.void_ptr()).succeeded() {
+                    if ::xpcom::reexports::NsresultExt::succeeded(
+                        self.QueryInterface(&T::IID, ga.void_ptr()),
+                    ) {
                         ga.refptr()
                     } else {
                         None
                     }
                 }
             }
 
             /// Coerce this type safely to any of the interfaces which it