Skip to content

Rollup of 7 pull requests #44761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
cf318c3
bootstrap: use shasum(1) on NetBSD build hosts
jakllsch Aug 31, 2017
ab89870
bootstrap: use tar -z on extract
jakllsch Aug 31, 2017
a08822c
bootstrap: always use shasum instead of sha256sum
jakllsch Sep 10, 2017
0741645
Remove unused str_eq lang item
leoyvens Sep 17, 2017
203d71f
Add pub visibility for methods as well
GuillaumeGomez Sep 13, 2017
c9099ff
fix an incorrect assertion in the doc example for `std::io::copy`
oconnor663 Sep 20, 2017
66a31c7
Make `-Z borrowck-mir` imply that `EndRegion`'s should be emitted.
pnkfelix Sep 20, 2017
5bafba4
Fix librusc/README.md diagram
mattico Sep 20, 2017
548686f
Document stable size_of primitives and pointer size guarantees
Havvy Sep 17, 2017
5463aa0
Catch IOError
marcusbuffett Sep 21, 2017
cc858a7
Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1a…
GuillaumeGomez Sep 21, 2017
b095522
Rollup merge of #44554 - GuillaumeGomez:add-missing-pub, r=QuietMisdr…
GuillaumeGomez Sep 21, 2017
16c33bd
Rollup merge of #44648 - Havvy:doc-size_of, r=dtolnay
GuillaumeGomez Sep 21, 2017
3cf088f
Rollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1
GuillaumeGomez Sep 21, 2017
39ab56c
Rollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomez
GuillaumeGomez Sep 21, 2017
a814963
Rollup merge of #44717 - pnkfelix:debugflags-borrowckmir-implies-emit…
GuillaumeGomez Sep 21, 2017
9fce9f7
Rollup merge of #44726 - mattico:patch-3, r=eddyb
GuillaumeGomez Sep 21, 2017
6754846
Rollup merge of #44754 - marcusbuffett:bootstrap-config-toml-fix, r=a…
GuillaumeGomez Sep 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def bootstrap():
try:
with open(args.config or 'config.toml') as config:
build.config_toml = config.read()
except OSError:
except (OSError, IOError):
pass

if '\nverbose = 2' in build.config_toml:
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,10 @@ impl Step for Openssl {
if !ok {
panic!("failed to download openssl source")
}
let mut shasum = if target.contains("apple") {
let mut shasum = {
let mut cmd = Command::new("shasum");
cmd.arg("-a").arg("256");
cmd
} else {
Command::new("sha256sum")
};
let output = output(&mut shasum.arg(&tmp));
let found = output.split_whitespace().next().unwrap();
Expand All @@ -387,7 +385,7 @@ 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("perl");
configure.arg(obj.join("Configure"));
Expand Down
48 changes: 46 additions & 2 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,59 @@ pub fn forget<T>(t: T) {

/// Returns the size of a type in bytes.
///
/// More specifically, this is the offset in bytes between successive
/// items of the same type, including alignment padding.
/// More specifically, this is the offset in bytes between successive elements
/// in an array with that item type including alignment padding. Thus, for any
/// type `T` and length `n`, `[T; n]` has a size of `n * size_of::<T>()`.
///
/// In general, the size of a type is not stable across compilations, but
/// specific types such as primitives are.
///
/// The following table gives the size for primitives.
///
/// Type | size_of::\<Type>()
/// ---- | ---------------
/// () | 0
/// u8 | 1
/// u16 | 2
/// u32 | 4
/// u64 | 8
/// i8 | 1
/// i16 | 2
/// i32 | 4
/// i64 | 8
/// f32 | 4
/// f64 | 8
/// char | 4
///
/// Furthermore, `usize` and `isize` have the same size.
///
/// The types `*const T`, `&T`, `Box<T>`, `Option<&T>`, and `Option<Box<T>>` all have
/// the same size. If `T` is Sized, all of those types have the same size as `usize`.
///
/// The mutability of a pointer does not change its size. As such, `&T` and `&mut T`
/// have the same size. Likewise for `*const T` and `*mut T`.
///
/// # Examples
///
/// ```
/// use std::mem;
///
/// // Some primitives
/// assert_eq!(4, mem::size_of::<i32>());
/// assert_eq!(8, mem::size_of::<f64>());
/// assert_eq!(0, mem::size_of::<()>());
///
/// // Some arrays
/// assert_eq!(8, mem::size_of::<[i32; 2]>());
/// assert_eq!(12, mem::size_of::<[i32; 3]>());
/// assert_eq!(0, mem::size_of::<[i32; 0]>());
///
///
/// // Pointer size equality
/// assert_eq!(mem::size_of::<&i32>(), mem::size_of::<*const i32>());
/// assert_eq!(mem::size_of::<&i32>(), mem::size_of::<Box<i32>>());
/// assert_eq!(mem::size_of::<&i32>(), mem::size_of::<Option<&i32>>());
/// assert_eq!(mem::size_of::<Box<i32>>(), mem::size_of::<Option<Box<i32>>>());
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
3 changes: 0 additions & 3 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,9 +1399,6 @@ Section: Comparing strings
*/

/// Bytewise slice equality
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
#[lang = "str_eq"]
#[inline]
fn eq_slice(a: &str, b: &str) -> bool {
a.as_bytes() == b.as_bytes()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ incremental improves that may change.)

The dependency structure of these crates is roughly a diamond:

````
```
rustc_driver
/ | \
/ | \
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ language_item_table! {
EqTraitLangItem, "eq", eq_trait;
OrdTraitLangItem, "ord", ord_trait;

StrEqFnLangItem, "str_eq", str_eq_fn;

// A number of panic-related lang items. The `panic` item corresponds to
// divide-by-zero and various panic cases with `match`. The
// `panic_bounds_check` item is for indexing arrays.
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ impl Session {
}
pub fn emit_end_regions(&self) -> bool {
self.opts.debugging_opts.emit_end_regions ||
(self.opts.debugging_opts.mir_emit_validate > 0)
(self.opts.debugging_opts.mir_emit_validate > 0) ||
self.opts.debugging_opts.borrowck_mir
}
pub fn lto(&self) -> bool {
self.opts.cg.lto
Expand Down
6 changes: 4 additions & 2 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,8 @@ fn render_assoc_item(w: &mut fmt::Formatter,
href(did).map(|p| format!("{}#{}.{}", p.0, ty, name)).unwrap_or(anchor)
}
};
let mut head_len = format!("{}{}{:#}fn {}{:#}",
let mut head_len = format!("{}{}{}{:#}fn {}{:#}",
VisSpace(&meth.visibility),
ConstnessSpace(constness),
UnsafetySpace(unsafety),
AbiSpace(abi),
Expand All @@ -2633,8 +2634,9 @@ fn render_assoc_item(w: &mut fmt::Formatter,
} else {
(0, true)
};
write!(w, "{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
write!(w, "{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
{generics}{decl}{where_clause}",
VisSpace(&meth.visibility),
ConstnessSpace(constness),
UnsafetySpace(unsafety),
AbiSpace(abi),
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/io/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ use mem;
///
/// io::copy(&mut reader, &mut writer)?;
///
/// assert_eq!(reader, &writer[..]);
/// assert_eq!(&b"hello"[..], &writer[..]);
/// # Ok(())
/// # }
/// # foo().unwrap();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<u64>
Expand Down
8 changes: 8 additions & 0 deletions src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ mod prim_u128 { }
//
/// The pointer-sized signed integer type.
///
/// The size of this primitive is how many bytes it takes to reference any
/// location in memory. For example, on a 32 bit target, this is 4 bytes
/// and on a 64 bit target, this is 8 bytes.
///
/// *[See also the `std::isize` module](isize/index.html).*
///
/// However, please note that examples are shared between primitive integer
Expand All @@ -722,6 +726,10 @@ mod prim_isize { }
//
/// The pointer-sized unsigned integer type.
///
/// The size of this primitive is how many bytes it takes to reference any
/// location in memory. For example, on a 32 bit target, this is 4 bytes
/// and on a 64 bit target, this is 8 bytes.
///
/// *[See also the `std::usize` module](usize/index.html).*
///
/// However, please note that examples are shared between primitive integer
Expand Down
31 changes: 31 additions & 0 deletions src/test/rustdoc/pub-method.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2017 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-tidy-linelength
// compile-flags: --no-defaults --passes collapse-docs --passes unindent-comments --passes strip-priv-imports

#![crate_name = "foo"]

// @has foo/fn.bar.html
// @has - '//*[@class="rust fn"]' 'pub fn bar() -> '
/// foo
pub fn bar() -> usize {
2
}

// @has foo/struct.Foo.html
// @has - '//*[@class="method"]' 'pub fn new()'
// @has - '//*[@class="method"]' 'fn not_pub()'
pub struct Foo(usize);

impl Foo {
pub fn new() -> Foo { Foo(0) }
fn not_pub() {}
}