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

Beta 20170928 #44908

Merged
merged 16 commits into from
Oct 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ matrix:
- env: IMAGE=dist-arm-linux DEPLOY=1
- env: IMAGE=dist-armhf-linux DEPLOY=1
- env: IMAGE=dist-armv7-linux DEPLOY=1
- env: IMAGE=dist-fuchsia DEPLOY=1
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
- env: IMAGE=dist-i686-freebsd DEPLOY=1
- env: IMAGE=dist-i686-linux DEPLOY=1
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const CFG_RELEASE_NUM: &str = "1.21.0";
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
// versions (section 9)
pub const CFG_PRERELEASE_VERSION: &str = ".3";
pub const CFG_PRERELEASE_VERSION: &str = ".4";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
2 changes: 1 addition & 1 deletion src/liblibc
Submodule liblibc updated 97 files
+14 −5 .travis.yml
+222 −30 Cargo.lock
+2 −2 Cargo.toml
+4 −1 README.md
+1 −1 appveyor.yml
+1 −1 ci/README.md
+1 −1 ci/android-install-sdk.sh
+13 −0 ci/docker/aarch64-linux-android/Dockerfile
+2 −2 ci/docker/aarch64-unknown-linux-gnu/Dockerfile
+24 −0 ci/docker/aarch64-unknown-linux-musl/Dockerfile
+13 −0 ci/docker/arm-linux-androideabi/Dockerfile
+2 −2 ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
+20 −0 ci/docker/asmjs-unknown-emscripten/Dockerfile
+13 −0 ci/docker/i686-linux-android/Dockerfile
+1 −1 ci/docker/i686-unknown-linux-gnu/Dockerfile
+2 −2 ci/docker/mips-unknown-linux-gnu/Dockerfile
+4 −4 ci/docker/mips-unknown-linux-musl/Dockerfile
+2 −2 ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
+4 −4 ci/docker/mipsel-unknown-linux-musl/Dockerfile
+2 −2 ci/docker/powerpc-unknown-linux-gnu/Dockerfile
+2 −2 ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
+3 −0 ci/docker/s390x-unknown-linux-gnu/Dockerfile
+21 −0 ci/docker/wasm32-unknown-emscripten/Dockerfile
+11 −0 ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
+5 −1 ci/docker/x86_64-rumprun-netbsd/Dockerfile
+54 −0 ci/docker/x86_64-rumprun-netbsd/runtest.rs
+2 −2 ci/docker/x86_64-unknown-freebsd/Dockerfile
+1 −1 ci/docker/x86_64-unknown-linux-gnu/Dockerfile
+0 −8 ci/docker/x86_64-unknown-openbsd/Dockerfile
+19 −0 ci/emscripten-entry.sh
+54 −0 ci/emscripten.sh
+1 −0 ci/run-docker.sh
+8 −124 ci/run.sh
+41 −0 ci/runtest-android.rs
+11 −1 libc-test/Cargo.toml
+0 −16 libc-test/build-generated.rs
+75 −17 libc-test/build.rs
+0 −16 libc-test/generate-files/Cargo.toml
+0 −19 libc-test/run-generated-Cargo.toml
+0 −9 libc-test/src/main-generated.rs
+7 −0 libc-test/test/linux_fcntl.rs
+1 −1 libc-test/test/main.rs
+16 −7 src/lib.rs
+0 −37 src/macros.rs
+0 −65 src/redox.rs
+104 −0 src/redox/mod.rs
+110 −0 src/redox/net.rs
+336 −3 src/unix/bsd/apple/mod.rs
+242 −17 src/unix/bsd/freebsdlike/dragonfly/mod.rs
+2 −0 src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+256 −17 src/unix/bsd/freebsdlike/freebsd/mod.rs
+2 −0 src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+13 −2 src/unix/bsd/freebsdlike/mod.rs
+73 −12 src/unix/bsd/mod.rs
+17 −6 src/unix/bsd/netbsdlike/mod.rs
+146 −1 src/unix/bsd/netbsdlike/netbsd/mod.rs
+78 −0 src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+1 −0 src/unix/haiku/b32.rs
+1 −0 src/unix/haiku/b64.rs
+440 −114 src/unix/haiku/mod.rs
+8 −54 src/unix/mod.rs
+67 −0 src/unix/newlib/mod.rs
+3 −0 src/unix/notbsd/android/b32/arm.rs
+29 −0 src/unix/notbsd/android/b32/mod.rs
+3 −0 src/unix/notbsd/android/b64/aarch64.rs
+30 −0 src/unix/notbsd/android/b64/mod.rs
+190 −3 src/unix/notbsd/android/mod.rs
+1,667 −0 src/unix/notbsd/emscripten.rs
+39 −1 src/unix/notbsd/linux/mips/mips32.rs
+34 −1 src/unix/notbsd/linux/mips/mips64.rs
+28 −0 src/unix/notbsd/linux/mips/mod.rs
+249 −12 src/unix/notbsd/linux/mod.rs
+33 −0 src/unix/notbsd/linux/musl/b32/arm.rs
+0 −348 src/unix/notbsd/linux/musl/b32/asmjs.rs
+39 −2 src/unix/notbsd/linux/musl/b32/mips.rs
+21 −5 src/unix/notbsd/linux/musl/b32/mod.rs
+31 −0 src/unix/notbsd/linux/musl/b32/x86.rs
+77 −0 src/unix/notbsd/linux/musl/b64/aarch64.rs
+26 −45 src/unix/notbsd/linux/musl/b64/mod.rs
+76 −0 src/unix/notbsd/linux/musl/b64/powerpc64.rs
+71 −0 src/unix/notbsd/linux/musl/b64/x86_64.rs
+10 −33 src/unix/notbsd/linux/musl/mod.rs
+33 −0 src/unix/notbsd/linux/other/b32/arm.rs
+33 −0 src/unix/notbsd/linux/other/b32/powerpc.rs
+31 −0 src/unix/notbsd/linux/other/b32/x86.rs
+32 −0 src/unix/notbsd/linux/other/b64/aarch64.rs
+32 −0 src/unix/notbsd/linux/other/b64/powerpc64.rs
+30 −0 src/unix/notbsd/linux/other/b64/sparc64.rs
+30 −0 src/unix/notbsd/linux/other/b64/x86_64.rs
+28 −7 src/unix/notbsd/linux/other/mod.rs
+32 −7 src/unix/notbsd/linux/s390x.rs
+70 −135 src/unix/notbsd/mod.rs
+85 −20 src/unix/solaris/mod.rs
+143 −24 src/unix/uclibc/mod.rs
+46 −0 src/unix/uclibc/x86_64/l4re.rs
+86 −90 src/unix/uclibc/x86_64/mod.rs
+2 −1 src/windows.rs
1 change: 1 addition & 0 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ for ty::RegionParameterDef {
name,
def_id,
index,
issue_32330: _,
pure_wrt_drop
} = *self;

Expand Down
35 changes: 33 additions & 2 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ use hir::map as hir_map;
use hir::def_id::DefId;
use middle::region;
use traits::{ObligationCause, ObligationCauseCode};
use ty::{self, Region, TyCtxt, TypeFoldable};
use ty::{self, TyCtxt, TypeFoldable};
use ty::{Region, Issue32330};
use ty::error::TypeError;
use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::{Pos, Span};
Expand Down Expand Up @@ -714,6 +715,35 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
self.tcx.note_and_explain_type_err(diag, terr, span);
}

pub fn note_issue_32330(&self,
diag: &mut DiagnosticBuilder<'tcx>,
terr: &TypeError<'tcx>)
{
debug!("note_issue_32330: terr={:?}", terr);
match *terr {
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>"));
}
_ => {}
}
}

pub fn report_and_explain_type_error(&self,
trace: TypeTrace<'tcx>,
terr: &TypeError<'tcx>)
Expand All @@ -733,6 +763,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
};
self.note_type_err(&mut diag, &trace.cause, None, Some(trace.values), terr);
self.note_issue_32330(&mut diag, terr);
diag
}

Expand Down Expand Up @@ -905,7 +936,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
format!(" for lifetime parameter {}in trait containing associated type `{}`",
br_string(br), self.tcx.associated_item(def_id).name)
}
infer::EarlyBoundRegion(_, name) => {
infer::EarlyBoundRegion(_, name, _) => {
format!(" for lifetime parameter `{}`",
name)
}
Expand Down
56 changes: 49 additions & 7 deletions src/librustc/infer/higher_ranked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

use super::{CombinedSnapshot,
InferCtxt,
LateBoundRegion,
HigherRankedType,
RegionVariableOrigin,
SubregionOrigin,
SkolemizationMap};
use super::combine::CombineFields;
Expand All @@ -27,6 +29,15 @@ use util::nodemap::{FxHashMap, FxHashSet};

pub struct HrMatchResult<U> {
pub value: U,

/// Normally, when we do a higher-ranked match operation, we
/// expect all higher-ranked regions to be constrained as part of
/// the match operation. However, in the transition period for
/// #32330, it can happen that we sometimes have unconstrained
/// regions that get instantiated with fresh variables. In that
/// case, we collect the set of unconstrained bound regions here
/// and replace them with fresh variables.
pub unconstrained_regions: Vec<ty::BoundRegion>,
}

impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
Expand Down Expand Up @@ -97,6 +108,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
/// that do not appear in `T`. If that happens, those regions are
/// unconstrained, and this routine replaces them with `'static`.
pub fn higher_ranked_match<T, U>(&mut self,
span: Span,
a_pair: &Binder<(T, U)>,
b_match: &T,
a_is_expected: bool)
Expand Down Expand Up @@ -146,16 +158,28 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
// be any region from the sets above, except for other members of
// `skol_map`. There should always be a representative if things
// are properly well-formed.
let mut unconstrained_regions = vec![];
let skol_representatives: FxHashMap<_, _> =
skol_resolution_map
.iter()
.map(|(&skol, &(_, ref regions))| {
.map(|(&skol, &(br, ref regions))| {
let representative =
regions.iter()
.filter(|&&r| !skol_resolution_map.contains_key(r))
.cloned()
.next()
.expect("no representative region");
.unwrap_or_else(|| { // [1]
unconstrained_regions.push(br);
self.infcx.next_region_var(
LateBoundRegion(span, br, HigherRankedType))
});

// [1] There should always be a representative,
// unless the higher-ranked region did not appear
// in the values being matched. We should reject
// as ill-formed cases that can lead to this, but
// right now we sometimes issue warnings (see
// #32330).

(skol, representative)
})
Expand Down Expand Up @@ -192,7 +216,10 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
// We are now done with these skolemized variables.
self.infcx.pop_skolemized(skol_map, snapshot);

Ok(HrMatchResult { value: a_value })
Ok(HrMatchResult {
value: a_value,
unconstrained_regions,
})
});
}

Expand Down Expand Up @@ -630,13 +657,28 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
skol_br,
tainted_region);

return Err(if overly_polymorphic {
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!");
TypeError::RegionsOverlyPolymorphic(skol_br, tainted_region)
return Err(TypeError::RegionsOverlyPolymorphic(skol_br,
tainted_region,
issue_32330));
} else {
debug!("Not as polymorphic!");
TypeError::RegionsInsufficientlyPolymorphic(skol_br, tainted_region)
})
return Err(TypeError::RegionsInsufficientlyPolymorphic(skol_br,
tainted_region,
issue_32330));
}
}
}

Expand Down
19 changes: 16 additions & 3 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub enum RegionVariableOrigin {
Coercion(Span),

// Region variables created as the values for early-bound regions
EarlyBoundRegion(Span, ast::Name),
EarlyBoundRegion(Span, ast::Name, Option<ty::Issue32330>),

// Region variables created for bound regions
// in a function or method that is called
Expand Down Expand Up @@ -989,7 +989,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
span: Span,
def: &ty::RegionParameterDef)
-> ty::Region<'tcx> {
self.next_region_var(EarlyBoundRegion(span, def.name))
self.next_region_var(EarlyBoundRegion(span, def.name, def.issue_32330))
}

/// Create a type inference variable for the given
Expand Down Expand Up @@ -1160,6 +1160,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
value.fold_with(&mut r)
}

/// Returns true if `T` contains unresolved type variables. In the
/// process of visiting `T`, this will resolve (where possible)
/// type variables in `T`, but it never constructs the final,
/// resolved type, so it's more efficient than
/// `resolve_type_vars_if_possible()`.
pub fn any_unresolved_type_vars<T>(&self, value: &T) -> bool
where T: TypeFoldable<'tcx>
{
let mut r = resolve::UnresolvedTypeFinder::new(self);
value.visit_with(&mut r)
}

pub fn resolve_type_and_region_vars_if_possible<T>(&self, value: &T) -> T
where T: TypeFoldable<'tcx>
{
Expand Down Expand Up @@ -1278,13 +1290,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
-> InferResult<'tcx, HrMatchResult<Ty<'tcx>>>
{
let match_pair = match_a.map_bound(|p| (p.projection_ty.trait_ref(self.tcx), p.ty));
let span = cause.span;
let trace = TypeTrace {
cause,
values: TraitRefs(ExpectedFound::new(true, match_pair.skip_binder().0, match_b))
};

let mut combine = self.combine_fields(trace, param_env);
let result = combine.higher_ranked_match(&match_pair, &match_b, true)?;
let result = combine.higher_ranked_match(span, &match_pair, &match_b, true)?;
Ok(InferOk { value: result, obligations: combine.obligations })
}

Expand Down
39 changes: 38 additions & 1 deletion src/librustc/infer/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use super::{InferCtxt, FixupError, FixupResult};
use ty::{self, Ty, TyCtxt, TypeFoldable};
use ty::fold::TypeFolder;
use ty::fold::{TypeFolder, TypeVisitor};

///////////////////////////////////////////////////////////////////////////
// OPPORTUNISTIC TYPE RESOLVER
Expand Down Expand Up @@ -80,6 +80,43 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolv
}
}

///////////////////////////////////////////////////////////////////////////
// UNRESOLVED TYPE FINDER

/// The unresolved type **finder** walks your type and searches for
/// type variables that don't yet have a value. They get pushed into a
/// vector. It does not construct the fully resolved type (which might
/// involve some hashing and so forth).
pub struct UnresolvedTypeFinder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
}

impl<'a, 'gcx, 'tcx> UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
UnresolvedTypeFinder { infcx }
}
}

impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'gcx, 'tcx> {
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
let t = self.infcx.shallow_resolve(t);
if t.has_infer_types() {
if let ty::TyInfer(_) = t.sty {
// Since we called `shallow_resolve` above, this must
// be an (as yet...) unresolved inference variable.
true
} else {
// Otherwise, visit its contents.
t.super_visit_with(self)
}
} else {
// Micro-optimize: no inference types at all Can't have unresolved type
// variables, no need to visit the contents.
false
}
}
}

///////////////////////////////////////////////////////////////////////////
// FULL TYPE RESOLUTION

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare_lint! {

declare_lint! {
pub UNUSED_EXTERN_CRATES,
Warn,
Allow,
"extern crates that are never used"
}

Expand Down
Loading