From e6989d2959ee8ecc81c2e6fb3622d91108772a99 Mon Sep 17 00:00:00 2001 From: Jynn Nelson Date: Thu, 30 Mar 2023 13:36:40 -0400 Subject: [PATCH 1/8] Update contributing links for rustc-dev-guide changes - Remove unused reference link in CONTRIBUTING.md - Change the contributing_url for triagebot to the getting started page --- CONTRIBUTING.md | 1 - triagebot.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d732075fb2d07..dfaa70bb9db00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,6 @@ find a mentor! You can learn more about asking questions and getting help in the Did a compiler error message tell you to come here? If you want to create an ICE report, refer to [this section][contributing-bug-reports] and [open an issue][issue template]. -[Contributing to Rust]: https://rustc-dev-guide.rust-lang.org/contributing.html#contributing-to-rust [rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/ [std-dev-guide]: https://std-dev-guide.rust-lang.org/ [contributing-bug-reports]: https://rustc-dev-guide.rust-lang.org/contributing.html#bug-reports diff --git a/triagebot.toml b/triagebot.toml index c86c1613fa9ce..20a8be283b990 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -482,7 +482,7 @@ message = "This PR changes src/bootstrap/defaults/config.codegen.toml. If approp [assign] warn_non_default_branch = true -contributing_url = "https://rustc-dev-guide.rust-lang.org/contributing.html" +contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html" [assign.adhoc_groups] compiler-team = [ From abc61d23de7007773e3e75d50967e3813ca9ac92 Mon Sep 17 00:00:00 2001 From: Sergey Kaunov <65976143+skaunov@users.noreply.github.com> Date: Mon, 3 Apr 2023 09:18:14 +0300 Subject: [PATCH 2/8] Add links to `UnsafeCell` page could benefit too from having links to these most popular structs in the module. --- library/core/src/cell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 63bce5d0ccd44..d728dc038176c 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -1816,7 +1816,7 @@ impl fmt::Display for RefMut<'_, T> { /// `UnsafeCell` opts-out of the immutability guarantee for `&T`: a shared reference /// `&UnsafeCell` may point to data that is being mutated. This is called "interior mutability". /// -/// All other types that allow internal mutability, such as `Cell` and `RefCell`, internally +/// All other types that allow internal mutability, such as [`Cell`] and [`RefCell`], internally /// use `UnsafeCell` to wrap their data. /// /// Note that only the immutability guarantee for shared references is affected by `UnsafeCell`. The From 5d842a6f3219f577eefe41853c47db6a21dd9f6f Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 3 Apr 2023 11:09:10 +0200 Subject: [PATCH 3/8] update book --- src/doc/book | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book b/src/doc/book index 21a2ed14f4480..0510ca84c2ce6 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 21a2ed14f4480dab62438dcc1130291bebc65379 +Subproject commit 0510ca84c2ce6bf93c4ccf9248756e9e4fd00b12 From 49795b40cf375a3c9ffe1843792856b40eace949 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 3 Apr 2023 14:12:13 +0200 Subject: [PATCH 4/8] update rustc dev guide --- src/doc/rustc-dev-guide | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index d08baa166b463..fca8af6c154c6 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit d08baa166b463537229eeb737c4ccadabd83cf78 +Subproject commit fca8af6c154c6cde2512f1331cf2704f214a818e From a6431e96b13b3420cd528692a648de47a1c05a96 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 3 Apr 2023 14:12:48 +0200 Subject: [PATCH 5/8] update rust-by-example --- src/doc/rust-by-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index cfbfd648ce339..ba84bf35d0f17 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit cfbfd648ce33926c3490f24de9a5b56cce404b88 +Subproject commit ba84bf35d0f17d404003349309201654d25f61af From ca79b82c6cff632c98ed355e7d0f554ef8b5cc5d Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:23:08 +0000 Subject: [PATCH 6/8] Never consider int and float vars for `FnPtr` candidates This solves a regression where `0.0.cmp()` was ambiguous when a custom trait with a `cmp` method was in scope. FOr integers it shouldn't be a problem in practice so I wasn't able to add a test. --- .../src/traits/select/candidate_assembly.rs | 10 ++++++++-- .../rustc_trait_selection/src/traits/select/mod.rs | 12 ++++++------ tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs | 10 ++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 47a351590b1de..090312338e009 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -998,8 +998,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { | ty::Alias(..) | ty::Param(..) | ty::Bound(..) - | ty::Error(_) => {} - ty::Infer(_) => { + | ty::Error(_) + | ty::Infer( + ty::InferTy::IntVar(_) + | ty::InferTy::FloatVar(_) + | ty::InferTy::FreshIntTy(_) + | ty::InferTy::FreshFloatTy(_), + ) => {} + ty::Infer(ty::InferTy::TyVar(_) | ty::InferTy::FreshTy(_)) => { candidates.ambiguous = true; } } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 3ed3dd2d20d84..b58e62536d604 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -177,14 +177,14 @@ struct TraitObligationStack<'prev, 'tcx> { } struct SelectionCandidateSet<'tcx> { - // A list of candidates that definitely apply to the current - // obligation (meaning: types unify). + /// A list of candidates that definitely apply to the current + /// obligation (meaning: types unify). vec: Vec>, - // If `true`, then there were candidates that might or might - // not have applied, but we couldn't tell. This occurs when some - // of the input types are type variables, in which case there are - // various "builtin" rules that might or might not trigger. + /// If `true`, then there were candidates that might or might + /// not have applied, but we couldn't tell. This occurs when some + /// of the input types are type variables, in which case there are + /// various "builtin" rules that might or might not trigger. ambiguous: bool, } diff --git a/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs new file mode 100644 index 0000000000000..eec7da044c0d5 --- /dev/null +++ b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs @@ -0,0 +1,10 @@ +// check-pass +trait MyCmp { + fn cmp(&self) {} +} +impl MyCmp for f32 {} + +fn main() { + // Ensure that `impl Ord for F` is never considered for int and float infer vars. + 0.0.cmp(); +} From 9e579cc10c32945cdde6fa1fb474005d31b8c2cf Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:29:41 +0200 Subject: [PATCH 7/8] Add test --- .../missed-capture-issue-107414.rs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/ui/async-await/missed-capture-issue-107414.rs diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs new file mode 100644 index 0000000000000..0ab4f5ade9815 --- /dev/null +++ b/tests/ui/async-await/missed-capture-issue-107414.rs @@ -0,0 +1,24 @@ +// check-pass +// edition:2018 + +fn main() {} + +struct StructA {} +struct StructB {} + +impl StructA { + fn fn_taking_struct_b(&self, struct_b: &StructB) -> bool { + true + } +} + +async fn get_struct_a_async() -> StructA { + StructA {} +} + +async fn ice() { + match Some(StructB {}) { + Some(struct_b) if get_struct_a_async().await.fn_taking_struct_b(&struct_b) => {} + _ => {} + } +} From 07e3bd1ffbc3bacbbdc99fc923c2a301ad92372a Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Mon, 3 Apr 2023 20:07:35 +0100 Subject: [PATCH 8/8] Add Chris Denton to `.mailmap` --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index b8a9fc27eb7c7..92be31747501e 100644 --- a/.mailmap +++ b/.mailmap @@ -102,6 +102,7 @@ Carol Willing Chandler Deng Charles Lew CrLF0710 Chris C Cerami Chris C Cerami +Chris Denton Chris Denton Chris Gregory Chris Pardy Chris Pressey