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 11 pull requests #120496

Merged
merged 27 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a984193
Deduplicate more sized errors on call exprs
estebank Jan 24, 2024
e23937c
adapt test for v0 symbol mangling
krasimirgg Jan 24, 2024
f68741b
Stop checking `err_count` in macro_rules validity checking
oli-obk Jan 25, 2024
f6f0e04
Remove an unused error count check
oli-obk Jan 25, 2024
646c8fc
Statically ensure an error is reported in report_arg_errors
oli-obk Jan 25, 2024
2b60e56
Statically ensure report_selection_error actually reports an error
oli-obk Jan 25, 2024
3042da0
Remove has_errors check in builtin macro parsing
oli-obk Jan 25, 2024
054e1e3
Track ErrorGuaranteed instead of conjuring it from thin air
oli-obk Jan 25, 2024
9199742
Revert "Add the wasm32-wasi-preview2 target"
fmease Jan 28, 2024
6837b81
Fix some `Arc` allocator leaks
Nemo157 Jan 28, 2024
492df34
Supress unhelpful diagnostics for unresolved top level attributes
chenyukang Jan 27, 2024
6468d44
Improve error message when `cargo build` is used to build the compiler
Noratrieb Jan 29, 2024
96e6cfa
Improve display of crate name when hovered
GuillaumeGomez Jan 29, 2024
b4efe07
Remove some unnecessary check logic for lang items in HIR typeck
compiler-errors Jan 29, 2024
bf4de3a
Remove `raw_os_nonzero` feature.
reitermarkus Jan 24, 2024
ad526d8
add missing potential_query_instability for keys and values in hashmap
chenyukang Jan 30, 2024
efff267
Rollup merge of #117906 - GuillaumeGomez:improve-crate-name-hover, r=…
GuillaumeGomez Jan 30, 2024
ee2e9e1
Rollup merge of #118533 - chenyukang:yukang-fix-118455, r=petrochenkov
GuillaumeGomez Jan 30, 2024
0a4fd52
Rollup merge of #120293 - estebank:issue-102629, r=nnethercote
GuillaumeGomez Jan 30, 2024
4f4ceef
Rollup merge of #120295 - reitermarkus:remove-ffi-nonzero, r=dtolnay
GuillaumeGomez Jan 30, 2024
6a1d34f
Rollup merge of #120310 - krasimirgg:jan-v0-sym, r=Mark-Simulacrum
GuillaumeGomez Jan 30, 2024
b28e6f1
Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercote
GuillaumeGomez Jan 30, 2024
d10f33a
Rollup merge of #120434 - fmease:revert-speeder, r=petrochenkov
GuillaumeGomez Jan 30, 2024
a5aa355
Rollup merge of #120445 - Nemo157:arc-plug, r=Mark-Simulacrum
GuillaumeGomez Jan 30, 2024
399b81f
Rollup merge of #120475 - Nilstrieb:cargo-build-my-a-, r=michaelwoeri…
GuillaumeGomez Jan 30, 2024
f3f1472
Rollup merge of #120476 - compiler-errors:lang-items-yeet, r=Nilstrieb
GuillaumeGomez Jan 30, 2024
27bc496
Rollup merge of #120485 - chenyukang:yukang-add-query-instability-che…
GuillaumeGomez Jan 30, 2024
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
Prev Previous commit
Next Next commit
Track ErrorGuaranteed instead of conjuring it from thin air
oli-obk committed Jan 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 054e1e3aada8ab0dd08af1f2f8e7ee16139d96e7
3 changes: 2 additions & 1 deletion compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
@@ -278,7 +278,8 @@ pub struct InferCtxt<'tcx> {

/// The set of predicates on which errors have been reported, to
/// avoid reporting the same error twice.
pub reported_trait_errors: RefCell<FxIndexMap<Span, Vec<ty::Predicate<'tcx>>>>,
pub reported_trait_errors:
RefCell<FxIndexMap<Span, (Vec<ty::Predicate<'tcx>>, ErrorGuaranteed)>>,

pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,

Original file line number Diff line number Diff line change
@@ -107,7 +107,10 @@ pub trait TypeErrCtxtExt<'tcx> {
trait_ref: ty::PolyTraitRef<'tcx>,
) -> Option<ErrorGuaranteed>;

fn fn_arg_obligation(&self, obligation: &PredicateObligation<'tcx>) -> bool;
fn fn_arg_obligation(
&self,
obligation: &PredicateObligation<'tcx>,
) -> Result<(), ErrorGuaranteed>;

fn try_conversion_context(
&self,
@@ -142,6 +145,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
(
span,
predicates
.0
.iter()
.map(|&predicate| ErrorDescriptor { predicate, index: None })
.collect(),
@@ -213,7 +217,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
for from_expansion in [false, true] {
for (error, suppressed) in iter::zip(&errors, &is_suppressed) {
if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion {
reported = Some(self.report_fulfillment_error(error));
let guar = self.report_fulfillment_error(error);
reported = Some(guar);
// We want to ignore desugarings here: spans are equivalent even
// if one is the result of a desugaring and the other is not.
let mut span = error.obligation.cause.span;
@@ -224,7 +229,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
self.reported_trait_errors
.borrow_mut()
.entry(span)
.or_default()
.or_insert_with(|| (vec![], guar))
.0
.push(error.obligation.predicate);
}
}
@@ -447,10 +453,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
{
return guar;
}
if self.fn_arg_obligation(&obligation) {
// Silence redundant errors on binding acccess that are already
// reported on the binding definition (#56607).
return self.dcx().span_delayed_bug(obligation.cause.span, "error already reported");
// Silence redundant errors on binding acccess that are already
// reported on the binding definition (#56607).
if let Err(guar) = self.fn_arg_obligation(&obligation) {
return guar;
}
let mut file = None;
let (post_message, pre_message, type_def) = self
@@ -981,7 +987,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
}

fn fn_arg_obligation(&self, obligation: &PredicateObligation<'tcx>) -> bool {
fn fn_arg_obligation(
&self,
obligation: &PredicateObligation<'tcx>,
) -> Result<(), ErrorGuaranteed> {
if let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } =
obligation.cause.code()
&& let Some(Node::Expr(arg)) = self.tcx.opt_hir_node(*arg_hir_id)
@@ -991,12 +1000,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
hir::Path { res: hir::def::Res::Local(hir_id), .. },
)) = arg.kind
&& let Some(Node::Pat(pat)) = self.tcx.opt_hir_node(*hir_id)
&& let Some(preds) = self.reported_trait_errors.borrow().get(&pat.span)
&& let Some((preds, guar)) = self.reported_trait_errors.borrow().get(&pat.span)
&& preds.contains(&obligation.predicate)
{
return true;
return Err(*guar);
}
false
Ok(())
}

/// When the `E` of the resulting `Result<T, E>` in an expression `foo().bar().baz()?`,