Rollup of 6 pull requests#154160
Conversation
Stash parse errors when pasing rtn that doesn't use `(..)`. Emit single error on `Foo::bar(qux)` that looks like rtn in incorrect position and suggest `Foo::bar(..)`. ``` error: return type notation not allowed in this position yet --> $DIR/let-binding-init-expr-as-ty.rs:18:10 | LL | struct K(S::new(())); | ^^^^^^^^^^ | help: furthermore, argument types not allowed with return type notation | LL - struct K(S::new(())); LL + struct K(S::new(..)); | ``` On incorrect rtn in let binding type for an existing inherent associated function, suggest `:` -> `=` to turn the "type" into a call expression. ``` error: expected type, found associated function call --> $DIR/let-binding-init-expr-as-ty.rs:29:12 | LL | let x: S::new(()); | ^^^^^^^^^^ | help: use `=` if you meant to assign | LL - let x: S::new(()); LL + let x = S::new(()); | ```
The test began compiling with `nightly-2022-11-25`, and more specifically 9f36f98. The test fails to compile with `nightly-2022-11-24`: $ rustc +nightly-2022-11-24 --edition 2018 tests/ui/async-await/drop-option-future.rs error[E0597]: `value` does not live long enough --> tests/ui/async-await/drop-option-future.rs:12:22 | 12 | f = Some(async { value }); | --^^^^^-- | | | | | borrowed value does not live long enough | value captured here by generator 13 | core::mem::drop(f); 14 | } | - | | | `value` dropped here while still borrowed | borrow might be used here, when `f` is dropped and runs the destructor for type `Option<impl Future<Output = i32>>` The fix 9f36f98 does not appear to affect or include a regression test for our issue, so let's add that test.
Don't suggest non-deriveable traits for unions. This also adds enum, struct and union markers to rustc_on_unimplemented
Emit fewer errors for incorrect rtn and `=` -> `:` typos in bindings Make all existing `:` -> `=` typo suggestions verbose and tweak the suggested code. Stash parse errors when pasing rtn that doesn't use `(..)`. Emit single error on `Foo::bar(qux)` that looks like rtn in incorrect position and suggest `Foo::bar(..)`. ``` error: return type notation not allowed in this position yet --> $DIR/let-binding-init-expr-as-ty.rs:18:10 | LL | struct K(S::new(())); | ^^^^^^^^^^ | help: furthermore, argument types not allowed with return type notation | LL - struct K(S::new(())); LL + struct K(S::new(..)); | ``` On incorrect rtn in let binding type for an existing inherent associated function, suggest `:` -> `=` to turn the "type" into a call expression. (Fix rust-lang#134087) ``` error: expected type, found associated function call --> $DIR/let-binding-init-expr-as-ty.rs:29:12 | LL | let x: S::new(()); | ^^^^^^^^^^ | help: use `=` if you meant to assign | LL - let x: S::new(()); LL + let x = S::new(()); | ```
tests/ui/async-await/drop-option-future.rs: New regression test The test began compiling with `nightly-2022-11-25`. I bisected it further, and the commit that made it compile was 9f36f98 (rust-lang#104321). The test fails to compile with `nightly-2022-11-24`: $ rustc +nightly-2022-11-24 --edition 2018 tests/ui/async-await/drop-option-future.rs error[E0597]: `value` does not live long enough --> tests/ui/async-await/drop-option-future.rs:12:22 | 12 | f = Some(async { value }); | --^^^^^-- | | | | | borrowed value does not live long enough | value captured here by generator 13 | core::mem::drop(f); 14 | } | - | | | `value` dropped here while still borrowed | borrow might be used here, when `f` is dropped and runs the destructor for type `Option<impl Future<Output = i32>>` The fix 9f36f98 does not appear to affect or include a regression test for the rust-lang#98077 case, so let's add that test. Closes rust-lang#98077 since we add the test from that issue.
…anBrouwer
Allow passing `expr` metavariable as `cfg` predicate
This PR allows expanding `expr` metavariables inside the configuration predicates of `cfg` and `cfg_attr` invocations.
For example, the following code will now compile:
```rust
macro_rules! mac {
($e:expr) => {
#[cfg_attr($e, inline)]
#[cfg($e)]
fn func() {}
#[cfg(not($e))]
fn func() {
panic!()
}
}
}
mac!(any(unix, feature = "foo"));
```
There is currently no `macro_rules` fragment specifier that can represent all valid `cfg` predicates. `meta` comes closest, but excludes `true` and `false`. By fixing that, this change makes it easier to write declarative macros that parse `cfg` or `cfg_attr` invocations, for example rust-lang#146281.
@rustbot label T-lang needs-fcp A-attributes A-cfg A-macros
…for-unions, r=JonathanBrouwer don't suggest non-deriveable traits for unions Fixes rust-lang#137587 Before, the compiler suggested adding `#[derive(Debug)]` (other traits too) for unions, which is misleading because some traits can't be automatically derived. Only traits that are still suggested are Copy and Clone. I noticed the error label changed after removing the suggestion. I hope this isn't a big deal, but let me know if that's an issue. original example: ```rs union Union { member: usize, } impl PartialEq<u8> for Union { fn eq(&self, rhs: &u8) -> bool { unsafe { self.member == (*rhs).into() } } } fn main() { assert_eq!(Union { member: 0 }, 0); } ``` before: ``` error[E0277]: `Union` doesn't implement `Debug` --> src\main.rs:13:5 | 13 | assert_eq!(Union { member: 0 }, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `Union` | = note: add `#[derive(Debug)]` to `Union` or manually `impl Debug for Union` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Union` with `#[derive(Debug)]` | 2 + #[derive(Debug)] 3 | union Union { | ``` after (the message doesn't suggest adding #[derive(Debug)] to unions) ``` error[E0277]: `Union` doesn't implement `Debug` --> src\main.rs:13:5 | 13 | assert_eq!(Union { member: 0 }, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Debug` is not implemented for `Union` --> src\main.rs:2:1 | 2 | union Union { | ^^^^^^^^^^^ = note: manually `impl Debug for Union` ```
…athanBrouwer Start migrating `DecorateDiagCompat::Builtin` items to `DecorateDiagCompat::Dynamic` Part of rust-lang#153099. End goal being to completely remove the two steps currently required by `DecorateDiagCompat::Builtin` and remove duplicated types. r? @JonathanBrouwer
…wck, r=Kivooeo Moving issue-52049 to borrowck
|
@bors r+ rollup=never p=5 |
This comment has been minimized.
This comment has been minimized.
…uwer Rollup of 6 pull requests Successful merges: - #154154 (Emit fewer errors for incorrect rtn and `=` -> `:` typos in bindings) - #154155 (tests/ui/async-await/drop-option-future.rs: New regression test) - #146961 (Allow passing `expr` metavariable as `cfg` predicate) - #154118 (don't suggest non-deriveable traits for unions) - #154120 (Start migrating `DecorateDiagCompat::Builtin` items to `DecorateDiagCompat::Dynamic`) - #154156 (Moving issue-52049 to borrowck)
|
💔 Test for 31a2ed3 failed: CI. Failed job:
|
|
seemingly spurious @bors retry |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 44e6620 (parent) -> e52f547 (this PR) Test differencesShow 234 test diffsStage 1
Stage 2
Additionally, 216 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard e52f547ed4bc554e40ab63b264e8697b8e3c5e09 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (e52f547): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.3%, secondary 0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 3.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 485.042s -> 483.272s (-0.36%) |
Successful merges:
=->:typos in bindings #154154 (Emit fewer errors for incorrect rtn and=->:typos in bindings)exprmetavariable ascfgpredicate #146961 (Allow passingexprmetavariable ascfgpredicate)DecorateDiagCompat::Builtinitems toDecorateDiagCompat::Dynamic#154120 (Start migratingDecorateDiagCompat::Builtinitems toDecorateDiagCompat::Dynamic)r? @ghost
Create a similar rollup