Skip to content
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

Rollup of 9 pull requests #41533

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bd3073b
Check privacy of trait items in all contexts
petrochenkov Apr 16, 2017
4f7ab0e
privacy: Rename and cleanup PrivacyVisitor
petrochenkov Apr 16, 2017
a42c025
Add bootstrap support for android
malbarbo Apr 18, 2017
c49d090
Specify behavior of `write_all` for `ErrorKind::Interrupted` errors
tbu- Apr 21, 2017
f8c6436
Step::replace_one should put a one, not a zero (Issue #41492)
scottmcm Apr 24, 2017
f852e3f
use the word 'length' in Vec::len's docs
steveklabnik Apr 24, 2017
957d51a
Fix a copy-paste error in `Instant::sub_duration`
tbu- Apr 24, 2017
70e6739
Adds rust-windbg.cmd script
AndrewGaspar Feb 20, 2017
a765dca
Add internal accessor methods to io::{Chain, Take}.
SergioBenitez Apr 22, 2017
aab87e3
Add more_io_inner_methods feature to unstable book.
SergioBenitez Apr 22, 2017
76397ae
Reference tracking issue for more_io_inner_methods.
SergioBenitez Apr 24, 2017
c168d8b
Add cautions to io::get_mut method documentation.
SergioBenitez Apr 24, 2017
ca96892
Clean up TcpStream example
steveklabnik Apr 25, 2017
7a87593
Rollup merge of #39983 - AndrewGaspar:rust-windbg, r=brson
Apr 25, 2017
070c3ba
Rollup merge of #41332 - petrochenkov:privti, r=eddyb
Apr 25, 2017
3a5d623
Rollup merge of #41370 - malbarbo:android-bootstrap, r=alexcrichton
Apr 25, 2017
af370bb
Rollup merge of #41442 - tbu-:pr_writeall_interrupted, r=aturon
Apr 25, 2017
aee29a7
Rollup merge of #41463 - SergioBenitez:master, r=alexcrichton
Apr 25, 2017
f5ca899
Rollup merge of #41493 - scottmcm:fix-step-replace, r=sfackler
Apr 25, 2017
2885f04
Rollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv
Apr 25, 2017
de7b4aa
Rollup merge of #41518 - tbu-:pr_fix_cp_error, r=sfackler
Apr 25, 2017
a1a19e6
Rollup merge of #41526 - steveklabnik:gh35950, r=GuillaumeGomez
Apr 25, 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
22 changes: 16 additions & 6 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ def build_triple(self):
# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
if ostype == 'Linux':
ostype = 'unknown-linux-gnu'
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
if os == 'Android':
ostype = 'linux-android'
else:
ostype = 'unknown-linux-gnu'
elif ostype == 'FreeBSD':
ostype = 'unknown-freebsd'
elif ostype == 'DragonFly':
Expand Down Expand Up @@ -464,15 +468,21 @@ def build_triple(self):
cputype = 'i686'
elif cputype in {'xscale', 'arm'}:
cputype = 'arm'
if ostype == 'linux-android':
ostype = 'linux-androideabi'
elif cputype == 'armv6l':
cputype = 'arm'
ostype += 'eabihf'
if ostype == 'linux-android':
ostype = 'linux-androideabi'
else:
ostype += 'eabihf'
elif cputype in {'armv7l', 'armv8l'}:
cputype = 'armv7'
ostype += 'eabihf'
elif cputype == 'aarch64':
cputype = 'aarch64'
elif cputype == 'arm64':
if ostype == 'linux-android':
ostype = 'linux-androideabi'
else:
ostype += 'eabihf'
elif cputype in {'aarch64', 'arm64'}:
cputype = 'aarch64'
elif cputype == 'mips':
if sys.byteorder == 'big':
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ pub fn debugger_scripts(build: &Build,
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
};
if host.contains("windows-msvc") {
// no debugger scripts
// windbg debugger scripts
install(&build.src.join("src/etc/rust-windbg.cmd"), &sysroot.join("bin"),
0o755);

cp_debugger_script("natvis/libcore.natvis");
cp_debugger_script("natvis/libcollections.natvis");
} else {
cp_debugger_script("debugger_pretty_printers_common.py");

Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
- [linked_list_extras](library-features/linked-list-extras.md)
- [lookup_host](library-features/lookup-host.md)
- [manually_drop](library-features/manually-drop.md)
- [more_io_inner_methods](library-features/more-io-inner-methods.md)
- [mpsc_select](library-features/mpsc-select.md)
- [n16](library-features/n16.md)
- [never_type_impls](library-features/never-type-impls.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `more_io_inner_methods`

The tracking issue for this feature is: [#41519]

[#41519]: https://github.com/rust-lang/rust/issues/41519

------------------------

This feature enables several internal accessor methods on structures in
`std::io` including `Take::{get_ref, get_mut}` and `Chain::{into_inner, get_ref,
get_mut}`.
18 changes: 18 additions & 0 deletions src/etc/rust-windbg.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
setlocal

REM Copyright 2014 The Rust Project Developers. See the COPYRIGHT
REM file at the top-level directory of this distribution and at
REM http://rust-lang.org/COPYRIGHT.
REM
REM Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
REM http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
REM <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
REM option. This file may not be copied, modified, or distributed
REM except according to those terms.

for /f "delims=" %%i in ('rustc --print=sysroot') do set rustc_sysroot=%%i

set rust_etc=%rustc_sysroot%\lib\rustlib\etc

windbg -c ".nvload %rust_etc%\libcore.natvis;.nvload %rust_etc%\libcollections.natvis;" %*
3 changes: 2 additions & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,8 @@ impl<T> Vec<T> {
self.truncate(0)
}

/// Returns the number of elements in the vector.
/// Returns the number of elements in the vector, also referred to
/// as its 'length'.
///
/// # Examples
///
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ macro_rules! step_impl_unsigned {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -157,12 +157,12 @@ macro_rules! step_impl_signed {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down Expand Up @@ -206,12 +206,12 @@ macro_rules! step_impl_no_between {

#[inline]
fn replace_one(&mut self) -> Self {
mem::replace(self, 0)
mem::replace(self, 1)
}

#[inline]
fn replace_zero(&mut self) -> Self {
mem::replace(self, 1)
mem::replace(self, 0)
}

#[inline]
Expand Down
38 changes: 38 additions & 0 deletions src/libcore/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,3 +1082,41 @@ fn test_chain_fold() {
assert_eq!(&[2, 3, 1, 2, 0], &result[..]);
}

#[test]
fn test_step_replace_unsigned() {
let mut x = 4u32;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}

#[test]
fn test_step_replace_signed() {
let mut x = 4i32;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}

#[test]
fn test_step_replace_no_between() {
let mut x = 4u128;
let y = x.replace_zero();
assert_eq!(x, 0);
assert_eq!(y, 4);

x = 5;
let y = x.replace_one();
assert_eq!(x, 1);
assert_eq!(y, 5);
}
2 changes: 2 additions & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#![feature(fixed_size_array)]
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(i128_type)]
#![feature(iter_rfind)]
#![feature(libc)]
#![feature(nonzero)]
Expand All @@ -30,6 +31,7 @@
#![feature(sort_internals)]
#![feature(sort_unstable)]
#![feature(step_by)]
#![feature(step_trait)]
#![feature(test)]
#![feature(try_from)]
#![feature(unicode)]
Expand Down
25 changes: 11 additions & 14 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

fn associated_item_from_trait_item_ref(self,
parent_def_id: DefId,
parent_vis: &hir::Visibility,
trait_item_ref: &hir::TraitItemRef)
-> AssociatedItem {
let def_id = self.hir.local_def_id(trait_item_ref.id.node_id);
Expand All @@ -2170,7 +2171,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
AssociatedItem {
name: trait_item_ref.name,
kind: kind,
vis: Visibility::from_hir(&hir::Inherited, trait_item_ref.id.node_id, self),
// Visibility of trait items is inherited from their traits.
vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self),
defaultness: trait_item_ref.defaultness,
def_id: def_id,
container: TraitContainer(parent_def_id),
Expand All @@ -2180,7 +2182,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

fn associated_item_from_impl_item_ref(self,
parent_def_id: DefId,
from_trait_impl: bool,
impl_item_ref: &hir::ImplItemRef)
-> AssociatedItem {
let def_id = self.hir.local_def_id(impl_item_ref.id.node_id);
Expand All @@ -2192,14 +2193,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
hir::AssociatedItemKind::Type => (ty::AssociatedKind::Type, false),
};

// Trait impl items are always public.
let public = hir::Public;
let vis = if from_trait_impl { &public } else { &impl_item_ref.vis };

ty::AssociatedItem {
name: impl_item_ref.name,
kind: kind,
vis: ty::Visibility::from_hir(vis, impl_item_ref.id.node_id, self),
// Visibility of trait impl items doesn't matter.
vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self),
defaultness: impl_item_ref.defaultness,
def_id: def_id,
container: ImplContainer(parent_def_id),
Expand Down Expand Up @@ -2639,21 +2637,20 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
let parent_def_id = tcx.hir.local_def_id(parent_id);
let parent_item = tcx.hir.expect_item(parent_id);
match parent_item.node {
hir::ItemImpl(.., ref impl_trait_ref, _, ref impl_item_refs) => {
hir::ItemImpl(.., ref impl_item_refs) => {
if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.node_id == id) {
let assoc_item =
tcx.associated_item_from_impl_item_ref(parent_def_id,
impl_trait_ref.is_some(),
impl_item_ref);
let assoc_item = tcx.associated_item_from_impl_item_ref(parent_def_id,
impl_item_ref);
debug_assert_eq!(assoc_item.def_id, def_id);
return assoc_item;
}
}

hir::ItemTrait(.., ref trait_item_refs) => {
if let Some(trait_item_ref) = trait_item_refs.iter().find(|i| i.id.node_id == id) {
let assoc_item =
tcx.associated_item_from_trait_item_ref(parent_def_id, trait_item_ref);
let assoc_item = tcx.associated_item_from_trait_item_ref(parent_def_id,
&parent_item.vis,
trait_item_ref);
debug_assert_eq!(assoc_item.def_id, def_id);
return assoc_item;
}
Expand Down
Loading