Skip to content
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 6 pull requests #99555

Closed
wants to merge 20 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joboet and others added 20 commits June 30, 2022 11:48
These merged in rust-lang#97437 for 1.64.0, apart from the main `io_safety`
feature that stabilized in 1.63.0.
Fix type error

Fix continue_value doc comment
std: use futex-based locks on Fuchsia

This switches `Condvar` and `RwLock` to the futex-based implementation currently used on Linux and some BSDs. Additionally, `Mutex` now has its own, priority-inheriting implementation based on the mutex in Fuchsia's `libsync`. It differs from the original in that it panics instead of aborting when reentrant locking is detected.

`@rustbot` ping fuchsia
r? `@m-ou-se`
…t-generic-suffixes, r=petrochenkov

feat: omit suffixes in const generics (e.g. `1_i32`)

Closes rust-lang#99255
…-item, r=lcnr

Do not resolve associated const when there is no provided value

Fixes rust-lang#98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted.

----

The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error.

This root issue becomes problematic (as in rust-lang#98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message.

I'm not exactly sure _why_ this bug arises due to rust-lang#96591 -- perhaps valtrees are evaluated more eagerly than in the old system?

r? ````@oli-obk```` or ````@lcnr```` since y'all are familiar with const eval and reviewed rust-lang#96591, though feel free to reassign.

This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
…inators, r=scottmcm

Add map_continue and continue_value combinators to ControlFlow

As suggested in this comment: rust-lang#75744 (comment)

Related tracking issue: rust-lang#75744

r? ````@scottmcm````
Fix the stable version of `AsFd for Arc<T>` and `Box<T>`

These merged in rust-lang#97437 for 1.64.0, apart from the main `io_safety`
feature that stabilized in 1.63.0.
Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`

The current impl is far more confusing than it has any right to be ✨

r? rust-lang/types
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jul 21, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 21, 2022

📌 Commit 7f302a2 has been approved by Dylan-DPC

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 21, 2022
@bors
Copy link
Contributor

bors commented Jul 21, 2022

⌛ Testing commit 7f302a2 with merge 62c33296fb8be285f7c33aceac63e586837e1d62...

@bors
Copy link
Contributor

bors commented Jul 21, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 21, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    
    --- stdout
    
    running 17 tests
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Dollar_dollar_____ (line 233) ... ignored
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Hygiene (line 417) ... ignored
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing (line 258) ... ignored
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::Textual_Scope (line 280) ... ignored
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::The_ (line 371) ... ignored
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Dollar_dollar_____ (line 219) ... FAILED
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Transcribing (line 63) - compile fail ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Transcribing (line 86) - compile fail ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Dollar_dollar_____ (line 204) - compile fail ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::Textual_Scope (line 331) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::Textual_Scope (line 303) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::Path_Based_Scope (line 388) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Scoping__Exporting__and_Importing::The_ (line 350) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Hygiene (line 482) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Transcribing (line 102) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Hygiene (line 442) ... ok
    test /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Hygiene (line 459) ... ok
    failures:
    
    
    ---- /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Dollar_dollar_____ (line 219) stdout ----
    error[E0658]: meta-variable expressions are unstable
     --> /tmp/mdbook-pL0bRo/macros-by-example.md:223:16
    6 |             ( $$( $any:tt )* ) => { $$( $any )* };
      |                ^
      |
      = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
      = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
      = help: add `#![feature(macro_metavar_expr)]` to the crate attributes to enable
    
    error[E0658]: meta-variable expressions are unstable
     --> /tmp/mdbook-pL0bRo/macros-by-example.md:223:38
    6 |             ( $$( $any:tt )* ) => { $$( $any )* };
      |                                      ^
      |
      = note: see issue #83527 <https://github.com/rust-lang/rust/issues/83527> for more information
---
    For more information about this error, try `rustc --explain E0658`.
    Couldn't compile the test.
    
    failures:
        /tmp/mdbook-pL0bRo/macros-by-example.md - Macros_By_Example::Dollar_dollar_____ (line 219)
    test result: FAILED. 11 passed; 1 failed; 5 ignored; 0 measured; 0 filtered out; finished in 0.29s
    
    
    --- stderr
---

 error[E0412]: cannot find type `PhantomData` in this scope
   --> $DIR/ice-6252.rs:8:9
    |
 LL |     _n: PhantomData,
    |
 help: consider importing one of these items
    |
 LL | use core::marker::PhantomData;
 LL | use core::marker::PhantomData;
    |
 LL | use serde::__private::PhantomData;
 LL | use std::marker::PhantomData;
    |
 
 error[E0412]: cannot find type `VAL` in this scope
 error[E0412]: cannot find type `VAL` in this scope
   --> $DIR/ice-6252.rs:10:63
    |
 LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
    |          -                                                    ^^^ not found in this scope
    |          |
    |          help: you might be missing a type parameter: `, VAL`
 error[E0046]: not all trait items implemented, missing: `VAL`
   --> $DIR/ice-6252.rs:10:1
    |
 LL |     const VAL: T;
 LL |     const VAL: T;
    |     ------------ `VAL` from trait
 ...
 LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
-error: constant expression depends on a generic parameter
-  --> $DIR/ice-6252.rs:13:9
-   |
-   |
-LL |     [1; <Multiply<Five, Five>>::VAL];
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this may fail depending on what value the parameter takes
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0046, E0412.
---
To only update this specific test, also pass `--test-args crashes/ice-6252.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "tests/ui/crashes/ice-6252.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/crashes/ice-6252.stage-id" "-A" "unused" "--emit=metadata" "-Dwarnings" "-Zui-testing" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-ff530e80824c3a36.rlib" "--extern" "if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-03f75cdc6d4d3afc.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-46430df947b7dad0.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-7d13fa063f867ef0.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0c795f7a8756f15a.rlib" "--extern" "derive_new=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libderive_new-71205fa4273edf27.so" "--extern" "rustc_semver=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librustc_semver-963bbd3f89834643.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-021aec868151835c.rlib" "--extern" "clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-b92911696ae4394a.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-aceff80e643e9fe7.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-dcc59fbd39a40970.rlib" "--extern" "serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-5411643be5ff72c2.so" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-cdd893c121eb00e4.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-61ecef333190a996.rlib" "--edition=2021" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/test/ui/crashes/ice-6252.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
{"message":"cannot find type `PhantomData` in this scope","code":{"code":"E0412","explanation":"A used type name is not in scope.\n\nErroneous code examples:\n\n```compile_fail,E0412\nimpl Something {} // error: type name `Something` is not in scope\n\n// or:\n\ntrait Foo {\n    fn bar(N); // error: type name `N` is not in scope\n}\n\n// or:\n\nfn foo(x: T) {} // type name `T` is not in scope\n```\n\nTo fix this error, please verify you didn't misspell the type name, you did\ndeclare it or imported it into the scope. Examples:\n\n```\nstruct Something;\n\nimpl Something {} // ok!\n\n// or:\n\ntrait Foo {\n    type N;\n\n    fn bar(_: Self::N); // ok!\n}\n\n// or:\n\nfn foo<T>(x: T) {} // ok!\n```\n\nAnother case that causes this error is when a type is imported into a parent\nmodule. To fix this, you can follow the suggestion and use File directly or\n`use super::File;` which will import the types from the parent namespace. An\nexample that causes this error is below:\n\n```compile_fail,E0412\nuse std::fs::File;\n\nmod foo {\n    fn some_function(f: File) {}\n}\n```\n\n```\nuse std::fs::File;\n\nmod foo {\n    // either\n    use super::File;\n    // or\n    // use std::fs::File;\n    fn foo(f: File) {}\n}\n# fn main() {} // don't insert it for us; that'll break imports\n```\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":185,"byte_end":196,"line_start":8,"line_end":8,"column_start":9,"column_end":20,"is_primary":true,"text":[{"text":"    _n: PhantomData,","highlight_start":9,"highlight_end":20}],"label":"not found in this scope","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"consider importing one of these items","code":null,"level":"help","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":101,"byte_end":101,"line_start":3,"line_end":3,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"trait TypeVal<T> {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use core::marker::PhantomData;\n\n","suggestion_applicability":"MaybeIncorrect","expansion":null},{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":101,"byte_end":101,"line_start":3,"line_end":3,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"trait TypeVal<T> {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use serde::__private::PhantomData;\n\n","suggestion_applicability":"MaybeIncorrect","expansion":null},{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":101,"byte_end":101,"line_start":3,"line_end":3,"column_start":1,"column_end":1,"is_primary":true,"text":[{"text":"trait TypeVal<T> {","highlight_start":1,"highlight_end":1}],"label":null,"suggested_replacement":"use std::marker::PhantomData;\n\n","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0412]: cannot find type `PhantomData` in this scope\n  --> tests/ui/crashes/ice-6252.rs:8:9\n   |\nLL |     _n: PhantomData,\n   |         ^^^^^^^^^^^ not found in this scope\n   |\nhelp: consider importing one of these items\n   |\nLL | use core::marker::PhantomData;\n   |\nLL | use serde::__private::PhantomData;\n   |\nLL | use std::marker::PhantomData;\n   |\n\n"}
{"message":"cannot find type `VAL` in this scope","code":{"code":"E0412","explanation":"A used type name is not in scope.\n\nErroneous code examples:\n\n```compile_fail,E0412\nimpl Something {} // error: type name `Something` is not in scope\n\n// or:\n\ntrait Foo {\n    fn bar(N); // error: type name `N` is not in scope\n}\n\n// or:\n\nfn foo(x: T) {} // type name `T` is not in scope\n```\n\nTo fix this error, please verify you didn't misspell the type name, you did\ndeclare it or imported it into the scope. Examples:\n\n```\nstruct Something;\n\nimpl Something {} // ok!\n\n// or:\n\ntrait Foo {\n    type N;\n\n    fn bar(_: Self::N); // ok!\n}\n\n// or:\n\nfn foo<T>(x: T) {} // ok!\n```\n\nAnother case that causes this error is when a type is imported into a parent\nmodule. To fix this, you can follow the suggestion and use File directly or\n`use super::File;` which will import the types from the parent namespace. An\nexample that causes this error is below:\n\n```compile_fail,E0412\nuse std::fs::File;\n\nmod foo {\n    fn some_function(f: File) {}\n}\n```\n\n```\nuse std::fs::File;\n\nmod foo {\n    // either\n    use super::File;\n    // or\n    // use std::fs::File;\n    fn foo(f: File) {}\n}\n# fn main() {} // don't insert it for us; that'll break imports\n```\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":262,"byte_end":265,"line_start":10,"line_end":10,"column_start":63,"column_end":66,"is_primary":true,"text":[{"text":"impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}","highlight_start":63,"highlight_end":66}],"label":"not found in this scope","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"you might be missing a type parameter","code":null,"level":"help","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":209,"byte_end":209,"line_start":10,"line_end":10,"column_start":10,"column_end":10,"is_primary":true,"text":[{"text":"impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}","highlight_start":10,"highlight_end":10}],"label":null,"suggested_replacement":", VAL","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0412]: cannot find type `VAL` in this scope\n  --> tests/ui/crashes/ice-6252.rs:10:63\n   |\nLL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}\n   |          -                                                    ^^^ not found in this scope\n   |          |\n   |          help: you might be missing a type parameter: `, VAL`\n\n"}
{"message":"not all trait items implemented, missing: `VAL`","code":{"code":"E0046","explanation":"Items are missing in a trait implementation.\n\nErroneous code example:\n\n```compile_fail,E0046\ntrait Foo {\n    fn foo();\n}\n\nstruct Bar;\n\nimpl Foo for Bar {}\n// error: not all trait items implemented, missing: `foo`\n```\n\nWhen trying to make some type implement a trait `Foo`, you must, at minimum,\nprovide implementations for all of `Foo`'s required methods (meaning the\nmethods that do not have default implementations), as well as any required\ntrait items like associated types or constants. Example:\n\n```\ntrait Foo {\n    fn foo();\n}\n\nstruct Bar;\n\nimpl Foo for Bar {\n    fn foo() {} // ok!\n}\n```\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":200,"byte_end":244,"line_start":10,"line_end":10,"column_start":1,"column_end":45,"is_primary":true,"text":[{"text":"impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}","highlight_start":1,"highlight_end":45}],"label":"missing `VAL` in implementation","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":124,"byte_end":136,"line_start":4,"line_end":4,"column_start":5,"column_end":17,"is_primary":false,"text":[{"text":"    const VAL: T;","highlight_start":5,"highlight_end":17}],"label":"`VAL` from trait","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"implement the missing item: `const VAL: T = value;`","code":null,"level":"help","spans":[{"file_name":"tests/ui/crashes/ice-6252.rs","byte_start":268,"byte_end":268,"line_start":10,"line_end":10,"column_start":69,"column_end":69,"is_primary":true,"text":[{"text":"impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}","highlight_start":69,"highlight_end":69}],"label":null,"suggested_replacement":"const VAL: T = value;\n","suggestion_applicability":"HasPlaceholders","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0046]: not all trait items implemented, missing: `VAL`\n  --> tests/ui/crashes/ice-6252.rs:10:1\n   |\nLL |     const VAL: T;\n   |     ------------ `VAL` from trait\n...\nLL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation\n\n"}
{"message":"Some errors have detailed explanations: E0046, E0412.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"Some errors have detailed explanations: E0046, E0412.\n"}
{"message":"For more information about an error, try `rustc --explain E0046`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0046`.\n"}

------------------------------------------

@Dylan-DPC Dylan-DPC closed this Jul 22, 2022
@Dylan-DPC Dylan-DPC deleted the rollup-8ipg58f branch July 22, 2022 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants