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 10 pull requests #106757

Merged
merged 23 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ad79b20
std tests: use __OsLocalKeyInner from realstd
RalfJung Jan 9, 2023
4f0c88f
rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.
gribozavr Jan 11, 2023
1a99361
Revert "warn newer available version of the x tool"
DebugSteven Jan 11, 2023
0d834d9
keep --wrapper-version argument in x
DebugSteven Jan 11, 2023
fb5d215
Conserve cause of `ImplDerivedObligation` in E0599
estebank Jan 11, 2023
317adda
Tweak output
estebank Jan 11, 2023
70a8d8d
Allow codegen to unsize dyn* to dyn
compiler-errors Jan 6, 2023
4e30ad8
Reuse ErrorGuaranteed during relation
compiler-errors Dec 30, 2022
83fbc71
Filter impl and where-clause candidates that reference errors
compiler-errors Jan 1, 2023
f1ffe82
Hide more of long types in E0271
estebank Jan 8, 2023
44a5ce6
Test that we cannot use trait impl methods arguments as defining uses
oli-obk Jan 10, 2023
621d412
Fix invalid syntax in impl Trait parameter type suggestions for E0311
Dec 26, 2022
b78a571
Clean up `OnUnimplementedFormatString::verify`
clubby789 Jan 11, 2023
a8bd0c0
Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
matthiaskrgr Jan 12, 2023
9b538e8
Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, …
matthiaskrgr Jan 12, 2023
e664cb2
Rollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
matthiaskrgr Jan 12, 2023
890bc3c
Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors
matthiaskrgr Jan 12, 2023
db8301b
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
matthiaskrgr Jan 12, 2023
d42d952
Rollup merge of #106676 - oli-obk:tait_test, r=dtolnay
matthiaskrgr Jan 12, 2023
8a13157
Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errors
matthiaskrgr Jan 12, 2023
a90742a
Rollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
matthiaskrgr Jan 12, 2023
be76526
Rollup merge of #106733 - DebugSteven:revert-104552-warn-newer-x, r=j…
matthiaskrgr Jan 12, 2023
e8ef83e
Rollup merge of #106748 - clubby789:on-unimplemented-fmt-verify, r=co…
matthiaskrgr Jan 12, 2023
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
21 changes: 10 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5034,18 +5034,18 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"

[[package]]
name = "semver"
version = "1.0.14"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
dependencies = [
"serde",
]

[[package]]
name = "serde"
version = "1.0.152"
version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
dependencies = [
"serde_derive",
]
Expand All @@ -5062,9 +5062,9 @@ dependencies = [

[[package]]
name = "serde_derive"
version = "1.0.152"
version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -5082,9 +5082,9 @@ dependencies = [

[[package]]
name = "serde_json"
version = "1.0.91"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"indexmap",
"itoa",
Expand Down Expand Up @@ -5400,9 +5400,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"

[[package]]
name = "syn"
version = "1.0.107"
version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
dependencies = [
"proc-macro2",
"quote",
Expand Down Expand Up @@ -5576,7 +5576,6 @@ dependencies = [
"lazy_static",
"miropt-test-tools",
"regex",
"semver",
"termcolor",
"walkdir",
]
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
(
&ty::Dynamic(ref data_a, _, src_dyn_kind),
&ty::Dynamic(ref data_b, _, target_dyn_kind),
) => {
assert_eq!(src_dyn_kind, target_dyn_kind);

) if src_dyn_kind == target_dyn_kind => {
let old_info =
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
if data_a.principal_def_id() == data_b.principal_def_id() {
Expand Down
18 changes: 17 additions & 1 deletion compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,23 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {

// Convert the bounds into obligations.
let impl_obligations = traits::predicates_for_generics(
|_, _| cause.clone(),
|_idx, span| {
let misc = traits::ObligationCause::misc(span, self.body_id);
let parent_trait_pred = ty::Binder::dummy(ty::TraitPredicate {
trait_ref: ty::TraitRef::from_method(self.tcx, impl_def_id, substs),
constness: ty::BoundConstness::NotConst,
polarity: ty::ImplPolarity::Positive,
});
misc.derived_cause(parent_trait_pred, |derived| {
traits::ImplDerivedObligation(Box::new(
traits::ImplDerivedObligationCause {
derived,
impl_def_id,
span,
},
))
})
},
self.param_env,
impl_bounds,
);
Expand Down
73 changes: 40 additions & 33 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.autoderef(span, ty).any(|(ty, _)| matches!(ty.kind(), ty::Slice(..) | ty::Array(..)))
}

#[instrument(level = "debug", skip(self))]
pub fn report_method_error(
&self,
span: Span,
Expand Down Expand Up @@ -586,22 +587,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

// Find all the requirements that come from a local `impl` block.
let mut skip_list: FxHashSet<_> = Default::default();
let mut spanned_predicates: FxHashMap<MultiSpan, _> = Default::default();
for (data, p, parent_p, impl_def_id, cause) in unsatisfied_predicates
let mut spanned_predicates = FxHashMap::default();
for (p, parent_p, impl_def_id, cause) in unsatisfied_predicates
.iter()
.filter_map(|(p, parent, c)| c.as_ref().map(|c| (p, parent, c)))
.filter_map(|(p, parent, c)| match c.code() {
ObligationCauseCode::ImplDerivedObligation(data) => {
Some((&data.derived, p, parent, data.impl_def_id, data))
ObligationCauseCode::ImplDerivedObligation(data)
if matches!(p.kind().skip_binder(), ty::PredicateKind::Clause(_)) =>
{
Some((p, parent, data.impl_def_id, data))
}
_ => None,
})
{
let parent_trait_ref = data.parent_trait_pred;
let path = parent_trait_ref.print_modifiers_and_trait_path();
let tr_self_ty = parent_trait_ref.skip_binder().self_ty();
let unsatisfied_msg = "unsatisfied trait bound introduced here";
let derive_msg = "unsatisfied trait bound introduced in this `derive` macro";
match self.tcx.hir().get_if_local(impl_def_id) {
// Unmet obligation comes from a `derive` macro, point at it once to
// avoid multiple span labels pointing at the same place.
Expand All @@ -617,10 +615,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) =>
{
let span = self_ty.span.ctxt().outer_expn_data().call_site;
let mut spans: MultiSpan = span.into();
spans.push_span_label(span, derive_msg);
let entry = spanned_predicates.entry(spans);
entry.or_insert_with(|| (path, tr_self_ty, Vec::new())).2.push(p);
let entry = spanned_predicates.entry(span);
let entry = entry.or_insert_with(|| {
(FxHashSet::default(), FxHashSet::default(), Vec::new())
});
entry.0.insert(span);
entry.1.insert((
span,
"unsatisfied trait bound introduced in this `derive` macro",
));
entry.2.push(p);
skip_list.insert(p);
}

// Unmet obligation coming from an `impl`.
Expand All @@ -647,8 +652,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
err.span_suggestion_verbose(
sp,
"consider relaxing the type parameter's implicit \
`Sized` bound",
"consider relaxing the type parameter's implicit `Sized` bound",
sugg,
Applicability::MachineApplicable,
);
Expand All @@ -659,25 +663,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let _ = format_pred(*pred);
}
skip_list.insert(p);
let mut spans = if cause.span != *item_span {
let mut spans: MultiSpan = cause.span.into();
spans.push_span_label(cause.span, unsatisfied_msg);
spans
let entry = spanned_predicates.entry(self_ty.span);
let entry = entry.or_insert_with(|| {
(FxHashSet::default(), FxHashSet::default(), Vec::new())
});
entry.2.push(p);
if cause.span != *item_span {
entry.0.insert(cause.span);
entry.1.insert((cause.span, "unsatisfied trait bound introduced here"));
} else {
let mut spans = Vec::with_capacity(2);
if let Some(trait_ref) = of_trait {
spans.push(trait_ref.path.span);
entry.0.insert(trait_ref.path.span);
}
spans.push(self_ty.span);
spans.into()
entry.0.insert(self_ty.span);
};
if let Some(trait_ref) = of_trait {
spans.push_span_label(trait_ref.path.span, "");
entry.1.insert((trait_ref.path.span, ""));
}
spans.push_span_label(self_ty.span, "");

let entry = spanned_predicates.entry(spans);
entry.or_insert_with(|| (path, tr_self_ty, Vec::new())).2.push(p);
entry.1.insert((self_ty.span, ""));
}
Some(Node::Item(hir::Item {
kind: hir::ItemKind::Trait(rustc_ast::ast::IsAuto::Yes, ..),
Expand All @@ -694,11 +697,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
let mut spanned_predicates: Vec<_> = spanned_predicates.into_iter().collect();
spanned_predicates.sort_by_key(|(span, (_, _, _))| span.primary_span());
for (span, (_path, _self_ty, preds)) in spanned_predicates {
let mut preds: Vec<_> = preds
.into_iter()
.filter_map(|pred| format_pred(*pred))
spanned_predicates.sort_by_key(|(span, _)| *span);
for (_, (primary_spans, span_labels, predicates)) in spanned_predicates {
let mut preds: Vec<_> = predicates
.iter()
.filter_map(|pred| format_pred(**pred))
.map(|(p, _)| format!("`{}`", p))
.collect();
preds.sort();
Expand All @@ -708,6 +711,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
format!("the following trait bounds were not satisfied:\n{}", preds.join("\n"),)
};
let mut span: MultiSpan = primary_spans.into_iter().collect::<Vec<_>>().into();
for (sp, label) in span_labels {
span.push_span_label(sp, label);
}
err.span_note(span, &msg);
unsatisfied_bounds = true;
}
Expand Down
Loading