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

Skip to content

Rollup of 8 pull requests #65115

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 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0797712
Stabilize Option::deref and Option::deref_mut
SimonSapin Sep 23, 2019
e8796ca
Do not ICE when dereferencing non-Copy raw pointer
estebank Oct 2, 2019
1222cc9
permit asyncawait-ondeck to be added by anyone
nikomatsakis Oct 3, 2019
1fcbd90
Update triagebot.toml
nikomatsakis Oct 3, 2019
ed60cf2
When encountering chained operators use heuristics to recover from ba…
estebank Sep 30, 2019
6c9f298
review comments
estebank Sep 30, 2019
d7dceaa
Account for missing turbofish in paths too
estebank Sep 30, 2019
d27683a
Prove bad turbofish parser recovery in test
estebank Sep 30, 2019
dfdc369
review comments
estebank Oct 1, 2019
f1499a8
review comments
estebank Oct 1, 2019
02f57f8
review comments
estebank Oct 3, 2019
76456e7
review comments
estebank Oct 4, 2019
2d87bac
replace GeneratorSubsts with SubstsRef
csmoe Oct 3, 2019
fa7a87b
generate GeneratorSubsts from SubstsRef
csmoe Oct 3, 2019
774ea80
8000 replace GeneratorSubsts inside related types
csmoe Oct 3, 2019
ef9fe10
remove GeneratorSubsts visitors
csmoe Oct 3, 2019
afc0bb9
clean up GeneratorSubsts
csmoe Oct 3, 2019
e9009c8
[const-prop] Fix ICE when trying to eval polymorphic promoted MIR
wesleywiser Oct 3, 2019
91a096a
move middle::liveness to rustc_passes
Mark-Simulacrum Oct 4, 2019
bb70782
middle::dead -> rustc_passes
Mark-Simulacrum Oct 4, 2019
82bfd8e
middle::entry -> rustc_passes
Mark-Simulacrum Oct 4, 2019
7c3f65b
middle::intrinsicck -> rustc_passes
Mark-Simulacrum Oct 4, 2019
d0a6805
Allow unused attributes to avoid incremental bug
Mark-Simulacrum Oct 4, 2019
bf8eb09
Rollup merge of #64708 - SimonSapin:option-deref, r=Centril
Centril Oct 4, 2019
db4ad42
Rollup merge of #64909 - estebank:turbofish-reloaded, r=Centril
Centril Oct 4, 2019
21e57ee
Rollup merge of #65011 - estebank:ice-o-matic, r=zackmdavis
Centril Oct 4, 2019
fad8a7b
Rollup merge of #65064 - rust-lang:permit-asyncawait-ondeck-by-anyone…
Centril Oct 4, 2019
6967617
Rollup merge of #65066 - wesleywiser:fix_const_prop_ice_on_polymorphi…
Centril Oct 4, 2019
cfd51ca
Rollup merge of #65100 - csmoe:generator, r=nikomatsakis
Centril Oct 4, 2019
7f520da
Rollup merge of #65105 - Mark-Simulacrum:split-librustc, r=nikomatsakis
Centril Oct 4, 2019
f320add
Rollup merge of #65106 - Mark-Simulacrum:unused-attr-allow, r=Centril
Centril Oct 4, 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
generate GeneratorSubsts from SubstsRef
  • Loading branch information
csmoe committed Oct 4, 2019
commit fa7a87be638e4bcf0403f56413e6dbf9892e5582
8 changes: 4 additions & 4 deletions src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,12 @@ where
// Skip lifetime parameters of the enclosing item(s)
// Also skip the witness type, because that has no free regions.

for upvar_ty in substs.upvar_tys(def_id, self.tcx) {
for upvar_ty in substs.as_generator().upvar_tys(def_id, self.tcx) {
upvar_ty.visit_with(self);
}

substs.return_ty(def_id, self.tcx).visit_with(self);
substs.yield_ty(def_id, self.tcx).visit_with(self);
substs.as_generator().return_ty(def_id, self.tcx).visit_with(self);
substs.as_generator().yield_ty(def_id, self.tcx).visit_with(self);
}
_ => {
ty.super_visit_with(self);
Expand Down Expand Up @@ -902,7 +902,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
ty::Generator(def_id, substs, movability) => {
let generics = self.tcx.generics_of(def_id);
let substs =
self.tcx.mk_substs(substs.substs.iter().enumerate().map(|(index, &kind)| {
self.tcx.mk_substs(substs.iter().enumerate().map(|(index, &kind)| {
if index < generics.parent_count {
// Accommodate missing regions in the parent kinds...
self.fold_kind_mapping_missing_regions_to_empty(kind)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/tcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl<'tcx> Rvalue<'tcx> {
let ty = place.ty(local_decls, tcx).ty;
match ty.kind {
ty::Adt(adt_def, _) => adt_def.repr.discr_type().to_ty(tcx),
ty::Generator(_, substs, _) => substs.discr_ty(tcx),
ty::Generator(_, substs, _) => substs.as_generator().discr_ty(tcx),
_ => {
// This can only be `0`, for now, so `u8` will suffice.
tcx.types.u8
Expand Down
11 changes: 6 additions & 5 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2761,8 +2761,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
.collect(),

ty::Generator(def_id, ref substs, _) => {
let witness = substs.witness(def_id, self.tcx());
let witness = substs.as_generator().witness(def_id, self.tcx());
substs
.as_generator()
.upvar_tys(def_id, self.tcx())
.chain(iter::once(witness))
.collect()
Expand Down Expand Up @@ -3324,8 +3325,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
)?);

Ok(VtableGeneratorData {
generator_def_id: generator_def_id,
substs: substs.clone(),
generator_def_id,
substs,
nested: obligations,
})
}
Expand Down Expand Up @@ -3911,9 +3912,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
&mut self,
obligation: &TraitObligation<'tcx>,
closure_def_id: DefId,
substs: ty::GeneratorSubsts<'tcx>,
substs: SubstsRef<'tcx>,
) -> ty::PolyTraitRef<'tcx> {
let gen_sig = substs.poly_sig(closure_def_id, self.tcx());
let gen_sig = substs.as_generator().poly_sig(closure_def_id, self.tcx());

// (1) Feels icky to skip the binder here, but OTOH we know
// that the self-type is an generator type and hence is
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ impl<'tcx> TyCtxt<'tcx> {
#[inline]
pub fn mk_generator(self,
id: DefId,
generator_substs: GeneratorSubsts<'tcx>,
generator_substs: SubstsRef<'tcx>,
movability: hir::GeneratorMovability)
-> Ty<'tcx> {
self.mk_ty(Generator(id, generator_substs, movability))
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl FlagComputation {
&ty::Generator(_, ref substs, _) => {
self.add_flags(TypeFlags::HAS_TY_CLOSURE);
self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES);
self.add_substs(&substs.substs);
self.add_substs(substs);
}

&ty::GeneratorWitness(ref ts) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'tcx> Instance<'tcx> {
))
}
ty::Generator(def_id, substs, _) => {
let sig = substs.poly_sig(def_id, tcx);
let sig = substs.as_generator().poly_sig(def_id, tcx);

let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty);
Expand Down
15 changes: 7 additions & 8 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::session::{self, DataTypeKind};
use crate::ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions};
use crate::ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions, subst::SubstsRef};

use syntax::ast::{self, Ident, IntTy, UintTy};
use syntax::attr;
Expand All @@ -15,7 +15,6 @@ use std::ops::Bound;
use crate::hir;
use crate::ich::StableHashingContext;
use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
use crate::ty::GeneratorSubsts;
use crate::ty::subst::Subst;
use rustc_index::bit_set::BitSet;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
Expand Down Expand Up @@ -671,7 +670,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
tcx.intern_layout(unit)
}

ty::Generator(def_id, substs, _) => self.generator_layout(ty, def_id, &substs)?,
ty::Generator(def_id, substs, _) => self.generator_layout(ty, def_id, substs)?,

ty::Closure(def_id, ref substs) => {
let tys = substs.as_closure().upvar_tys(def_id, tcx);
Expand Down Expand Up @@ -1406,7 +1405,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
&self,
ty: Ty<'tcx>,
def_id: hir::def_id::DefId,
substs: &GeneratorSubsts<'tcx>,
substs: SubstsRef<'tcx>,
) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> {
use SavedLocalEligibility::*;
let tcx = self.tcx;
Expand All @@ -1419,9 +1418,9 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
// Build a prefix layout, including "promoting" all ineligible
// locals as part of the prefix. We compute the layout of all of
// these fields at once to get optimal packing.
let discr_index = substs.prefix_tys(def_id, tcx).count();
let discr_index = substs.as_generator().prefix_tys(def_id, tcx).count();
// FIXME(eddyb) set the correct vaidity range for the discriminant.
let discr_layout = self.layout_of(substs.discr_ty(tcx))?;
let discr_layout = self.layout_of(substs.as_generator().discr_ty(tcx))?;
let discr = match &discr_layout.abi {
Abi::Scalar(s) => s.clone(),
_ => bug!(),
Expand Down Expand Up @@ -2153,15 +2152,15 @@ where
ty::Generator(def_id, ref substs, _) => {
match this.variants {
Variants::Single { index } => {
substs.state_tys(def_id, tcx)
substs.as_generator().state_tys(def_id, tcx)
.nth(index.as_usize()).unwrap()
.nth(i).unwrap()
}
Variants::Multiple { ref discr, discr_index, .. } => {
if i == discr_index {
return discr_layout(discr);
}
substs.prefix_tys(def_id, tcx).nth(i).unwrap()
substs.as_generator().prefix_tys(def_id, tcx).nth(i).unwrap()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/outlives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<'tcx> TyCtxt<'tcx> {

ty::Generator(def_id, ref substs, _) => {
// Same as the closure case
for upvar_ty in substs.upvar_tys(def_id, *self) {
for upvar_ty in substs.as_generator().upvar_tys(def_id, *self) {
self.compute_components(upvar_ty, out);
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/print/obsolete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl DefPathBasedNames<'tcx> {
self.push_type_name(sig.output(), output, debug);
}
}
ty::Generator(def_id, GeneratorSubsts { substs }, _)
ty::Generator(def_id, substs, _)
| ty::Closure(def_id, substs) => {
self.push_def_path(def_id, output);
let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id));
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/print/pretty.rs
10000
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ pub trait PrettyPrinter<'tcx>:
}
ty::Str => p!(write("str")),
ty::Generator(did, substs, movability) => {
let upvar_tys = substs.upvar_tys(did, self.tcx());
let witness = substs.witness(did, self.tcx());
let upvar_tys = substs.as_generator().upvar_tys(did, self.tcx());
let witness = substs.as_generator().witness(did, self.tcx());
if movability == hir::GeneratorMovability::Movable {
p!(write("[generator"));
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,8 @@ impl<'tcx> TyS<'tcx> {
pub fn variant_range(&self, tcx: TyCtxt<'tcx>) -> Option<Range<VariantIdx>> {
match self.kind {
TyKind::Adt(adt, _) => Some(adt.variant_range()),
TyKind::Generator(def_id, substs, _) => Some(substs.variant_range(def_id, tcx)),
TyKind::Generator(def_id, substs, _) =>
Some(substs.assert_generator().variant_range(def_id, tcx)),
_ => None,
}
}
Expand All @@ -2126,7 +2127,7 @@ impl<'tcx> TyS<'tcx> {
match self.kind {
TyKind::Adt(adt, _) => Some(adt.discriminant_for_variant(tcx, variant_index)),
TyKind::Generator(def_id, substs, _) =>
Some(substs.discriminant_for_variant(def_id, tcx, variant_index)),
Some(substs.as_generator().discriminant_for_variant(def_id, tcx, variant_index)),
_ => None,
}
}
Expand All @@ -2149,7 +2150,7 @@ impl<'tcx> TyS<'tcx> {
out.extend(substs.regions())
}
Closure(_, ref substs ) |
Generator(_, GeneratorSubsts { ref substs }, _) => {
Generator(_, ref substs, _) => {
out.extend(substs.regions())
}
Projection(ref data) | UnnormalizedProjection(ref data) => {
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/ty/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
ty::Adt(_, substs) | ty::Opaque(_, substs) => {
stack.extend(substs.types().rev());
}
ty::Closure(_, ref substs) => {
ty::Closure(_, ref substs)
| ty::Generator(_, ref substs, _) => {
stack.extend(substs.types().rev());
}
ty::Generator(_, ref substs, _) => {
stack.extend(substs.substs.types().rev());
}
ty::GeneratorWitness(ts) => {
stack.extend(ts.skip_binder().iter().cloned().rev());
}
Expand Down
0