Skip to content

Commit 03918ba

Browse files
committedMar 7, 2022
Auto merge of #94706 - matthiaskrgr:rollup-l5erynr, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #93350 (libunwind: readd link attrs to _Unwind_Backtrace) - #93827 (Stabilize const_fn_fn_ptr_basics, const_fn_trait_bound, and const_impl_trait) - #94696 (Remove whitespaces and use CSS to align line numbers to the right instead) - #94700 (rustdoc: Update minifier version) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ecb867e + b3261f8 commit 03918ba

File tree

110 files changed

+170
-1012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+170
-1012
lines changed
 

‎Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2273,9 +2273,9 @@ dependencies = [
22732273

22742274
[[package]]
22752275
name = "minifier"
2276-
version = "0.0.42"
2276+
version = "0.0.43"
22772277
source = "registry+https://github.com/rust-lang/crates.io-index"
2278-
checksum = "55a1388517eda8a68875243b650c26997e055a33d82571b5a0349129faef7d99"
2278+
checksum = "d81352bda6f4d04af1720afaa762054f66e16caffd93c1f86461a1c0ac4e695e"
22792279
dependencies = [
22802280
"macro-utils",
22812281
]

‎compiler/rustc_const_eval/src/transform/check_consts/check.rs

+3-75
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
230230
}
231231
}
232232

233-
self.check_item_predicates();
234-
235233
for (idx, local) in body.local_decls.iter_enumerated() {
236234
// Handle the return place below.
237235
if idx == RETURN_PLACE || local.internal {
@@ -358,83 +356,11 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
358356

359357
match *ty.kind() {
360358
ty::Ref(_, _, hir::Mutability::Mut) => self.check_op(ops::ty::MutRef(kind)),
361-
ty::Opaque(..) => self.check_op(ops::ty::ImplTrait),
362-
ty::FnPtr(..) => self.check_op(ops::ty::FnPtr(kind)),
363-
364-
ty::Dynamic(preds, _) => {
365-
for pred in preds.iter() {
366-
match pred.skip_binder() {
367-
ty::ExistentialPredicate::AutoTrait(_)
368-
| ty::ExistentialPredicate::Projection(_) => {
369-
self.check_op(ops::ty::DynTrait(kind))
370-
}
371-
ty::ExistentialPredicate::Trait(trait_ref) => {
372-
if Some(trait_ref.def_id) != self.tcx.lang_items().sized_trait() {
373-
self.check_op(ops::ty::DynTrait(kind))
374-
}
375-
}
376-
}
377-
}
378-
}
379359
_ => {}
380360
}
381361
}
382362
}
383363

384-
fn check_item_predicates(&mut self) {
385-
let ConstCx { tcx, .. } = *self.ccx;
386-
387-
let mut current = self.def_id().to_def_id();
388-
loop {
389-
let predicates = tcx.predicates_of(current);
390-
for (predicate, _) in predicates.predicates {
391-
match predicate.kind().skip_binder() {
392-
ty::PredicateKind::RegionOutlives(_)
393-
| ty::PredicateKind::TypeOutlives(_)
394-
| ty::PredicateKind::WellFormed(_)
395-
| ty::PredicateKind::Projection(_)
396-
| ty::PredicateKind::ConstEvaluatable(..)
397-
| ty::PredicateKind::ConstEquate(..)
398-
| ty::PredicateKind::TypeWellFormedFromEnv(..) => continue,
399-
ty::PredicateKind::ObjectSafe(_) => {
400-
bug!("object safe predicate on function: {:#?}", predicate)
401-
}
402-
ty::PredicateKind::ClosureKind(..) => {
403-
bug!("closure kind predicate on function: {:#?}", predicate)
404-
}
405-
ty::PredicateKind::Subtype(_) | ty::PredicateKind::Coerce(_) => {
406-
bug!("subtype/coerce predicate on function: {:#?}", predicate)
407-
}
408-
ty::PredicateKind::Trait(pred) => {
409-
if Some(pred.def_id()) == tcx.lang_items().sized_trait() {
410-
continue;
411-
}
412-
match pred.self_ty().kind() {
413-
ty::Param(p) => {
414-
let generics = tcx.generics_of(current);
415-
let def = generics.type_param(p, tcx);
416-
let span = tcx.def_span(def.def_id);
417-
418-
// These are part of the function signature, so treat them like
419-
// arguments when determining importance.
420-
let kind = LocalKind::Arg;
421-
422-
self.check_op_spanned(ops::ty::TraitBound(kind), span);
423-
}
424-
// other kinds of bounds are either tautologies
425-
// or cause errors in other passes
426-
_ => continue,
427-
}
428-
}
429-
}
430-
}
431-
match predicates.parent {
432-
Some(parent) => current = parent,
433-
None => break,
434-
}
435-
}
436-
}
437-
438364
fn check_mut_borrow(&mut self, local: Local, kind: hir::BorrowKind) {
439365
match self.const_kind() {
440366
// In a const fn all borrows are transient or point to the places given via
@@ -613,7 +539,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
613539
),
614540
_,
615541
_,
616-
) => self.check_op(ops::FnPtrCast),
542+
) => {
543+
// Nothing to do here. Function pointer casts are allowed now.
544+
}
617545

618546
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), _, _) => {
619547
// Nothing to check here (`check_local_or_return_ty` ensures no trait objects occur

0 commit comments

Comments
 (0)