Skip to content

Commit

Permalink
Auto merge of rust-lang#40995 - alexcrichton:beta-next, r=alexcrichton
Browse files Browse the repository at this point in the history
Backport PRs to beta

Backport of

* rust-lang#40967
* rust-lang#40836
* rust-lang#40779
* rust-lang#40888

Also includes a cargo submodule update
  • Loading branch information
bors committed Apr 1, 2017
2 parents bf403d0 + 4371f21 commit b37cc75
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 54 deletions.
26 changes: 16 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ matrix:
- env: IMAGE=x86_64-gnu-distcheck
- env: IMAGE=x86_64-gnu-incremental

# OSX builders
# OSX builders running tests, these run the full test suite.
#
# Note that the compiler is compiled to target 10.8 here because the Xcode
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
- env: >
RUST_CHECK_TARGET=check
RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin
Expand Down Expand Up @@ -68,6 +71,12 @@ matrix:
osx_image: xcode8.2
install: *osx_install_sccache
# OSX builders producing releases. These do not run the full test suite and
# just produce a bunch of artifacts.
#
# Note that these are running in the `xcode7` image instead of the
# `xcode8.2` image as above. That's because we want to build releases for
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
- env: >
RUST_CHECK_TARGET=dist
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended"
Expand All @@ -76,10 +85,9 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
MACOSX_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
osx_image: xcode7
install: >
travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-25-sccache-x86_64-apple-darwin &&
chmod +x /usr/local/bin/sccache
Expand All @@ -91,10 +99,9 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
MACOSX_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
osx_image: xcode7
install: *osx_install_sccache
# "alternate" deployments, these are "nightlies" but don't have assertions
Expand All @@ -110,10 +117,9 @@ matrix:
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
SCCACHE_ERROR_LOG=/tmp/sccache.log
RUST_LOG=sccache=debug
MACOSX_DEPLOYMENT_TARGET=10.8
MACOSX_STD_DEPLOYMENT_TARGET=10.7
MACOSX_DEPLOYMENT_TARGET=10.7
os: osx
osx_image: xcode8.2
osx_image: xcode7
install: *osx_install_sccache
env:
Expand Down
2 changes: 1 addition & 1 deletion cargo
Submodule cargo updated 2 files
+14 −14 .travis.yml
+3 −3 Cargo.lock
42 changes: 19 additions & 23 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,30 +426,26 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
{
debug!("note_issue_32330: terr={:?}", terr);
match *terr {
TypeError::RegionsInsufficientlyPolymorphic(_, &Region::ReVar(vid)) |
TypeError::RegionsOverlyPolymorphic(_, &Region::ReVar(vid)) => {
match self.region_vars.var_origin(vid) {
RegionVariableOrigin::EarlyBoundRegion(_, _, Some(Issue32330 {
fn_def_id,
region_name
})) => {
diag.note(
&format!("lifetime parameter `{0}` declared on fn `{1}` \
appears only in the return type, \
but here is required to be higher-ranked, \
which means that `{0}` must appear in both \
argument and return types",
region_name,
self.tcx.item_path_str(fn_def_id)));
diag.note(
&format!("this error is the result of a recent bug fix; \
for more information, see issue #33685 \
<https://github.com/rust-lang/rust/issues/33685>"));
}
_ => { }
}
TypeError::RegionsInsufficientlyPolymorphic(_, _, Some(box Issue32330 {
fn_def_id, region_name
})) |
TypeError::RegionsOverlyPolymorphic(_, _, Some(box Issue32330 {
fn_def_id, region_name
})) => {
diag.note(
&format!("lifetime parameter `{0}` declared on fn `{1}` \
appears only in the return type, \
but here is required to be higher-ranked, \
which means that `{0}` must appear in both \
argument and return types",
region_name,
self.tcx.item_path_str(fn_def_id)));
diag.note(
&format!("this error is the result of a recent bug fix; \
for more information, see issue #33685 \
<https://github.com/rust-lang/rust/issues/33685>"));
}
_ => { }
_ => {}
}
}

Expand Down
18 changes: 16 additions & 2 deletions src/librustc/infer/higher_ranked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use super::{CombinedSnapshot,
InferCtxt,
LateBoundRegion,
HigherRankedType,
RegionVariableOrigin,
SubregionOrigin,
SkolemizationMap};
use super::combine::CombineFields;
Expand Down Expand Up @@ -656,14 +657,27 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
skol_br,
tainted_region);

let issue_32330 = if let &ty::ReVar(vid) = tainted_region {
match self.region_vars.var_origin(vid) {
RegionVariableOrigin::EarlyBoundRegion(_, _, issue_32330) => {
issue_32330.map(Box::new)
}
_ => None
}
} else {
None
};

if overly_polymorphic {
debug!("Overly polymorphic!");
return Err(TypeError::RegionsOverlyPolymorphic(skol_br,
tainted_region));
tainted_region,
issue_32330));
} else {
debug!("Not as polymorphic!");
return Err(TypeError::RegionsInsufficientlyPolymorphic(skol_br,
tainted_region));
tainted_region,
issue_32330));
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pub enum TypeError<'tcx> {
RegionsDoesNotOutlive(&'tcx Region, &'tcx Region),
RegionsNotSame(&'tcx Region, &'tcx Region),
RegionsNoOverlap(&'tcx Region, &'tcx Region),
RegionsInsufficientlyPolymorphic(BoundRegion, &'tcx Region),
RegionsOverlyPolymorphic(BoundRegion, &'tcx Region),
RegionsInsufficientlyPolymorphic(BoundRegion, &'tcx Region, Option<Box<ty::Issue32330>>),
RegionsOverlyPolymorphic(BoundRegion, &'tcx Region, Option<Box<ty::Issue32330>>),
Sorts(ExpectedFound<Ty<'tcx>>),
IntMismatch(ExpectedFound<ty::IntVarValue>),
FloatMismatch(ExpectedFound<ast::FloatTy>),
Expand Down Expand Up @@ -116,11 +116,11 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
RegionsNoOverlap(..) => {
write!(f, "lifetimes do not intersect")
}
RegionsInsufficientlyPolymorphic(br, _) => {
RegionsInsufficientlyPolymorphic(br, _, _) => {
write!(f, "expected bound lifetime parameter {}, \
found concrete lifetime", br)
}
RegionsOverlyPolymorphic(br, _) => {
RegionsOverlyPolymorphic(br, _, _) => {
write!(f, "expected concrete lifetime, \
found bound lifetime parameter {}", br)
}
Expand Down Expand Up @@ -253,15 +253,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.note_and_explain_region(db, "...does not overlap ",
region2, "");
}
RegionsInsufficientlyPolymorphic(_, conc_region) => {
RegionsInsufficientlyPolymorphic(_, conc_region, _) => {
self.note_and_explain_region(db, "concrete lifetime that was found is ",
conc_region, "");
}
RegionsOverlyPolymorphic(_, &ty::ReVar(_)) => {
RegionsOverlyPolymorphic(_, &ty::ReVar(_), _) => {
// don't bother to print out the message below for
// inference variables, it's not very illuminating.
}
RegionsOverlyPolymorphic(_, conc_region) => {
RegionsOverlyPolymorphic(_, conc_region, _) => {
self.note_and_explain_region(db, "expected concrete lifetime is ",
conc_region, "");
}
Expand Down
10 changes: 6 additions & 4 deletions src/librustc/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,13 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> {
RegionsNoOverlap(a, b) => {
return tcx.lift(&(a, b)).map(|(a, b)| RegionsNoOverlap(a, b))
}
RegionsInsufficientlyPolymorphic(a, b) => {
return tcx.lift(&b).map(|b| RegionsInsufficientlyPolymorphic(a, b))
RegionsInsufficientlyPolymorphic(a, b, ref c) => {
let c = c.clone();
return tcx.lift(&b).map(|b| RegionsInsufficientlyPolymorphic(a, b, c))
}
RegionsOverlyPolymorphic(a, b) => {
return tcx.lift(&b).map(|b| RegionsOverlyPolymorphic(a, b))
RegionsOverlyPolymorphic(a, b, ref c) => {
let c = c.clone();
return tcx.lift(&b).map(|b| RegionsOverlyPolymorphic(a, b, c))
}
IntMismatch(x) => IntMismatch(x),
FloatMismatch(x) => FloatMismatch(x),
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ r##"<!DOCTYPE html>
{favicon}
{in_header}
</head>
<body class="rustdoc">
<body class="rustdoc {css_class}">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
Expand All @@ -80,7 +80,7 @@ r##"<!DOCTYPE html>
</form>
</nav>
<section id='main' class="content {css_class}">{content}</section>
<section id='main' class="content">{content}</section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ pre {
padding: 14px;
}

.source pre {
.source .content pre {
padding: 20px;
}

img {
max-width: 100%;
}

.content.source {
.source .content {
margin-top: 50px;
max-width: none;
overflow: visible;
Expand Down Expand Up @@ -231,7 +231,7 @@ nav.sub {
padding: 15px 0;
}

.content.source pre.rust {
.source .content pre.rust {
white-space: pre;
overflow: auto;
padding-left: 0;
Expand Down
6 changes: 5 additions & 1 deletion src/librustdoc/html/static/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ pre {
background-color: #fff;
}

.source .sidebar {
background-color: #fff;
}

.sidebar .location {
border-color: #000;
background-color: #fff;
Expand Down Expand Up @@ -187,4 +191,4 @@ a.test-arrow:hover{

:target > code {
background: #FDFFD3;
}
}
4 changes: 4 additions & 0 deletions src/rustllvm/llvm-rebuild-trigger
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
<<<<<<< HEAD
2017-03-04
=======
2017-03-23
>>>>>>> bd52ff1... update LLVM with fix for PR32379
21 changes: 21 additions & 0 deletions src/test/compile-fail/issue-40000.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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.

#![feature(closure_to_fn_coercion)]

fn main() {
let bar: fn(&mut u32) = |_| {}; //~ ERROR mismatched types
//~| expected concrete lifetime, found bound lifetime parameter

fn foo(x: Box<Fn(&i32)>) {}
let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
foo(bar); //~ ERROR mismatched types
//~| expected concrete lifetime, found bound lifetime parameter
}
15 changes: 15 additions & 0 deletions src/test/run-pass/auxiliary/llvm_pr32379.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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.

pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 {
if f1 { data &= !2; }
if f2 { data |= 2; }
data
}
23 changes: 23 additions & 0 deletions src/test/run-pass/llvm-pr32379.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

// aux-build:llvm_pr32379.rs

// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
// applies to upstream LLVM 3.9.1, is known to cause rustc itself to be
// miscompiled on ARM (Rust issue #40593). Because cross builds don't test
// our *compiler* on ARM, have a test for the miscompilation directly.

extern crate llvm_pr32379;

pub fn main() {
let val = llvm_pr32379::pr32379(2, false, false);
assert_eq!(val, 2);
}

0 comments on commit b37cc75

Please sign in to comment.