Skip to content

Commit f392ed5

Browse files
committed
Auto merge of #149387 - matthiaskrgr:rollup-hkkht91, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #148256 (remove support for `typeof`) - #148589 (Rename `DropGuard::into_inner` to `DropGuard::dismiss`) - #149001 (Fix false positive of "multiple different versions of crate X in the dependency graph") - #149334 (fix ICE: rustdoc: const parameter types cannot be generic #149288) - #149345 (Deeply normalize param env in `compare_impl_item` if using the next solver) - #149367 (Tidying up UI tests [4/N]) r? `@ghost` `@rustbot` modify labels: rollup
2 parents cf8a955 + 01512aa commit f392ed5

File tree

72 files changed

+300
-408
lines changed

Some content is hidden

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

72 files changed

+300
-408
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,8 +2513,6 @@ pub enum TyKind {
25132513
ImplTrait(NodeId, #[visitable(extra = BoundKind::Impl)] GenericBounds),
25142514
/// No-op; kept solely so that we can pretty-print faithfully.
25152515
Paren(Box<Ty>),
2516-
/// Unused for now.
2517-
Typeof(AnonConst),
25182516
/// This means the type should be inferred instead of it having been
25192517
/// specified. This can appear anywhere in a type.
25202518
Infer,

compiler/rustc_ast/src/util/classify.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
294294
| ast::TyKind::Never
295295
| ast::TyKind::Tup(..)
296296
| ast::TyKind::Paren(..)
297-
| ast::TyKind::Typeof(..)
298297
| ast::TyKind::Infer
299298
| ast::TyKind::ImplicitSelf
300299
| ast::TyKind::CVarArgs

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13671367
self.lower_ty(ty, itctx),
13681368
self.lower_array_length_to_const_arg(length),
13691369
),
1370-
TyKind::Typeof(expr) => hir::TyKind::Typeof(self.lower_anon_const_to_anon_const(expr)),
13711370
TyKind::TraitObject(bounds, kind) => {
13721371
let mut lifetime_bound = None;
13731372
let (bounds, lifetime_bound) = self.with_dyn_type_scope(true, |this| {

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,11 +1325,6 @@ impl<'a> State<'a> {
13251325
self.print_expr(&length.value, FixupContext::default());
13261326
self.word("]");
13271327
}
1328-
ast::TyKind::Typeof(e) => {
1329-
self.word("typeof(");
1330-
self.print_expr(&e.value, FixupContext::default());
1331-
self.word(")");
1332-
}
13331328
ast::TyKind::Infer => {
13341329
self.word("_");
13351330
}

compiler/rustc_error_codes/src/error_codes/E0516.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
The `typeof` keyword is currently reserved but unimplemented.
24

35
Erroneous code example:

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,8 +3680,6 @@ pub enum TyKind<'hir, Unambig = ()> {
36803680
/// We use pointer tagging to represent a `&'hir Lifetime` and `TraitObjectSyntax` pair
36813681
/// as otherwise this type being `repr(C)` would result in `TyKind` increasing in size.
36823682
TraitObject(&'hir [PolyTraitRef<'hir>], TaggedRef<'hir, Lifetime, TraitObjectSyntax>),
3683-
/// Unused for now.
3684-
Typeof(&'hir AnonConst),
36853683
/// Placeholder for a type that has failed to be defined.
36863684
Err(rustc_span::ErrorGuaranteed),
36873685
/// Pattern types (`pattern_type!(u32 is 1..)`)

compiler/rustc_hir/src/intravisit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -
10291029
}
10301030
try_visit!(visitor.visit_lifetime(lifetime));
10311031
}
1032-
TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
10331032
TyKind::InferDelegation(..) | TyKind::Err(_) => {}
10341033
TyKind::Pat(ty, pat) => {
10351034
try_visit!(visitor.visit_ty_unambig(ty));

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,6 @@ hir_analysis_ty_param_some = type parameter `{$param}` must be used as the type
552552
553553
hir_analysis_type_of = {$ty}
554554
555-
hir_analysis_typeof_reserved_keyword_used =
556-
`typeof` is a reserved keyword but unimplemented
557-
.suggestion = consider replacing `typeof(...)` with an actual type
558-
.label = reserved keyword
559-
560555
hir_analysis_unconstrained_generic_parameter = the {$param_def_kind} `{$param_name}` is not constrained by the impl trait, self type, or predicates
561556
.label = unconstrained {$param_def_kind}
562557
.const_param_note = expressions using a const parameter must map each value to a distinct output value

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,26 @@ fn compare_method_predicate_entailment<'tcx>(
236236

237237
let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_def_id);
238238
let param_env = ty::ParamEnv::new(tcx.mk_clauses(&hybrid_preds));
239-
let param_env = traits::normalize_param_env_or_error(tcx, param_env, normalize_cause);
239+
// FIXME(-Zhigher-ranked-assumptions): The `hybrid_preds`
240+
// should be well-formed. However, using them may result in
241+
// region errors as we currently don't track placeholder
242+
// assumptions.
243+
//
244+
// To avoid being backwards incompatible with the old solver,
245+
// we also eagerly normalize the where-bounds in the new solver
246+
// here while ignoring region constraints. This means we can then
247+
// use where-bounds whose normalization results in placeholder
248+
// errors further down without getting any errors.
249+
//
250+
// It should be sound to do so as the only region errors here
251+
// should be due to missing implied bounds.
252+
//
253+
// cc trait-system-refactor-initiative/issues/166.
254+
let param_env = if tcx.next_trait_solver_globally() {
255+
traits::deeply_normalize_param_env_ignoring_regions(tcx, param_env, normalize_cause)
256+
} else {
257+
traits::normalize_param_env_or_error(tcx, param_env, normalize_cause)
258+
};
240259
debug!(caller_bounds=?param_env.caller_bounds());
241260

242261
let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ impl<'tcx> InherentCollect<'tcx> {
195195
| ty::Closure(..)
196196
| ty::CoroutineClosure(..)
197197
| ty::Coroutine(..)
198-
| ty::CoroutineWitness(..) => {
199-
Err(self.tcx.dcx().delayed_bug("cannot define inherent `impl` for closure types"))
200-
}
201-
ty::Alias(ty::Free, _) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) => {
198+
| ty::CoroutineWitness(..)
199+
| ty::Alias(ty::Free, _)
200+
| ty::Bound(..)
201+
| ty::Placeholder(_)
202+
| ty::Infer(_) => {
202203
bug!("unexpected impl self type of impl: {:?} {:?}", id, self_ty);
203204
}
204205
// We could bail out here, but that will silence other useful errors.

0 commit comments

Comments
 (0)