-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 7 pull requests #125331
Rollup of 7 pull requests #125331
Commits on May 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c54301f - Browse repository at this point
Copy the full SHA c54301fView commit details -
fix: Check whether next_node is else-less if in get_return_block
Fix rust-lang#124819, where a if-less block causes a wrong output. It is caused by get_return_block in get_fn_decl. In get_return_block, when a else-less if expression is the tail expression, the check for next_node will keep iterating. So it is necessary to make a early return in the check.
Configuration menu - View commit details
-
Copy full SHA for 62318b3 - Browse repository at this point
Copy the full SHA 62318b3View commit details
Commits on May 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 1a3a54c - Browse repository at this point
Copy the full SHA 1a3a54cView commit details -
coverage: Memoize newly-created counter expressions
This currently has no effect, but is expected to be useful when expanding support for branch coverage and MC/DC coverage.
Configuration menu - View commit details
-
Copy full SHA for a68bb5e - Browse repository at this point
Copy the full SHA a68bb5eView commit details -
coverage: Simplify counter expressions using simple algebra
Some of these cases currently don't occur in practice, but are included for completeness, and to avoid having to add them later as branch coverage and MC/DC coverage start building more complex expressions.
Configuration menu - View commit details
-
Copy full SHA for d01df6f - Browse repository at this point
Copy the full SHA d01df6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 42119ff - Browse repository at this point
Copy the full SHA 42119ffView commit details
Commits on May 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c811acb - Browse repository at this point
Copy the full SHA c811acbView commit details
Commits on May 17, 2024
-
Suggest setting lifetime in borrowck error involving types with elide…
…d lifetimes ``` error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5 | LL | fn foo(mut x: Ref, y: Ref) { | ----- - has type `Ref<'_, '1>` | | | has type `Ref<'_, '2>` LL | x.b = y.b; | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` | help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'a, 'a>, y: Ref<'a, 'a>) { | ++++ ++++++++ ++++++++ ``` As can be seen above, it currently doesn't try to compare the `ty::Ty` lifetimes that diverged vs the `hir::Ty` to correctly suggest the following ``` help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'_, 'a>, y: Ref<'_, 'a>) { | ++++ ++++++++ ++++++++ ``` but I believe this to still be an improvement over the status quo. CC rust-lang#40990.
Configuration menu - View commit details
-
Copy full SHA for 9f730e9 - Browse repository at this point
Copy the full SHA 9f730e9View commit details -
Always constrain the return type in lifetime suggestion
``` error: lifetime may not live long enough --> f205.rs:8:16 | 7 | fn resolve_symbolic_reference(&self, reference: Option<Reference>) -> Option<Reference> { | - --------- has type `Option<Reference<'1>>` | | | let's call the lifetime of this reference `'2` 8 | return reference; | ^^^^^^^^^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter | 7 | fn resolve_symbolic_reference<'a>(&'a self, reference: Option<Reference<'a>>) -> Option<Reference<'a>> { | ++++ ++ ++++ ++++ ``` The correct suggestion would be ``` help: consider introducing a named lifetime parameter | 7 | fn resolve_symbolic_reference<'a>(&self, reference: Option<Reference<'a>>) -> Option<Reference<'a>> { | ++++ ++++ ++++ ``` but we are not doing the analysis to detect that yet. If we constrain `&'a self`, then the return type with a borrow will implicitly take its lifetime from `'a`, it is better to make it explicit in the suggestion, in case that `&self` *doesn't* need to be `'a`, but the return does.
Configuration menu - View commit details
-
Copy full SHA for 120049f - Browse repository at this point
Copy the full SHA 120049fView commit details -
Account for owning item lifetimes in suggestion and annotate tests as…
… `run-rustfix` ``` error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:12:9 | LL | fn ref_self(&self, f: &u32) -> &u32 { | - - let's call the lifetime of this reference `'1` | | | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | LL | fn ref_self<'b>(&'b self, f: &'b u32) -> &'b u32 { | ++++ ++ ++ ++ ```
Configuration menu - View commit details
-
Copy full SHA for d1d585d - Browse repository at this point
Copy the full SHA d1d585dView commit details -
Configuration menu - View commit details
-
Copy full SHA for ee5a157 - Browse repository at this point
Copy the full SHA ee5a157View commit details -
Tweak suggested lifetimes to modify return type instead of
&self
re……ceiver Do not suggest constraining the `&self` param, but rather the return type. If that is wrong (because it is not sufficient), a follow up error will tell the user to fix it. This way we lower the chances of *over* constraining, but still get the cake of "correctly" contrained in two steps. This is a correct suggestion: ``` error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:9:9 | LL | fn foo<'a>(&self, x: &i32) -> &i32 { | - - let's call the lifetime of this reference `'1` | | | let's call the lifetime of this reference `'2` LL | x | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | LL | fn foo<'a>(&self, x: &'a i32) -> &'a i32 { | ++ ++ ``` While this is incomplete because it should suggestino `&'a self` ``` error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 | LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | - - let's call the lifetime of this reference `'1` | | | let's call the lifetime of this reference `'2` LL | if true { x } else { self } | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | ++ ++ ``` but the follow up error is ``` error: lifetime may not live long enough --> tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs:7:30 | 6 | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | -- - let's call the lifetime of this reference `'1` | | | lifetime `'a` defined here 7 | if true { x } else { self } | ^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | 6 | fn foo<'a>(&'a self, x: &'a Foo) -> &'a Foo { | ++ ```
Configuration menu - View commit details
-
Copy full SHA for 1775e7b - Browse repository at this point
Copy the full SHA 1775e7bView commit details -
Configuration menu - View commit details
-
Copy full SHA for cf5702e - Browse repository at this point
Copy the full SHA cf5702eView commit details
Commits on May 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 95c0e5c - Browse repository at this point
Copy the full SHA 95c0e5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for d83c65e - Browse repository at this point
Copy the full SHA d83c65eView commit details
Commits on May 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 1d9757c - Browse repository at this point
Copy the full SHA 1d9757cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b0fd3b - Browse repository at this point
Copy the full SHA 7b0fd3bView commit details -
Configuration menu - View commit details
-
Copy full SHA for a4efe6f - Browse repository at this point
Copy the full SHA a4efe6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for a2e0f10 - Browse repository at this point
Copy the full SHA a2e0f10View commit details -
Rollup merge of rust-lang#124682 - estebank:issue-40990, r=pnkfelix
Suggest setting lifetime in borrowck error involving types with elided lifetimes ``` error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5 | LL | fn foo(mut x: Ref, y: Ref) { | ----- - has type `Ref<'_, '1>` | | | has type `Ref<'_, '2>` LL | x.b = y.b; | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` | help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'a, 'a>, y: Ref<'a, 'a>) { | ++++ ++++++++ ++++++++ ``` As can be seen above, it currently doesn't try to compare the `ty::Ty` lifetimes that diverged vs the `hir::Ty` to correctly suggest the following ``` help: consider introducing a named lifetime parameter | LL | fn foo<'a>(mut x: Ref<'_, 'a>, y: Ref<'_, 'a>) { | ++++ ++++++++ ++++++++ ``` but I believe this to still be an improvement over the status quo. Fix rust-lang#40990.
Configuration menu - View commit details
-
Copy full SHA for 29c603c - Browse repository at this point
Copy the full SHA 29c603cView commit details -
Rollup merge of rust-lang#124917 - cardigan1008:issue-124819, r=pnkfelix
Check whether the next_node is else-less if in get_return_block Fix rust-lang#124819
Configuration menu - View commit details
-
Copy full SHA for ba1bb80 - Browse repository at this point
Copy the full SHA ba1bb80View commit details -
Rollup merge of rust-lang#125106 - Zalathar:expressions, r=davidtwco
coverage: Memoize and simplify counter expressions When creating coverage counter expressions as part of coverage instrumentation, we often end up creating obviously-redundant expressions like `c1 + (c0 - c1)`, which is equivalent to just `c0`. To avoid doing so, this PR checks when we would create an expression matching one of 5 patterns, and uses the simplified form instead: - `(a - b) + b` → `a`. - `(a + b) - b` → `a`. - `(a + b) - a` → `b`. - `a + (b - a)` → `b`. - `a - (a - b)` → `b`. Of all the different ways to combine 3 operands and 2 operators, these are the patterns that allow simplification. (Some of those patterns currently don't occur in practice, but are included anyway for completeness, to avoid having to add them later as branch coverage and MC/DC coverage support expands.) --- This PR also adds memoization for newly-created (or newly-simplified) counter expressions, to avoid creating duplicates. This currently makes no difference to the final mappings, but is expected to be useful for MC/DC coverage of match expressions, as proposed by rust-lang#124278 (comment).
Configuration menu - View commit details
-
Copy full SHA for e0d9228 - Browse repository at this point
Copy the full SHA e0d9228View commit details -
Rollup merge of rust-lang#125173 - scottmcm:never-checked, r=davidtwco
Remove `Rvalue::CheckedBinaryOp` Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/intrinsics.20vs.20binop.2Funop/near/438729996> cc `@RalfJung` While it's a draft, r? ghost
Configuration menu - View commit details
-
Copy full SHA for 9987e90 - Browse repository at this point
Copy the full SHA 9987e90View commit details -
Rollup merge of rust-lang#125305 - jwong101:120493-codegen-test, r=th…
…e8472 add some codegen tests for issue 120493 I forgot to add these in rust-lang#123878.
Configuration menu - View commit details
-
Copy full SHA for 83cceea - Browse repository at this point
Copy the full SHA 83cceeaView commit details -
Rollup merge of rust-lang#125314 - jdonszelmann:global-registration-f…
…eature-gate, r=pnkfelix Add an experimental feature gate for global registration See rust-lang#125119 for the tracking issue.
Configuration menu - View commit details
-
Copy full SHA for a79737c - Browse repository at this point
Copy the full SHA a79737cView commit details -
Rollup merge of rust-lang#125318 - GuillaumeGomez:migrate-rustdoc-exa…
…mples-whitespaces, r=jieyouxu Migrate `run-make/rustdoc-scrape-examples-whitespace` to `rmake.rs` Part of rust-lang#121876. r? `@jieyouxu`
Configuration menu - View commit details
-
Copy full SHA for 1640225 - Browse repository at this point
Copy the full SHA 1640225View commit details