-
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
Implement NonZero
traits generically.
#121241
Conversation
This comment has been minimized.
This comment has been minimized.
Strange that this would affect the diagnostic in this way, but I don't think it blocks this PR. Before: error[E0223]: ambiguous associated type
--> <anon>:1:10
|
1 | type F = Fn() -> (u8)::Output;
| ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn Fn() -> u8 + 'static) as IntoFuture>::Output` After: error[E0223]: ambiguous associated type
--> <anon>:1:10
|
1 | type F = Fn() -> (u8)::Output;
| ^^^^^^^^^^^^^^^^^^^^
|
help: use fully-qualified syntax
|
1 | type F = <(dyn Fn() -> u8 + 'static) as BitOr>::Output;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 | type F = <(dyn Fn() -> u8 + 'static) as IntoFuture>::Output;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
LGTM as soon as ui tests are blessed. x.py test tests/ui --bless
I reviewed the changes locally, there are 3 other changes which are insignificant.
--- a/tests/ui/fmt/ifmt-unimpl.stderr
+++ b/tests/ui/fmt/ifmt-unimpl.stderr
@@ -15,7 +15,7 @@ LL | format!("{:X}", "3");
i128
usize
u8
- and 20 others
+ and 9 others
= note: required for `&str` to implement `UpperHex`
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_upper_hex`
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -46,7 +46,6 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(
= note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
- impl From<Char> for u32;
- impl From<Ipv4Addr> for u32;
- - impl From<NonZero<u32>> for u32;
- impl From<bool> for u32;
- impl From<char> for u32;
- impl From<u16> for u32;
--- a/tests/ui/try-trait/bad-interconversion.stderr
+++ b/tests/ui/try-trait/bad-interconversion.stderr
@@ -11,7 +11,6 @@ LL | Ok(Err(123_i32)?)
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<u8 as From<bool>>
- <u8 as From<NonZero<u8>>>
<u8 as From<Char>>
= note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`
@bors delegate+ |
✌️ @reitermarkus, you can now approve this pull request! If @dtolnay told you to " |
331f8c2
to
f12d248
Compare
@bors r=dtolnay |
…s, r=dtolnay Implement `NonZero` traits generically. Tracking issue: rust-lang#120257 r? `@dtolnay`
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#121067 (make "invalid fragment specifier" translatable) - rust-lang#121079 (distribute tool documentations and avoid file conflicts on `x install`) - rust-lang#121230 (Extend Level API) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121247 (Add help to `hir_analysis_unrecognized_intrinsic_function`) r? `@ghost` `@rustbot` modify labels: rollup
…s, r=dtolnay Implement `NonZero` traits generically. Tracking issue: rust-lang#120257 r? ``@dtolnay``
Rollup of 8 pull requests Successful merges: - rust-lang#121167 (resolve: Scale back unloading of speculatively loaded crates) - rust-lang#121196 (Always inline check in `assert_unsafe_precondition` with cfg(debug_assertions)) - rust-lang#121206 (Top level error handling) - rust-lang#121223 (intrinsics::simd: add missing functions) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121242 (Generate `getelementptr` instead of `inttoptr` for `ptr::invalid`) - rust-lang#121278 (Remove the "codegen" profile from bootstrap) - rust-lang#121286 (Rename `ConstPropLint` to `KnownPanicsLint`) r? `@ghost` `@rustbot` modify labels: rollup
…s, r=dtolnay Implement `NonZero` traits generically. Tracking issue: rust-lang#120257 r? ```@dtolnay```
Rollup of 8 pull requests Successful merges: - rust-lang#121167 (resolve: Scale back unloading of speculatively loaded crates) - rust-lang#121196 (Always inline check in `assert_unsafe_precondition` with cfg(debug_assertions)) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121278 (Remove the "codegen" profile from bootstrap) - rust-lang#121286 (Rename `ConstPropLint` to `KnownPanicsLint`) - rust-lang#121291 (target: Revert default to the medium code model on LoongArch targets) - rust-lang#121302 (Remove `RefMutL` hack in `proc_macro::bridge`) - rust-lang#121318 (Trigger `unsafe_code` lint on invocations of `global_asm`) Failed merges: - rust-lang#121206 (Top level error handling) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121241 - reitermarkus:generic-nonzero-traits, r=dtolnay Implement `NonZero` traits generically. Tracking issue: rust-lang#120257 r? ````@dtolnay````
Tracking issue: #120257
r? @dtolnay