8000 Rollup of 4 pull requests by Centril · Pull Request #64804 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 4 pull requests #64804

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 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 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
40fad74
Remove global_tcx from TyCtxt
Mark-Simulacrum Sep 25, 2019
5cebfa5
Remove lift_to_global
Mark-Simulacrum Sep 25, 2019
e70724c
address rebase damage
arielb1 Sep 24, 2019
9f63a3a
Remove stray uses of gcx name
Mark-Simulacrum Sep 25, 2019
4469bdd
Remove shrink_to_tcx_lifetime
Mark-Simulacrum Sep 25, 2019
80db06d
Fix ExitStatus on Fuchsia
tmandry Sep 25, 2019
ece6f83
Refuse downgrading NLL errors on Rust 2015.
Centril Sep 6, 2019
aff9c83
rustc_mir: remove dead code for downgrading errors.
Centril Sep 6, 2019
6ec9b3a
Adjust & --bless tests due to no longer downgrading NLL errors on 2015.
Centril Sep 6, 2019
487f8ab
add test for #53432.
Centril Sep 6, 2019
2fb0bba
remove feature(nll) from #45157 test.
Centril Sep 6, 2019
1256613
remove feature(nll) from #31567 test.
Centril Sep 6, 2019
b638aa1
remove feature(nll) from #27868 test.
Centril Sep 6, 2019
2b80ed9
remove feature(nll) in more cases.
Centril Sep 6, 2019
dfdd4d7
rm "src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.s…
Centril Sep 25, 2019
ce8c5d2
issue-#45696-scribble...: remove outdated comment.
Centril Sep 25, 2019
f8af766
cargotest: bump webrender
Centril Sep 26, 2019
9a2cc54
cargotest: bump iron
Centril Sep 26, 2019
53d1fca
Rollup merge of #62661 - arielb1:never-reserve, r=nikomatsakis
Centril Sep 26, 2019
d4b4b7f
Rollup merge of #64221 - Centril:nll-no-migrate-2015, r=matthewjasper
Centril Sep 26, 2019
d8406ff
Rollup merge of #64781 - Mark-Simulacrum:no-global-tcx, r=eddyb
Centril Sep 26, 2019
e9843f9
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
Prev Previous commit
Next Next commit
Remove shrink_to_tcx_lifetime
There's no longer two distinct gcx and tcx lifetimes which made this
necessary (or, at least, the code compiles -- it's possible we got
better at normalizing, but that seems unlikely).
  • Loading branch information
Mark-Simulacrum committed Sep 25, 2019
commit 4469bddaad6b797af06950c85e270e0172f5aa53
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/ascribe_user_type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::hir::def_id::DefId;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
Expand Down Expand Up @@ -37,12 +37,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_ascribe_user_type(canonicalized)
}

fn shrink_to_tcx_lifetime(
< 8000 span class='blob-code-inner blob-code-marker js-skip-tagsearch' data-code-marker="-"> v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/eq.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};

Expand Down Expand Up @@ -34,12 +34,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_eq(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/implied_outlives_bounds.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::outlives_bounds::OutlivesBound;
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
Expand Down Expand Up @@ -38,12 +38,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {

tcx.implied_outlives_bounds(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
21 changes: 2 additions & 19 deletions src/librustc/traits/query/type_op/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::infer::canonical::{
Canonical, Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues,
QueryRegionConstraints, QueryResponse,
Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues,
QueryRegionConstraints,
};
use crate::infer::{InferCtxt, InferOk};
use std::fmt;
Expand Down Expand Up @@ -66,22 +66,6 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>>;

/// Casts a lifted query result (which is in the tcx lifetime)
/// into the tcx lifetime. This is always just an identity cast,
/// but the generic code doesn't realize it -- put another way, in
/// the generic code, we have a `Lifted<'tcx, Self::QueryResponse>`
/// and we want to convert that to a `Self::QueryResponse`. This is
/// not a priori valid, so we can't do it -- but in practice, it
/// is always a no-op (e.g., the lifted form of a type,
/// `Ty<'tcx>`, is a subtype of `Ty<'tcx>`). So we have to push
/// the operation into the impls that know more specifically what
/// `QueryResponse` is. This operation would (maybe) be nicer with
/// something like HKTs or GATs, since then we could make
/// `QueryResponse` parametric and `'tcx` and `'tcx` etc.
fn shrink_to_tcx_lifetime( 10000
lifted_query_result: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>>;

fn fully_perform_into(
query_key: ParamEnvAnd<'tcx, Self>,
infcx: &InferCtxt<'_, 'tcx>,
Expand All @@ -99,7 +83,6 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
let canonical_self =
infcx.canonicalize_hr_query_hack(&query_key, &mut canonical_var_values);
let canonical_result = Self::perform_query(infcx.tcx, canonical_self)?;
let canonical_result = Self::shrink_to_tcx_lifetime(&canonical_result);

let param_env = query_key.param_env;

Expand Down
38 changes: 1 addition & 37 deletions src/librustc/traits/query/type_op/normalize.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use std::fmt;
use crate::traits::query::Fallible;
use crate::ty::fold::TypeFoldable;
Expand Down Expand Up @@ -38,25 +38,13 @@ where
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>> {
T::type_op_method(tcx, canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, T>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, T>> {
T::shrink_to_tcx_lifetime(v)
}
}

pub trait Normalizable<'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'tcx> + Copy {
fn type_op_method(
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>>;

/// Converts from the `'tcx` (lifted) form of `Self` into the `tcx`
/// form of `Self`.
fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>>;
}

impl Normalizable<'tcx> for Ty<'tcx> {
Expand All @@ -66,12 +54,6 @@ impl Normalizable<'tcx> for Ty<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_ty(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}

impl Normalizable<'tcx> for ty::Predicate<'tcx> {
Expand All @@ -81,12 +63,6 @@ impl Normalizable<'tcx> for ty::Predicate<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_predicate(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}

impl Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
Expand All @@ -96,12 +72,6 @@ impl Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_poly_fn_sig(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}

impl Normalizable<'tcx> for ty::FnSig<'tcx> {
Expand All @@ -111,12 +81,6 @@ impl Normalizable<'tcx> for ty::FnSig<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>> {
tcx.type_op_normalize_fn_sig(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, Self>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/outlives.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::dropck_outlives::trivial_dropck_outlives;
use crate::traits::query::dropck_outlives::DropckOutlivesResult;
use crate::traits::query::Fallible;
Expand Down Expand Up @@ -53,12 +53,6 @@ impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {

tcx.dropck_outlives(canonicalized)
}

fn shrink_to_tcx_lifetime(
lifted_query_result: &'a CanonicalizedQueryResponse<'tcx, Self::QueryResponse>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, Self::QueryResponse>> {
lifted_query_result
}
}

BraceStructTypeFoldableImpl! {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/prove_predicate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Predicate, TyCtxt};

Expand Down Expand Up @@ -43,12 +43,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_prove_predicate(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc/traits/query/type_op/subtype.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse};
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};

Expand Down Expand Up @@ -34,12 +34,6 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
tcx.type_op_subtype(canonicalized)
}

fn shrink_to_tcx_lifetime(
v: &'a CanonicalizedQueryResponse<'tcx, ()>,
) -> &'a Canonical<'tcx, QueryResponse<'tcx, ()>> {
v
}
}

BraceStructTypeFoldableImpl! {
Expand Down
0