Skip to content

Commit 998e1a9

Browse files
committed
Auto merge of #105804 - matthiaskrgr:rollup-iaqlbl3, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #105493 (Help rust-analyzer normalize query return types) - #105710 (Don't bug if we're trying to cast `dyn*` to another type) - #105711 (bail in `collect_trait_impl_trait_tys` if signatures reference errors) - #105768 (Detect inherent associated types not having CamelCase) - #105780 (rustdoc: Don't add "Read more" link if there is no extra content) - #105802 (Make enum-match.rs test robust against variable name changes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents bbb9cfb + 803ce45 commit 998e1a9

File tree

15 files changed

+269
-15
lines changed

15 files changed

+269
-15
lines changed

compiler/rustc_hir_analysis/src/check/compare_method.rs

+2
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
405405
tcx.fn_sig(impl_m.def_id),
406406
),
407407
);
408+
impl_sig.error_reported()?;
408409
let impl_return_ty = impl_sig.output();
409410

410411
// Normalize the trait signature with liberated bound vars, passing it through
@@ -419,6 +420,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
419420
)
420421
.fold_with(&mut collector);
421422
let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
423+
trait_sig.error_reported()?;
422424
let trait_return_ty = trait_sig.output();
423425

424426
let wf_tys = FxIndexSet::from_iter(

compiler/rustc_hir_typeck/src/cast.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,15 @@ impl<'a, 'tcx> CastCheck<'tcx> {
847847

848848
(Int(_) | Float, Int(_) | Float) => Ok(CastKind::NumericCast),
849849

850-
(_, DynStar) | (DynStar, _) => {
850+
(_, DynStar) => {
851851
if fcx.tcx.features().dyn_star {
852852
bug!("should be handled by `try_coerce`")
853853
} else {
854854
Err(CastError::IllegalCast)
855855
}
856856
}
857+
858+
(DynStar, _) => Err(CastError::IllegalCast),
857859
}
858860
}
859861

compiler/rustc_lint/src/nonstandard_style.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,23 @@ impl EarlyLintPass for NonCamelCaseTypes {
175175
return;
176176
}
177177

178-
match it.kind {
178+
match &it.kind {
179179
ast::ItemKind::TyAlias(..)
180180
| ast::ItemKind::Enum(..)
181181
| ast::ItemKind::Struct(..)
182182
| ast::ItemKind::Union(..) => self.check_case(cx, "type", &it.ident),
183183
ast::ItemKind::Trait(..) => self.check_case(cx, "trait", &it.ident),
184184
ast::ItemKind::TraitAlias(..) => self.check_case(cx, "trait alias", &it.ident),
185+
186+
// N.B. This check is only for inherent associated types, so that we don't lint against
187+
// trait impls where we should have warned for the trait definition already.
188+
ast::ItemKind::Impl(box ast::Impl { of_trait: None, items, .. }) => {
189+
for it in items {
190+
if let ast::AssocItemKind::Type(..) = it.kind {
191+
self.check_case(cx, "associated type", &it.ident);
192+
}
193+
}
194+
}
185195
_ => (),
186196
}
187197
}

0 commit comments

Comments
 (0)