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

Rollup of 10 pull requests #80061

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
94d73d4
Refactor `parse_prefix` on Windows
CDirkx Nov 3, 2020
ea14607
make MIR graphviz generation use gsgdt
vn-ki Oct 26, 2020
5b049e1
write to a String instead to reduce churn
vn-ki Oct 26, 2020
a4e94ec
update gsgdt
vn-ki Oct 27, 2020
86a7831
formatting
vn-ki Nov 9, 2020
51ecb96
add different color for cleanup nodes in dark mode
vn-ki Nov 12, 2020
6fe31e7
fix clippy test
vn-ki Dec 5, 2020
7cb74ed
Remove memoization leftovers
Dec 8, 2020
de1cd4b
Extra assertions in eval_body_using_ecx to disallow queries for
Dec 9, 2020
b6f7eef
Remove unnecessary check and fix local_def_id parameter
Dec 10, 2020
a03feaa
add missing constraints
Dec 11, 2020
ed80815
Move binder for dyn to each list item
jackh726 Dec 11, 2020
0f30b7d
fix panic if converting ZST Vec to VecDeque
Stupremee Dec 13, 2020
d75618e
replace assert! with assert_eq!
Stupremee Dec 13, 2020
94fd1d3
BTreeMap: more expressive local variables in merge
ssomers Nov 23, 2020
09d528e
fix typo
Stupremee Dec 13, 2020
6c7835e
BTreeSet: simplify implementation of pop_first/pop_last
ssomers Nov 20, 2020
357565d
expand-yaml-anchors: Make the output directory separator-insensitive
JohnTitor Dec 14, 2020
01c2520
Add explanation for skip_binder in relate
jackh726 Dec 14, 2020
777ca99
Optimization for bool's PartialOrd impl
ChayimFriedman2 Dec 14, 2020
1b74a82
Always run intrinsics lowering pass
tmiasko Dec 15, 2020
8c51cf0
Rollup merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
Dylan-DPC Dec 15, 2020
c42967b
Rollup merge of #78833 - CDirkx:parse_prefix, r=dtolnay
Dylan-DPC Dec 15, 2020
13c85b3
Rollup merge of #79840 - dvtkrlbs:issue-79667, r=oli-obk
Dylan-DPC Dec 15, 2020
b3e09ce
Rollup merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
Dylan-DPC Dec 15, 2020
1489095
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic,…
Dylan-DPC Dec 15, 2020
ca1010e
Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-Simulacrum
Dylan-DPC Dec 15, 2020
125f19c
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
Dylan-DPC Dec 15, 2020
da1e5eb
Rollup merge of #80026 - JohnTitor:separator-insensitive, r=Mark-Simu…
Dylan-DPC Dec 15, 2020
185936b
Rollup merge of #80035 - ChayimFriedman2:patch-1, r=nagisa
Dylan-DPC Dec 15, 2020
7a08349
Rollup merge of #80040 - tmiasko:always-lower-intrinsics, r=nagisa
Dylan-DPC Dec 15, 2020
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
10 changes: 10 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,15 @@ dependencies = [
"regex",
]

[[package]]
name = "gsgdt"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0d876ce7262df96262a2a19531da6ff9a86048224d49580a585fc5c04617825"
dependencies = [
"serde",
]

[[package]]
name = "handlebars"
version = "3.4.0"
Expand Down Expand Up @@ -3940,6 +3949,7 @@ version = "0.0.0"
dependencies = [
"coverage_test_macros",
"either",
"gsgdt",
"itertools 0.9.0",
"polonius-engine",
"regex",
Expand Down
24 changes: 13 additions & 11 deletions compiler/rustc_codegen_cranelift/src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,19 @@ impl<'tcx> CPlace<'tcx> {
// fn(&T) -> for<'l> fn(&'l T) is allowed
}
(&ty::Dynamic(from_traits, _), &ty::Dynamic(to_traits, _)) => {
let from_traits = fx
.tcx
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), from_traits);
let to_traits = fx
.tcx
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), to_traits);
assert_eq!(
from_traits, to_traits,
"Can't write trait object of incompatible traits {:?} to place with traits {:?}\n\n{:#?}",
from_traits, to_traits, fx,
);
for (from, to) in from_traits.iter().zip(to_traits) {
let from = fx
.tcx
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), from);
let to = fx
.tcx
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), to);
assert_eq!(
from, to,
"Can't write trait object of incompatible traits {:?} to place with traits {:?}\n\n{:#?}",
from_traits, to_traits, fx,
);
}
// dyn for<'r> Trait<'r> -> dyn Trait<'_> is allowed
}
_ => {
Expand Down
16 changes: 1 addition & 15 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
return;
}

sym::unreachable => {
return;
}
sym::va_start => bx.va_start(args[0].immediate()),
sym::va_end => bx.va_end(args[0].immediate()),
sym::size_of_val => {
Expand All @@ -106,8 +103,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.const_usize(bx.layout_of(tp_ty).align.abi.bytes())
}
}
sym::size_of
| sym::pref_align_of
sym::pref_align_of
| sym::min_align_of
| sym::needs_drop
| sym::type_id
Expand All @@ -119,10 +115,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
.unwrap();
OperandRef::from_const(bx, value, ret_ty).immediate_or_packed_pair(bx)
}
// Effectively no-op
sym::forget => {
return;
}
sym::offset => {
let ptr = args[0].immediate();
let offset = args[1].immediate();
Expand Down Expand Up @@ -218,9 +210,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
sym::add_with_overflow
| sym::sub_with_overflow
| sym::mul_with_overflow
| sym::wrapping_add
| sym::wrapping_sub
| sym::wrapping_mul
| sym::unchecked_div
| sym::unchecked_rem
| sym::unchecked_shl
Expand Down Expand Up @@ -254,9 +243,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {

return;
}
sym::wrapping_add => bx.add(args[0].immediate(), args[1].immediate()),
sym::wrapping_sub => bx.sub(args[0].immediate(), args[1].immediate()),
sym::wrapping_mul => bx.mul(args[0].immediate(), args[1].immediate()),
sym::exact_div => {
if signed {
bx.exactsdiv(args[0].immediate(), args[1].immediate())
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {

fn print_dyn_existential(
self,
_predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
_predicates: &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
) -> Result<Self::DynExistential, Self::Error> {
Err(NonTrivialPath)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ impl<'tcx> LateContext<'tcx> {

fn print_dyn_existential(
self,
_predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
_predicates: &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
) -> Result<Self::DynExistential, Self::Error> {
Ok(())
}
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
}
ty::Dynamic(binder, _) => {
let mut has_emitted = false;
for predicate in binder.skip_binder().iter() {
if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate {
for predicate in binder.iter() {
if let ty::ExistentialPredicate::Trait(ref trait_ref) =
predicate.skip_binder()
{
let def_id = trait_ref.def_id;
let descr_post =
&format!(" trait object{}{}", plural_suffix, descr_post,);
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/mir/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ pub use self::pointer::{Pointer, PointerArithmetic};
/// Uniquely identifies one of the following:
/// - A constant
/// - A static
/// - A const fn where all arguments (if any) are zero-sized types
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, Lift)]
pub struct GlobalId<'tcx> {
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_middle/src/ty/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,14 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<Ty<'tcx>> {
}
}

impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::ExistentialPredicate<'tcx>> {
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D>
for ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>
{
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
let len = decoder.read_usize()?;
Ok(decoder.tcx().mk_existential_predicates((0..len).map(|_| Decodable::decode(decoder)))?)
Ok(decoder
.tcx()
.mk_poly_existential_predicates((0..len).map(|_| Decodable::decode(decoder)))?)
}
}

Expand Down Expand Up @@ -373,7 +377,7 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [mir::abstract_const::N
impl_decodable_via_ref! {
&'tcx ty::TypeckResults<'tcx>,
&'tcx ty::List<Ty<'tcx>>,
&'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
&'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
&'tcx Allocation,
&'tcx mir::Body<'tcx>,
&'tcx mir::UnsafetyCheckResult,
Expand Down
34 changes: 21 additions & 13 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct CtxtInterners<'tcx> {
substs: InternedSet<'tcx, InternalSubsts<'tcx>>,
canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>,
region: InternedSet<'tcx, RegionKind>,
existential_predicates: InternedSet<'tcx, List<ExistentialPredicate<'tcx>>>,
poly_existential_predicates: InternedSet<'tcx, List<ty::Binder<ExistentialPredicate<'tcx>>>>,
predicate: InternedSet<'tcx, PredicateInner<'tcx>>,
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
projs: InternedSet<'tcx, List<ProjectionKind>>,
Expand All @@ -103,7 +103,7 @@ impl<'tcx> CtxtInterners<'tcx> {
type_list: Default::default(),
substs: Default::default(),
region: Default::default(),
existential_predicates: Default::default(),
poly_existential_predicates: Default::default(),
canonical_var_infos: Default::default(),
predicate: Default::default(),
predicates: Default::default(),
Expand Down Expand Up @@ -1623,7 +1623,7 @@ nop_lift! {const_; &'a Const<'a> => &'tcx Const<'tcx>}
nop_lift! {predicate; &'a PredicateInner<'a> => &'tcx PredicateInner<'tcx>}

nop_list_lift! {type_list; Ty<'a> => Ty<'tcx>}
nop_list_lift! {existential_predicates; ExistentialPredicate<'a> => ExistentialPredicate<'tcx>}
nop_list_lift! {poly_existential_predicates; ty::Binder<ExistentialPredicate<'a>> => ty::Binder<ExistentialPredicate<'tcx>>}
nop_list_lift! {predicates; Predicate<'a> => Predicate<'tcx>}
nop_list_lift! {canonical_var_infos; CanonicalVarInfo<'a> => CanonicalVarInfo<'tcx>}
nop_list_lift! {projs; ProjectionKind => ProjectionKind}
Expand Down Expand Up @@ -2064,7 +2064,8 @@ slice_interners!(
type_list: _intern_type_list(Ty<'tcx>),
substs: _intern_substs(GenericArg<'tcx>),
canonical_var_infos: _intern_canonical_var_infos(CanonicalVarInfo<'tcx>),
existential_predicates: _intern_existential_predicates(ExistentialPredicate<'tcx>),
poly_existential_predicates:
_intern_poly_existential_predicates(ty::Binder<ExistentialPredicate<'tcx>>),
predicates: _intern_predicates(Predicate<'tcx>),
projs: _intern_projs(ProjectionKind),
place_elems: _intern_place_elems(PlaceElem<'tcx>),
Expand Down Expand Up @@ -2295,7 +2296,7 @@ impl<'tcx> TyCtxt<'tcx> {
#[inline]
pub fn mk_dynamic(
self,
obj: ty::Binder<&'tcx List<ExistentialPredicate<'tcx>>>,
obj: &'tcx List<ty::Binder<ExistentialPredicate<'tcx>>>,
reg: ty::Region<'tcx>,
) -> Ty<'tcx> {
self.mk_ty(Dynamic(obj, reg))
Expand Down Expand Up @@ -2425,13 +2426,17 @@ impl<'tcx> TyCtxt<'tcx> {
Place { local: place.local, projection: self.intern_place_elems(&projection) }
}

pub fn intern_existential_predicates(
pub fn intern_poly_existential_predicates(
self,
eps: &[ExistentialPredicate<'tcx>],
) -> &'tcx List<ExistentialPredicate<'tcx>> {
eps: &[ty::Binder<ExistentialPredicate<'tcx>>],
) -> &'tcx List<ty::Binder<ExistentialPredicate<'tcx>>> {
assert!(!eps.is_empty());
assert!(eps.array_windows().all(|[a, b]| a.stable_cmp(self, b) != Ordering::Greater));
self._intern_existential_predicates(eps)
assert!(
eps.array_windows()
.all(|[a, b]| a.skip_binder().stable_cmp(self, &b.skip_binder())
!= Ordering::Greater)
);
self._intern_poly_existential_predicates(eps)
}

pub fn intern_predicates(self, preds: &[Predicate<'tcx>]) -> &'tcx List<Predicate<'tcx>> {
Expand Down Expand Up @@ -2488,13 +2493,16 @@ impl<'tcx> TyCtxt<'tcx> {
})
}

pub fn mk_existential_predicates<
I: InternAs<[ExistentialPredicate<'tcx>], &'tcx List<ExistentialPredicate<'tcx>>>,
pub fn mk_poly_existential_predicates<
I: InternAs<
[ty::Binder<ExistentialPredicate<'tcx>>],
&'tcx List<ty::Binder<ExistentialPredicate<'tcx>>>,
>,
>(
self,
iter: I,
) -> I::Output {
iter.intern_with(|xs| self.intern_existential_predicates(xs))
iter.intern_with(|xs| self.intern_poly_existential_predicates(xs))
}

pub fn mk_predicates<I: InternAs<[Predicate<'tcx>], &'tcx List<Predicate<'tcx>>>>(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub enum TypeError<'tcx> {
CyclicTy(Ty<'tcx>),
CyclicConst(&'tcx ty::Const<'tcx>),
ProjectionMismatched(ExpectedFound<DefId>),
ExistentialMismatch(ExpectedFound<&'tcx ty::List<ty::ExistentialPredicate<'tcx>>>),
ExistentialMismatch(ExpectedFound<&'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>>),
ObjectUnsafeCoercion(DefId),
ConstMismatch(ExpectedFound<&'tcx ty::Const<'tcx>>),

Expand Down
20 changes: 8 additions & 12 deletions compiler/rustc_middle/src/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,15 @@ impl FlagComputation {
}

&ty::Dynamic(obj, r) => {
self.bound_computation(obj, |computation, obj| {
for predicate in obj.iter() {
match predicate {
ty::ExistentialPredicate::Trait(tr) => {
computation.add_substs(tr.substs)
}
ty::ExistentialPredicate::Projection(p) => {
computation.add_existential_projection(&p);
}
ty::ExistentialPredicate::AutoTrait(_) => {}
for predicate in obj.iter() {
self.bound_computation(predicate, |computation, predicate| match predicate {
ty::ExistentialPredicate::Trait(tr) => computation.add_substs(tr.substs),
ty::ExistentialPredicate::Projection(p) => {
computation.add_existential_projection(&p);
}
}
});
ty::ExistentialPredicate::AutoTrait(_) => {}
});
}

self.add_region(r);
}
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_middle/src/ty/print/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub trait Printer<'tcx>: Sized {

fn print_dyn_existential(
self,
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
predicates: &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
) -> Result<Self::DynExistential, Self::Error>;

fn print_const(self, ct: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error>;
Expand Down Expand Up @@ -343,7 +343,9 @@ impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for Ty<'tcx> {
}
}

impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for &'tcx ty::List<ty::ExistentialPredicate<'tcx>> {
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P>
for &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>
{
type Output = P::DynExistential;
type Error = P::Error;
fn print(&self, cx: P) -> Result<Self::Output, Self::Error> {
Expand Down
Loading