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 14 pull requests #45261

Merged
merged 44 commits into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5451b72
Expand the introduction to the ffi module.
federicomenaquintero Sep 22, 2017
8da694a
Overhaul the ffi::CString docs
federicomenaquintero Sep 23, 2017
2cb2a06
Overhaul the ffi::CStr documentation.
federicomenaquintero Sep 25, 2017
3c5e18f
Point from the error structs back to the method that created them, li…
federicomenaquintero Sep 25, 2017
155b4b1
Module overview for std::os::windows:ffi
federicomenaquintero Sep 25, 2017
91f6445
Overhaul the documentation for OsString / OsStr
federicomenaquintero Sep 25, 2017
4143422
os_str: Fix too-long lines
federicomenaquintero Sep 26, 2017
9854e83
Remove the implication that CString contains UTF-8 data.
federicomenaquintero Oct 2, 2017
50505aa
Clarify the ffi module's toplevel docs, per @clarcharr's comments
federicomenaquintero Oct 2, 2017
d989cd0
Fix broken links in documentation
federicomenaquintero Oct 2, 2017
35545b3
Improve newtype_index macro to handle description and constants consi…
Nashenas88 Oct 8, 2017
a28b246
usize index message for vec
GuillaumeGomez Oct 9, 2017
843dc60
Add suggestions for misspelled labels
Oct 9, 2017
72cfd20
Add error for comma after base struct field
Badel2 Oct 10, 2017
db91b00
output compiler message updated
jean-lourenco Oct 8, 2017
a2aba79
rustc: Update LLVM with a ThinLTO fix
alexcrichton Oct 11, 2017
90d58a3
rustbuild: Make openssl download more reliable.
kennytm Oct 11, 2017
d5bdfbc
ffi/c_str.rs: Make all descriptions have a single-sentence summary at…
federicomenaquintero Oct 11, 2017
a9a4ce6
ffi/c_str.rs: Fix method/function confusion
federicomenaquintero Oct 11, 2017
0264510
ffi/c_str.rs: Use only one space after a period ending a sentence
federicomenaquintero Oct 11, 2017
c8e232d
ffi/mod.rs: Keep the one-sentence summary at the beginning of the module
federicomenaquintero Oct 11, 2017
fab6a10
Point at immutable outer variable
estebank Oct 11, 2017
5fb8e3d
ffi/mod.rs: Use only one space after a period ending a sentence
federicomenaquintero Oct 11, 2017
9423bee
Move const qualifier from brackets to constant values and remove comm…
Nashenas88 Oct 12, 2017
97fe353
Split lines longer than 100 columns
Nashenas88 Oct 12, 2017
e6da40c
rustbuild: Prevent spurious rebuilds of the RLS
alexcrichton Oct 12, 2017
6cae080
rustc: Handle `#[linkage]` anywhere in a crate
alexcrichton Oct 10, 2017
9da9c3b
Small improvement for the sidebar on mobile devices
GuillaumeGomez Oct 12, 2017
16ec7b9
Increase padding between consecutive impls
Oct 12, 2017
11775ab
Clarify how needs_drop is conservative
Gankra Oct 13, 2017
6c43bd3
Rollup merge of #44855 - federicomenaquintero:master, r=steveklabnik
kennytm Oct 13, 2017
82f2c28
Rollup merge of #45110 - Nashenas88:master, r=arielb1
kennytm Oct 13, 2017
9eab4ec
Rollup merge of #45122 - jean-lourenco:master, r=nikomatsakis
kennytm Oct 13, 2017
b290568
Rollup merge of #45133 - GuillaumeGomez:usize-index-msg, r=dtolnay
kennytm Oct 13, 2017
46d86d3
Rollup merge of #45173 - laumann:suggest-misspelled-labels, r=petroch…
kennytm Oct 13, 2017
e6a6d98
Rollup merge of #45178 - Badel2:comma-after-struct, r=petrochenkov
kennytm Oct 13, 2017
a481d7c
Rollup merge of #45189 - alexcrichton:thinlto-allocators, r=michaelwo…
kennytm Oct 13, 2017
64cc5ec
Rollup merge of #45203 - alexcrichton:update-llvm, r=michaelwoerister
kennytm Oct 13, 2017
9b128e4
Rollup merge of #45209 - kennytm:treat-checksum-error-as-download-err…
kennytm Oct 13, 2017
2a6a4e7
Rollup merge of #45221 - estebank:issue-41790, r=nikomatsakis
kennytm Oct 13, 2017
4ed348e
Rollup merge of #45236 - alexcrichton:build-less, r=Mark-Simulacrum
kennytm Oct 13, 2017
f43c54e
Rollup merge of #45240 - GuillaumeGomez:mobile-sidebar-improvements, …
kennytm Oct 13, 2017
fb98e3e
Rollup merge of #45245 - stjepang:more-padding-between-impls, r=Quiet…
kennytm Oct 13, 2017
8ea6790
Rollup merge of #45253 - Gankro:drop_docs, r=kennytm
kennytm Oct 13, 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
14 changes: 10 additions & 4 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,11 @@ impl Step for Rls {
let compiler = builder.compiler(stage, host);

builder.ensure(tool::Rls { compiler, target: self.host });
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml"));
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
host,
"test",
"src/tools/rls");

// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
Expand Down Expand Up @@ -291,8 +294,11 @@ impl Step for Rustfmt {
let compiler = builder.compiler(stage, host);

builder.ensure(tool::Rustfmt { compiler, target: self.host });
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rustfmt/Cargo.toml"));
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
host,
"test",
"src/tools/rustfmt");

// Don't build tests dynamically, just a pain to work with
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
Expand Down
57 changes: 37 additions & 20 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,34 +352,51 @@ impl Step for Openssl {
// originally from https://www.openssl.org/source/...
let url = format!("https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/{}",
name);
let mut ok = false;
let mut last_error = None;
for _ in 0..3 {
let status = Command::new("curl")
.arg("-o").arg(&tmp)
.arg("-f") // make curl fail if the URL does not return HTTP 200
.arg(&url)
.status()
.expect("failed to spawn curl");
if status.success() {
ok = true;
break

// Retry if download failed.
if !status.success() {
last_error = Some(status.to_string());
continue;
}

// Ensure the hash is correct.
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
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();

// If the hash is wrong, probably the download is incomplete or S3 served an error
// page. In any case, retry.
if found != OPENSSL_SHA256 {
last_error = Some(format!(
"downloaded openssl sha256 different\n\
expected: {}\n\
found: {}\n",
OPENSSL_SHA256,
found
));
continue;
}

// Everything is fine, so exit the retry loop.
last_error = None;
break;
}
if !ok {
panic!("failed to download openssl source")
}
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
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();
if found != OPENSSL_SHA256 {
panic!("downloaded openssl sha256 different\n\
expected: {}\n\
found: {}\n", OPENSSL_SHA256, found);
if let Some(error) = last_error {
panic!("failed to download openssl source: {}", error);
}
t!(fs::rename(&tmp, &tarball));
}
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
#![feature(unique)]
#![feature(unsize)]
#![feature(allocator_internals)]
#![feature(on_unimplemented)]

#![cfg_attr(not(test), feature(fused, fn_traits, placement_new_protocol, swap_with_slice, i128))]
#![cfg_attr(test, feature(test, box_heap))]
Expand Down
25 changes: 24 additions & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,7 @@ impl<T: Hash> Hash for Vec<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> Index<usize> for Vec<T> {
type Output = T;

Expand All @@ -1554,6 +1555,7 @@ impl<T> Index<usize> for Vec<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> IndexMut<usize> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: usize) -> &mut T {
Expand All @@ -1562,8 +1564,8 @@ impl<T> IndexMut<usize> for Vec<T> {
}
}


#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
type Output = [T];

Expand All @@ -1572,7 +1574,9 @@ impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
Index::index(&**self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
type Output = [T];

Expand All @@ -1581,7 +1585,9 @@ impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
Index::index(&**self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
type Output = [T];

Expand All @@ -1590,7 +1596,9 @@ impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
Index::index(&**self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::RangeFull> for Vec<T> {
type Output = [T];

Expand All @@ -1599,7 +1607,9 @@ impl<T> ops::Index<ops::RangeFull> for Vec<T> {
self
}
}

#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::RangeInclusive<usize>> for Vec<T> {
type Output = [T];

Expand All @@ -1608,7 +1618,9 @@ impl<T> ops::Index<ops::RangeInclusive<usize>> for Vec<T> {
Index::index(&**self, index)
}
}

#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::Index<ops::RangeToInclusive<usize>> for Vec<T> {
type Output = [T];

Expand All @@ -1619,41 +1631,52 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for Vec<T> {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
#[inline]
fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] {
self
}
}

#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut [T] {
IndexMut::index_mut(&mut **self, index)
}
}

#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for Vec<T> {
#[inline]
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {
Expand Down
8 changes: 5 additions & 3 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {

/// Returns whether dropping values of type `T` matters.
///
/// This is purely an optimization hint, and may be implemented conservatively.
/// For instance, always returning `true` would be a valid implementation of
/// this function.
/// This is purely an optimization hint, and may be implemented conservatively:
/// it may return `true` for types that don't actually need to be dropped.
/// As such always returning `true` would be a valid implementation of
/// this function. However if this function actually returns `false`, then you
/// can be certain dropping `T` has no side effect.
///
/// Low level implementations of things like collections, which need to manually
/// drop their data, should use this function to avoid unnecessarily
Expand Down
6 changes: 6 additions & 0 deletions src/librustc/middle/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> {

impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
// Anything which has custom linkage gets thrown on the worklist no
// matter where it is in the crate.
if attr::contains_name(&item.attrs, "linkage") {
self.worklist.push(item.id);
}

// We need only trait impls here, not inherent impls, and only non-exported ones
if let hir::ItemImpl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node {
if !self.access_levels.is_reachable(item.id) {
Expand Down
21 changes: 13 additions & 8 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,11 @@ pub enum BorrowKind {
///////////////////////////////////////////////////////////////////////////
// Variables and temps

newtype_index!(Local, "_");

pub const RETURN_POINTER: Local = Local(0);
newtype_index!(Local
{
DEBUG_NAME = "_",
const RETURN_POINTER = 0,
});

/// Classifies locals into categories. See `Mir::local_kind`.
#[derive(PartialEq, Eq, Debug)]
Expand Down Expand Up @@ -551,7 +553,7 @@ pub struct UpvarDecl {
///////////////////////////////////////////////////////////////////////////
// BasicBlock

newtype_index!(BasicBlock, "bb");
newtype_index!(BasicBlock { DEBUG_NAME = "bb" });

///////////////////////////////////////////////////////////////////////////
// BasicBlockData and Terminator
Expand Down Expand Up @@ -1131,7 +1133,7 @@ pub type LvalueProjection<'tcx> = Projection<'tcx, Lvalue<'tcx>, Local, Ty<'tcx>
/// and the index is a local.
pub type LvalueElem<'tcx> = ProjectionElem<'tcx, Local, Ty<'tcx>>;

newtype_index!(Field, "field");
newtype_index!(Field { DEBUG_NAME = "field" });

impl<'tcx> Lvalue<'tcx> {
pub fn field(self, f: Field, ty: Ty<'tcx>) -> Lvalue<'tcx> {
Expand Down Expand Up @@ -1196,8 +1198,11 @@ impl<'tcx> Debug for Lvalue<'tcx> {
///////////////////////////////////////////////////////////////////////////
// Scopes

newtype_index!(VisibilityScope, "scope");
pub const ARGUMENT_VISIBILITY_SCOPE : VisibilityScope = VisibilityScope(0);
newtype_index!(VisibilityScope
{
DEBUG_NAME = "scope",
const ARGUMENT_VISIBILITY_SCOPE = 0,
});

#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
pub struct VisibilityScopeData {
Expand Down Expand Up @@ -1522,7 +1527,7 @@ pub struct Constant<'tcx> {
pub literal: Literal<'tcx>,
}

newtype_index!(Promoted, "promoted");
newtype_index!(Promoted { DEBUG_NAME = "promoted" });

#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum Literal<'tcx> {
Expand Down
16 changes: 15 additions & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,21 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {

let mut db = match err.cause {
MutabilityViolation => {
self.cannot_assign(error_span, &descr, Origin::Ast)
let mut db = self.cannot_assign(error_span, &descr, Origin::Ast);
if let mc::NoteClosureEnv(upvar_id) = err.cmt.note {
let node_id = self.tcx.hir.hir_to_node_id(upvar_id.var_id);
let sp = self.tcx.hir.span(node_id);
match self.tcx.sess.codemap().span_to_snippet(sp) {
Ok(snippet) => {
let msg = &format!("consider making `{}` mutable", snippet);
db.span_suggestion(sp, msg, format!("mut {}", snippet));
}
_ => {
db.span_help(sp, "consider making this binding mutable");
}
}
}
db
}
BorrowViolation(euv::ClosureCapture(_)) => {
struct_span_err!(self.tcx.sess, error_span, E0595,
Expand Down
Loading