Skip to content

Commit 65a6e22

Browse files
committed
Auto merge of #104845 - matthiaskrgr:rollup-tckj956, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #104514 (Use node_ty_opt to avoid ICE in visit_ty) - #104704 (Allow power10-vector feature in PowerPC) - #104747 (resolve: Don't use constructor def ids in the map for field names) - #104773 (OpaqueCast projections are always overlapping, they can't possibly be disjoint) - #104774 (Document split{_ascii,}_whitespace() for empty strings) - #104780 (make `error_reported` check for delayed bugs) - #104782 (Bump the const eval step limit) - #104792 (rustdoc: simplify `.search-results-title` CSS) - #104796 (lint: do not warn unused parens around higher-ranked function pointers) - #104820 (Remove normalize_projection_type) - #104822 (with_query_mode -> new) Failed merges: - #104716 (move 2 candidates into builtin candidate) - #104841 (Assert that we don't capture escaping bound vars in `Fn` trait selection) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b3bc6bf + 1048a85 commit 65a6e22

File tree

29 files changed

+149
-127
lines changed

29 files changed

+149
-127
lines changed

compiler/rustc_borrowck/src/places_conflict.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,10 @@ fn place_projection_conflict<'tcx>(
320320
debug!("place_element_conflict: DISJOINT-OR-EQ-DEREF");
321321
Overlap::EqualOrDisjoint
322322
}
323-
(ProjectionElem::OpaqueCast(v1), ProjectionElem::OpaqueCast(v2)) => {
324-
if v1 == v2 {
325-
// same type - recur.
326-
debug!("place_element_conflict: DISJOINT-OR-EQ-OPAQUE");
327-
Overlap::EqualOrDisjoint
328-
} else {
329-
// Different types. Disjoint!
330-
debug!("place_element_conflict: DISJOINT-OPAQUE");
331-
Overlap::Disjoint
332-
}
323+
(ProjectionElem::OpaqueCast(_), ProjectionElem::OpaqueCast(_)) => {
324+
// casts to other types may always conflict irrespective of the type being cast to.
325+
debug!("place_element_conflict: DISJOINT-OR-EQ-OPAQUE");
326+
Overlap::EqualOrDisjoint
333327
}
334328
(ProjectionElem::Field(f1, _), ProjectionElem::Field(f2, _)) => {
335329
if f1 == f2 {

compiler/rustc_codegen_ssa/src/target_features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ const HEXAGON_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
215215
const POWERPC_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
216216
// tidy-alphabetical-start
217217
("altivec", Some(sym::powerpc_target_feature)),
218+
("power10-vector", Some(sym::powerpc_target_feature)),
218219
("power8-altivec", Some(sym::powerpc_target_feature)),
219220
("power8-vector", Some(sym::powerpc_target_feature)),
220221
("power9-altivec", Some(sym::powerpc_target_feature)),

compiler/rustc_errors/src/lib.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,13 +1044,24 @@ impl Handler {
10441044
}
10451045
pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> {
10461046
if self.inner.borrow().has_errors_or_lint_errors() {
1047-
Some(ErrorGuaranteed(()))
1047+
Some(ErrorGuaranteed::unchecked_claim_error_was_emitted())
1048+
} else {
1049+
None
1050+
}
1051+
}
1052+
pub fn has_errors_or_delayed_span_bugs(&self) -> Option<ErrorGuaranteed> {
1053+
if self.inner.borrow().has_errors_or_delayed_span_bugs() {
1054+
Some(ErrorGuaranteed::unchecked_claim_error_was_emitted())
10481055
} else {
10491056
None
10501057
}
10511058
}
1052-
pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
1053-
self.inner.borrow().has_errors_or_delayed_span_bugs()
1059+
pub fn is_compilation_going_to_fail(&self) -> Option<ErrorGuaranteed> {
1060+
if self.inner.borrow().is_compilation_going_to_fail() {
1061+
Some(ErrorGuaranteed::unchecked_claim_error_was_emitted())
1062+
} else {
1063+
None
1064+
}
10541065
}
10551066

10561067
pub fn print_error_count(&self, registry: &Registry) {
@@ -1484,6 +1495,10 @@ impl HandlerInner {
14841495
self.err_count() > 0 || self.lint_err_count > 0 || self.warn_count > 0
14851496
}
14861497

1498+
fn is_compilation_going_to_fail(&self) -> bool {
1499+
self.has_errors() || self.lint_err_count > 0 || !self.delayed_span_bugs.is_empty()
1500+
}
1501+
14871502
fn abort_if_errors(&mut self) {
14881503
self.emit_stashed_diagnostics();
14891504

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,12 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
361361

362362
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) {
363363
intravisit::walk_ty(self, hir_ty);
364-
let ty = self.fcx.node_ty(hir_ty.hir_id);
365-
let ty = self.resolve(ty, &hir_ty.span);
366-
self.write_ty_to_typeck_results(hir_ty.hir_id, ty);
364+
// If there are type checking errors, Type privacy pass will stop,
365+
// so we may not get the type from hid_id, see #104513
366+
if let Some(ty) = self.fcx.node_ty_opt(hir_ty.hir_id) {
367+
let ty = self.resolve(ty, &hir_ty.span);
368+
self.write_ty_to_typeck_results(hir_ty.hir_id, ty);
369+
}
367370
}
368371

369372
fn visit_infer(&mut self, inf: &'tcx hir::InferArg) {

compiler/rustc_incremental/src/persist/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Svh) {
322322

323323
let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone();
324324

325-
if sess.has_errors_or_delayed_span_bugs() {
325+
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
326326
// If there have been any errors during compilation, we don't want to
327327
// publish this session directory. Rather, we'll just delete it.
328328

compiler/rustc_incremental/src/persist/save.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
2828
return;
2929
}
3030
// This is going to be deleted in finalize_session_directory, so let's not create it
31-
if sess.has_errors_or_delayed_span_bugs() {
31+
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
3232
return;
3333
}
3434

@@ -89,7 +89,7 @@ pub fn save_work_product_index(
8989
return;
9090
}
9191
// This is going to be deleted in finalize_session_directory, so let's not create it
92-
if sess.has_errors_or_delayed_span_bugs() {
92+
if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
9393
return;
9494
}
9595

compiler/rustc_infer/src/traits/engine.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ use super::FulfillmentError;
88
use super::{ObligationCause, PredicateObligation};
99

1010
pub trait TraitEngine<'tcx>: 'tcx {
11-
fn normalize_projection_type(
12-
&mut self,
13-
infcx: &InferCtxt<'tcx>,
14-
param_env: ty::ParamEnv<'tcx>,
15-
projection_ty: ty::ProjectionTy<'tcx>,
16-
cause: ObligationCause<'tcx>,
17-
) -> Ty<'tcx>;
18-
1911
/// Requires that `ty` must implement the trait with `def_id` in
2012
/// the given environment. This trait must not have any type
2113
/// parameters (except for `Self`).

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,7 @@ impl EarlyLintPass for UnusedParens {
10151015
if let ast::TyKind::Paren(r) = &ty.kind {
10161016
match &r.kind {
10171017
ast::TyKind::TraitObject(..) => {}
1018+
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
10181019
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
10191020
ast::TyKind::Array(_, len) => {
10201021
self.check_unused_delims_expr(

compiler/rustc_middle/src/middle/limits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
3838
tcx.hir().krate_attrs(),
3939
tcx.sess,
4040
sym::const_eval_limit,
41-
1_000_000,
41+
2_000_000,
4242
),
4343
}
4444
}

compiler/rustc_middle/src/ty/visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
9797
}
9898
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
9999
if self.references_error() {
100-
if let Some(reported) = ty::tls::with(|tcx| tcx.sess.has_errors()) {
100+
if let Some(reported) = ty::tls::with(|tcx| tcx.sess.is_compilation_going_to_fail()) {
101101
Err(reported)
102102
} else {
103-
bug!("expect tcx.sess.has_errors return true");
103+
bug!("expect tcx.sess.is_compilation_going_to_fail return `Some`");
104104
}
105105
} else {
106106
Ok(())

0 commit comments

Comments
 (0)