Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ impl SingleAttributeParser for RustcDiagnosticItemParser {
Allow(Target::Fn),
Allow(Target::Const),
Allow(Target::Mod),
Allow(Target::Impl { of_trait: true }),
Allow(Target::Impl { of_trait: false }),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty.into(),
TypeAnnotationNeeded::E0282,
true,
self.param_env,
None,
)
.emit()
});
Expand All @@ -1526,6 +1528,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ct.into(),
TypeAnnotationNeeded::E0282,
true,
self.param_env,
None,
)
.emit()
});
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty.into(),
TypeAnnotationNeeded::E0282,
!raw_ptr_call,
self.param_env,
None,
);
if raw_ptr_call {
err.span_label(span, "cannot call a method on a raw pointer with an unknown pointee type");
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir_typeck/src/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
infer_var,
TypeAnnotationNeeded::E0282,
false,
self.param_env,
None,
)
.emit()
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_hir_typeck/src/writeback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,8 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
p.into(),
TypeAnnotationNeeded::E0282,
false,
self.fcx.param_env,
None,
)
.emit()
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ symbols! {
bitxor,
bitxor_assign,
black_box,
blanket_into_impl,
block,
blocking,
bool,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
trait_pred.self_ty().skip_binder().into(),
TypeAnnotationNeeded::E0282,
false,
obligation.param_env,
None,
)
.emit(),
Some(e) => e,
Expand Down Expand Up @@ -287,6 +289,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
term,
TypeAnnotationNeeded::E0283,
true,
obligation.param_env,
None,
match &candidates[..] {
[candidate] => Some(*candidate),
_ => None,
Expand Down Expand Up @@ -547,6 +551,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
term,
TypeAnnotationNeeded::E0282,
false,
obligation.param_env,
None,
)
}

Expand All @@ -566,6 +572,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
a.into(),
TypeAnnotationNeeded::E0282,
true,
obligation.param_env,
None,
)
}

Expand Down Expand Up @@ -601,6 +609,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
term,
TypeAnnotationNeeded::E0284,
true,
obligation.param_env,
Some(data),
)
.with_note(format!("cannot satisfy `{predicate}`"))
.with_long_ty_path(long_ty_path)
Expand Down Expand Up @@ -633,6 +643,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
term,
TypeAnnotationNeeded::E0284,
true,
obligation.param_env,
None,
)
} else {
// If we can't find a generic parameter, just print a generic error
Expand All @@ -655,6 +667,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
ct.into(),
TypeAnnotationNeeded::E0284,
true,
obligation.param_env,
None,
),

ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term })
Expand Down
1 change: 1 addition & 0 deletions library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ where
// From implies Into
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[rustc_diagnostic_item = "blanket_into_impl"]
const impl<T, U> Into<U> for T
where
U: [const] From<T>,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/error-codes/E0283.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ fn main() {
fn buzz() {
let foo_impl = Impl::new();
let bar = foo_impl.into() * 1u32; //~ ERROR E0283
// let bar = <Impl as Into<u32>>::into(foo_impl) * 1u32;
foo(bar);
}
2 changes: 1 addition & 1 deletion tests/ui/error-codes/E0283.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LL | impl Into<u32> for Impl {
help: try using a fully qualified path to specify the expected types
|
LL - let bar = foo_impl.into() * 1u32;
LL + let bar = <Impl as Into<T>>::into(foo_impl) * 1u32;
LL + let bar = <Impl as Into<u32>>::into(foo_impl) * 1u32;
|

error: aborting due to 2 previous errors
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/inference/ambiguous_type_parameter.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | InMemoryStore.get_raw(&String::default());
help: try using a fully qualified path to specify the expected types
|
LL - InMemoryStore.get_raw(&String::default());
LL + <InMemoryStore as Store<String, HashMap<K, String>>>::get_raw(&InMemoryStore, &String::default());
LL + <InMemoryStore as Store<String, HashMap<_, String>>>::get_raw(&InMemoryStore, &String::default());
|

error: aborting due to 1 previous error
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/inference/issue-12028.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | self.input_stream(&mut stream);
help: try using a fully qualified path to specify the expected types
|
LL - self.input_stream(&mut stream);
LL + <u8 as StreamHash<H>>::input_stream(self, &mut stream);
LL + <u8 as StreamHash<_>>::input_stream(self, &mut stream);
|

error: aborting due to 1 previous error
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/inference/issue-72616.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LL | if String::from("a") == "a".try_into().unwrap() {}
help: try using a fully qualified path to specify the expected types
|
LL - if String::from("a") == "a".try_into().unwrap() {}
LL + if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {}
LL + if String::from("a") == <_ as TryInto<_>>::try_into("a").unwrap() {}
|

error: aborting due to 1 previous error
Expand Down
Loading
Loading