Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7643ea5
create a new section on pointer to reference conversion
lolbinarycat Jul 24, 2024
1073f97
remove duplicate explanations of the ptr to ref conversion rules
lolbinarycat Jul 24, 2024
3877a7b
clarify interactions with MaybeUninit and UnsafeCell
lolbinarycat Jul 25, 2024
1944894
Add `warn(unreachable_pub)` to several crates.
nnethercote Jun 11, 2024
f839309
Add `warn(unreachable_pub)` to `rustc_arena`.
nnethercote Jun 11, 2024
ea014b4
Add `warn(unreachable_pub)` to `rustc_ast_lowering`.
nnethercote Jun 11, 2024
a6b2880
Add `warn(unreachable_pub)` to `rustc_ast_passes`.
nnethercote Jul 6, 2024
f2fc87d
Add `warn(unreachable_pub)` to `rustc_ast_pretty`.
nnethercote Jul 6, 2024
6614165
Add `warn(unreachable_pub)` to `rustc_attr`.
nnethercote Jul 6, 2024
cb3f435
Don't add `warn(unreachable_pub)` to `rustc_baked_icu`.
nnethercote Jul 6, 2024
0685c97
Add `warn(unreachable_pub)` to `rustc_borrowck`.
nnethercote Jul 6, 2024
0544d3a
Add `warn(unreachable_pub)` to `rustc_builtin_macros`.
nnethercote Jul 6, 2024
6162743
Add `warn(unreachable_pub)` to `rustc_codegen_llvm`.
nnethercote Jul 6, 2024
cc84442
Add `warn(unreachable_pub)` to `rustc_codegen_ssa`.
nnethercote Jul 6, 2024
e91f328
Deduplicate Spans in Uninitialized Check
stephen-lazaro Aug 21, 2024
988bc1c
fix typos in new pointer conversion docs
lolbinarycat Aug 22, 2024
2540070
document & impl the transmutation modeled by `BikeshedIntrinsicFrom`
jswrenn Aug 12, 2024
b581fed
Generate missing source link on impl associated types
GuillaumeGomez Aug 25, 2024
ca6be74
Add regression test for impl associated types source link
GuillaumeGomez Aug 25, 2024
00c435d
Do not ICE on non-ADT rcvr type when looking for crate version collision
estebank Aug 18, 2024
4a088d9
Remove crashes from type_of on resolution that doesn't have a type_of
compiler-errors Aug 26, 2024
b11e0a8
Apply suggestions from code review
cuviper Aug 26, 2024
4e15554
Remove a couple of unused feature enables
bjorn3 Aug 26, 2024
b4d3fa4
Remove ParamMode::ExplicitNamed
compiler-errors Aug 26, 2024
2db1d2e
Rename ParenthesizedGenericArgs to GenericArgsMode
compiler-errors Aug 26, 2024
110c3df
Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau
matthiaskrgr Aug 26, 2024
c6ceb5b
Rollup merge of #128157 - lolbinarycat:unify-ptr-ref-docs, r=cuviper
matthiaskrgr Aug 26, 2024
29923b6
Rollup merge of #129032 - jswrenn:transmute-method, r=compiler-errors
matthiaskrgr Aug 26, 2024
d4d4b6b
Rollup merge of #129250 - estebank:issue-129205, r=compiler-errors
matthiaskrgr Aug 26, 2024
53f5294
Rollup merge of #129340 - stephen-lazaro:u/slazaro/issue-129274, r=co…
matthiaskrgr Aug 26, 2024
862b911
Rollup merge of #129560 - GuillaumeGomez:impl-assoc-type-source-link,…
matthiaskrgr Aug 26, 2024
90a1b6d
Rollup merge of #129622 - bjorn3:less_unstable, r=lqd
matthiaskrgr Aug 26, 2024
3d8d9da
Rollup merge of #129625 - compiler-errors:generic-args-mode, r=fmease
matthiaskrgr Aug 26, 2024
b3b6baf
Rollup merge of #129626 - compiler-errors:explicit-named, r=fmease
matthiaskrgr Aug 26, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err,
pick.item.def_id,
rcvr.hir_id,
*rcvr_ty,
Some(*rcvr_ty),
);
if pick.autoderefs == 0 && !trait_in_other_version_found {
err.span_label(
Expand Down Expand Up @@ -3689,8 +3689,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let SelfSource::QPath(ty) = source
&& !valid_out_of_scope_traits.is_empty()
&& let hir::TyKind::Path(path) = ty.kind
&& let hir::QPath::Resolved(_, path) = path
&& let Some(def_id) = path.res.opt_def_id()
&& let hir::QPath::Resolved(..) = path
&& let Some(assoc) = self
.tcx
.associated_items(valid_out_of_scope_traits[0])
Expand All @@ -3700,7 +3699,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// See if the `Type::function(val)` where `function` wasn't found corresponds to a
// `Trait` that is imported directly, but `Type` came from a different version of the
// same crate.
let rcvr_ty = self.tcx.type_of(def_id).instantiate_identity();

let rcvr_ty = self.node_ty_opt(ty.hir_id);
trait_in_other_version_found = self.detect_and_explain_multiple_crate_versions(
err,
assoc.def_id,
Expand Down Expand Up @@ -4080,7 +4080,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err: &mut Diag<'_>,
item_def_id: DefId,
hir_id: hir::HirId,
rcvr_ty: Ty<'_>,
rcvr_ty: Option<Ty<'_>>,
) -> bool {
let hir_id = self.tcx.parent_hir_id(hir_id);
let Some(traits) = self.tcx.in_scope_traits(hir_id) else { return false };
Expand Down Expand Up @@ -4110,8 +4110,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let mut multi_span: MultiSpan = trait_span.into();
multi_span.push_span_label(trait_span, format!("this is the trait that is needed"));
let descr = self.tcx.associated_item(item_def_id).descr();
let rcvr_ty =
rcvr_ty.map(|t| format!("`{t}`")).unwrap_or_else(|| "the receiver".to_string());
multi_span
.push_span_label(item_span, format!("the {descr} is available for `{rcvr_ty}` here"));
.push_span_label(item_span, format!("the {descr} is available for {rcvr_ty} here"));
for (def_id, import_def_id) in candidates {
if let Some(import_def_id) = import_def_id {
multi_span.push_span_label(
Expand Down
5 changes: 0 additions & 5 deletions tests/crashes/129205.rs

This file was deleted.

12 changes: 0 additions & 12 deletions tests/crashes/129216.rs

This file was deleted.

6 changes: 6 additions & 0 deletions tests/ui/methods/missing-method-on-type-parameter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Regression test for https://github.com/rust-lang/rust/issues/129205
fn x<T: Copy>() {
T::try_from(); //~ ERROR E0599
}

fn main() {}
19 changes: 19 additions & 0 deletions tests/ui/methods/missing-method-on-type-parameter.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error[E0599]: no function or associated item named `try_from` found for type parameter `T` in the current scope
--> $DIR/missing-method-on-type-parameter.rs:3:8
|
LL | fn x<T: Copy>() {
| - function or associated item `try_from` not found for this type parameter
LL | T::try_from();
| ^^^^^^^^ function or associated item not found in `T`
|
= help: items from traits can only be used if the trait is in scope
help: there is an associated function `from` with a similar name
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
help: trait `TryFrom` which provides `try_from` is implemented but not in scope; perhaps you want to import it
|
LL + use std::convert::TryFrom;
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0599`.