Skip to content

Rollup of 4 pull requests #64800

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 33 commits into from
Closed
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5d79e8c
reserve `impl<T> From<!> for T`
arielb1 Jul 13, 2019
9a94ecd
improve and add tests
arielb1 Jul 13, 2019
1ec7ae1
resolve the rustc_reservation_impl attribute in 1 place
arielb1 Jul 13, 2019
b5665e8
improve comments
arielb1 Jul 27, 2019
9196b2d
add error message for case
arielb1 Jul 27, 2019
d7eb562
add test for lattice specialization
arielb1 Sep 14, 2019
5de1faf
improve comment
arielb1 Sep 18, 2019
68fd593
cite reservation impls tracking issue
nikomatsakis Sep 23, 2019
b40a64d
remove outdated fixme
nikomatsakis Sep 23, 2019
da60c53
nit: update text to avoid "lattice specialization" term
nikomatsakis Sep 23, 2019
167ab04
nit: update error text to cite tracking issue
nikomatsakis Sep 23, 2019
99dc545
add a rustdoc comment to the reservation impl
nikomatsakis Sep 24, 2019
2808a46
Rename non-`TyS` uses of `sty`
varkor Sep 16, 2019
e2e0f9a
Rename `sty` to `kind`
varkor Sep 16, 2019
bd5adc5
Rename surviving uses of `sty`
varkor Sep 16, 2019
93df1bb
Fix rebase
varkor Sep 25, 2019
b6fc4b1
Refuse downgrading NLL errors on Rust 2015.
Centril Sep 6, 2019
0c7c98f
rustc_mir: remove dead code for downgrading errors.
Centril Sep 6, 2019
b9eaad2
Adjust & --bless tests due to no longer downgrading NLL errors on 2015.
Centril Sep 6, 2019
419ed8b
add test for #53432.
Centril Sep 6, 2019
b10b8a7
remove feature(nll) from #45157 test.
Centril Sep 6, 2019
947c10c
remove feature(nll) from #31567 test.
Centril Sep 6, 2019
af26372
remove feature(nll) from #27868 test.
Centril Sep 6, 2019
86481e1
remove feature(nll) in more cases.
Centril Sep 6, 2019
9f3e61b
rm "src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.s…
Centril Sep 25, 2019
4503ad4
issue-#45696-scribble...: remove outdated comment.
Centril Sep 25, 2019
e70724c
address rebase damage
arielb1 Sep 24, 2019
bc2a373
Fix fallout
varkor Sep 25, 2019
80db06d
Fix ExitStatus on Fuchsia
tmandry Sep 25, 2019
06f6b8a
Rollup merge of #62661 - arielb1:never-reserve, r=nikomatsakis
Centril Sep 26, 2019
33ef5dd
Rollup merge of #64221 - Centril:nll-no-migrate-2015, r=matthewjasper
Centril Sep 26, 2019
64e8527
Rollup merge of #64513 - varkor:sty-begone, r=eddyb
Centril Sep 26, 2019
2c7796a
Rollup merge of #64787 - tmandry:fuchsia-exitstatus, r=cramertj
Centril Sep 26, 2019
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
12 changes: 12 additions & 0 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
@@ -554,6 +554,18 @@ impl<T> From<T> for T {
fn from(t: T) -> T { t }
}

/// **Stability note:** This impl does not yet exist, but we are
/// "reserving space" to add it in the future. See
/// [rust-lang/rust#64715][#64715] for details.
///
/// [#64715]: https://github.com/rust-lang/rust/issues/64715
#[stable(feature = "convert_infallible", since = "1.34.0")]
#[cfg(not(bootstrap))]
#[rustc_reservation_impl="permitting this impl would forbid us from adding \
`impl<T> From<!> for T` later; see rust-lang/rust#64715 for details"]
impl<T> From<!> for T {
fn from(t: !) -> T { t }
}

// TryFrom implies TryInto
#[stable(feature = "try_from", since = "1.34.0")]
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
@@ -343,7 +343,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
}

fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match t.sty {
match t.kind {
ty::Infer(ty::TyVar(vid)) => {
debug!("canonical: type var found with vid {:?}", vid);
match self.infcx.unwrap().probe_ty_var(vid) {
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
@@ -471,7 +471,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
match result_value.unpack() {
UnpackedKind::Type(result_value) => {
// e.g., here `result_value` might be `?0` in the example above...
if let ty::Bound(debruijn, b) = result_value.sty {
if let ty::Bound(debruijn, b) = result_value.kind {
// ...in which case we would set `canonical_vars[0]` to `Some(?U)`.

// We only allow a `ty::INNERMOST` index in substitutions.
4 changes: 2 additions & 2 deletions src/librustc/infer/combine.rs
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
{
let a_is_expected = relation.a_is_expected();

match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
// Relate integral variables to other types
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
self.int_unification_table
@@ -486,7 +486,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
// any other type variable related to `vid` via
// subtyping. This is basically our "occurs check", preventing
// us from creating infinitely sized types.
match t.sty {
match t.kind {
ty::Infer(ty::TyVar(vid)) => {
let mut variables = self.infcx.type_variables.borrow_mut();
let vid = variables.root_var(vid);
2 changes: 1 addition & 1 deletion src/librustc/infer/equate.rs
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {

debug!("{}.tys: replacements ({:?}, {:?})", self.tag(), a, b);

match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
(&ty::Infer(TyVar(a_id)), &ty::Infer(TyVar(b_id))) => {
infcx.type_variables.borrow_mut().equate(a_id, b_id);
}
18 changes: 9 additions & 9 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
@@ -589,7 +589,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// if they are both "path types", there's a chance of ambiguity
// due to different versions of the same crate
if let (&ty::Adt(exp_adt, _), &ty::Adt(found_adt, _))
= (&exp_found.expected.sty, &exp_found.found.sty)
= (&exp_found.expected.kind, &exp_found.found.kind)
{
report_path_match(err, exp_adt.did, found_adt.did);
}
@@ -803,7 +803,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
return Some(());
}
if let &ty::Adt(def, _) = &ta.sty {
if let &ty::Adt(def, _) = &ta.kind {
let path_ = self.tcx.def_path_str(def.did.clone());
if path_ == other_path {
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
@@ -868,7 +868,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// relevant differences, and return two representation of those types for highlighted printing.
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
(a, b) if *a == *b => true,
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Int(_))
@@ -902,7 +902,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
s.push_normal(ty.to_string());
}

match (&t1.sty, &t2.sty) {
match (&t1.kind, &t2.kind) {
(&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => {
let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1);
let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2);
@@ -1138,7 +1138,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
match (terr, is_simple_error, expected == found) {
(&TypeError::Sorts(ref values), false, true) => {
let sort_string = | a_type: Ty<'tcx> |
if let ty::Opaque(def_id, _) = a_type.sty {
if let ty::Opaque(def_id, _) = a_type.kind {
format!(" (opaque type at {})", self.tcx.sess.source_map()
.mk_substr_filename(self.tcx.def_span(def_id)))
} else {
@@ -1179,9 +1179,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>,
diag: &mut DiagnosticBuilder<'tcx>,
) {
match (&exp_found.expected.sty, &exp_found.found.sty) {
match (&exp_found.expected.kind, &exp_found.found.kind) {
(ty::Adt(exp_def, exp_substs), ty::Ref(_, found_ty, _)) => {
if let ty::Adt(found_def, found_substs) = found_ty.sty {
if let ty::Adt(found_def, found_substs) = found_ty.kind {
let path_str = format!("{:?}", exp_def);
if exp_def == &found_def {
let opt_msg = "you can convert from `&Option<T>` to `Option<&T>` using \
@@ -1203,9 +1203,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
{
let mut show_suggestion = true;
for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) {
match exp_ty.sty {
match exp_ty.kind {
ty::Ref(_, exp_ty, _) => {
match (&exp_ty.sty, &found_ty.sty) {
match (&exp_ty.kind, &found_ty.kind) {
(_, ty::Param(_)) |
(_, ty::Infer(_)) |
(ty::Param(_), _) |
8 changes: 4 additions & 4 deletions src/librustc/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> {
Some(ty) => {
let ty = self.infcx.resolve_vars_if_possible(&ty);
if ty.walk().any(|inner_ty| {
inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
inner_ty == self.target_ty || match (&inner_ty.kind, &self.target_ty.kind) {
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
self.infcx
.type_variables
@@ -151,7 +151,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
ty: Ty<'tcx>,
highlight: Option<ty::print::RegionHighlightMode>,
) -> (String, Option<Span>) {
if let ty::Infer(ty::TyVar(ty_vid)) = ty.sty {
if let ty::Infer(ty::TyVar(ty_vid)) = ty.kind {
let ty_vars = self.type_variables.borrow();
let var_origin = ty_vars.var_origin(ty_vid);
if let TypeVariableOriginKind::TypeParameterDefinition(name) = var_origin.kind {
@@ -219,7 +219,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
};

let ty_msg = match local_visitor.found_ty {
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
let fn_sig = substs.closure_sig(*def_id, self.tcx);
let args = closure_args(&fn_sig);
let ret = fn_sig.output().skip_binder().to_string();
@@ -254,7 +254,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
);

let suffix = match local_visitor.found_ty {
Some(ty::TyS { sty: ty::Closure(def_id, substs), .. }) => {
Some(ty::TyS { kind: ty::Closure(def_id, substs), .. }) => {
let fn_sig = substs.closure_sig(*def_id, self.tcx);
let ret = fn_sig.output().skip_binder().to_string();

Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
decl: &hir::FnDecl,
) -> Option<Span> {
let ret_ty = self.tcx().type_of(scope_def_id);
if let ty::FnDef(_, _) = ret_ty.sty {
if let ty::FnDef(_, _) = ret_ty.kind {
let sig = ret_ty.fn_sig(self.tcx());
let late_bound_regions = self.tcx()
.collect_referenced_late_bound_regions(&sig.output());
2 changes: 1 addition & 1 deletion src/librustc/infer/freshen.rs
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {

let tcx = self.infcx.tcx;

match t.sty {
match t.kind {
ty::Infer(ty::TyVar(v)) => {
let opt_ty = self.infcx.type_variables.borrow_mut().probe(v).known();
self.freshen_ty(
2 changes: 1 addition & 1 deletion src/librustc/infer/fudge.rs
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for InferenceFudger<'a, 'tcx> {
}

fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
match ty.sty {
match ty.kind {
ty::Infer(ty::InferTy::TyVar(vid)) => {
if self.type_vars.0.contains(&vid) {
// This variable was created during the fudging.
2 changes: 1 addition & 1 deletion src/librustc/infer/lattice.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ where
let infcx = this.infcx();
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
// If one side is known to be a variable and one is not,
// create a variable (`v`) to represent the LUB. Make sure to
// relate `v` to the non-type-variable first (by passing it
8 changes: 4 additions & 4 deletions src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
@@ -614,7 +614,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}

pub fn type_var_diverges(&'a self, ty: Ty<'_>) -> bool {
match ty.sty {
match ty.kind {
ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid),
_ => false,
}
@@ -627,7 +627,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn type_is_unconstrained_numeric(&'a self, ty: Ty<'_>) -> UnconstrainedNumeric {
use crate::ty::error::UnconstrainedNumeric::Neither;
use crate::ty::error::UnconstrainedNumeric::{UnconstrainedFloat, UnconstrainedInt};
match ty.sty {
match ty.kind {
ty::Infer(ty::IntVar(vid)) => {
if self.int_unification_table
.borrow_mut()
@@ -1563,7 +1563,7 @@ impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
}

pub fn shallow_resolve(&mut self, typ: Ty<'tcx>) -> Ty<'tcx> {
match typ.sty {
match typ.kind {
ty::Infer(ty::TyVar(v)) => {
// Not entirely obvious: if `typ` is a type variable,
// it can be resolved to an int/float variable, which
@@ -1604,7 +1604,7 @@ impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
// are extremely hot.
#[inline(always)]
pub fn shallow_resolve_changed(&mut self, typ: Ty<'tcx>) -> bool {
match typ.sty {
match typ.kind {
ty::Infer(ty::TyVar(v)) => {
use self::type_variable::TypeVariableValue;

8 changes: 4 additions & 4 deletions src/librustc/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
@@ -274,7 +274,7 @@ where
use crate::traits::WhereClause;
use syntax_pos::DUMMY_SP;

match value_ty.sty {
match value_ty.kind {
ty::Projection(other_projection_ty) => {
let var = self.infcx.next_ty_var(TypeVariableOrigin {
kind: TypeVariableOriginKind::MiscVariable,
@@ -328,7 +328,7 @@ where
// This only presently applies to chalk integration, as NLL
// doesn't permit type variables to appear on both sides (and
// doesn't use lazy norm).
match value_ty.sty {
match value_ty.kind {
ty::Infer(ty::TyVar(value_vid)) => {
// Two type variables: just equate them.
self.infcx
@@ -548,7 +548,7 @@ where
b = self.infcx.shallow_resolve(b);
}

match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
(_, &ty::Infer(ty::TyVar(vid))) => {
if D::forbid_inference_vars() {
// Forbid inference variables in the RHS.
@@ -878,7 +878,7 @@ where

debug!("TypeGeneralizer::tys(a={:?})", a);

match a.sty {
match a.kind {
ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_))
if D::forbid_inference_vars() =>
{
6 changes: 3 additions & 3 deletions src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
@@ -720,7 +720,7 @@ where
return false; // keep visiting
}

match ty.sty {
match ty.kind {
ty::Closure(def_id, ref substs) => {
// Skip lifetime parameters of the enclosing item(s)

@@ -857,7 +857,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
}

fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
match ty.sty {
match ty.kind {
ty::Closure(def_id, substs) => {
// I am a horrible monster and I pray for death. When
// we encounter a closure here, it is always a closure
@@ -990,7 +990,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
ty_op: |ty| {
if ty.references_error() {
return tcx.types.err;
} else if let ty::Opaque(def_id, substs) = ty.sty {
} else if let ty::Opaque(def_id, substs) = ty.kind {
// Check that this is `impl Trait` type is
// declared by `parent_def_id` -- i.e., one whose
// value we are inferring. At present, this is
2 changes: 1 addition & 1 deletion src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
@@ -403,7 +403,7 @@ where
// 'a` in the environment but `trait Foo<'b> { type Item: 'b
// }` in the trait definition.
approx_env_bounds.retain(|bound| {
match bound.0.sty {
match bound.0.kind {
ty::Projection(projection_ty) => {
self.verify_bound.projection_declared_bounds_from_trait(projection_ty)
.all(|r| r != bound.1)
4 changes: 2 additions & 2 deletions src/librustc/infer/outlives/verify.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
}

fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
match ty.sty {
match ty.kind {
ty::Param(p) => self.param_bound(p),
ty::Projection(data) => self.projection_bound(data),
_ => self.recursive_type_bound(ty),
@@ -87,7 +87,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
let projection_ty = GenericKind::Projection(projection_ty).to_ty(self.tcx);
let erased_projection_ty = self.tcx.erase_regions(&projection_ty);
self.declared_generic_bounds_from_env_with_compare_fn(|ty| {
if let ty::Projection(..) = ty.sty {
if let ty::Projection(..) = ty.kind {
let erased_ty = self.tcx.erase_regions(&ty);
erased_ty == erased_projection_ty
} else {
4 changes: 2 additions & 2 deletions src/librustc/infer/resolve.rs
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, '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::Infer(infer_ty) = t.sty {
if let ty::Infer(infer_ty) = t.kind {
// Since we called `shallow_resolve` above, this must
// be an (as yet...) unresolved inference variable.
let ty_var_span =
@@ -188,7 +188,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
// defaulted tuples.
} else {
let t = self.infcx.shallow_resolve(t);
match t.sty {
match t.kind {
ty::Infer(ty::TyVar(vid)) => {
self.err = Some(FixupError::UnresolvedTy(vid));
self.tcx().types.err
2 changes: 1 addition & 1 deletion src/librustc/infer/sub.rs
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
let infcx = self.fields.infcx;
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
match (&a.sty, &b.sty) {
match (&a.kind, &b.kind) {
(&ty::Infer(TyVar(a_vid)), &ty::Infer(TyVar(b_vid))) => {
// Shouldn't have any LBR here, so we can safely put
// this under a binder below without fear of accidental
2 changes: 1 addition & 1 deletion src/librustc/infer/type_variable.rs
Original file line number Diff line number Diff line change
@@ -247,7 +247,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
/// instantiated, then return the with which it was
/// instantiated. Otherwise, returns `t`.
pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match t.sty {
match t.kind {
ty::Infer(ty::TyVar(v)) => {
match self.probe(v) {
TypeVariableValue::Unknown { .. } => t,
2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
@@ -829,7 +829,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
trait_ref: Option<ty::TraitRef<'tcx>>,
) -> Result<Self::Path, Self::Error> {
if trait_ref.is_none() {
if let ty::Adt(def, substs) = self_ty.sty {
if let ty::Adt(def, substs) = self_ty.kind {
return self.print_def_path(def.did, substs);
}
}
Loading