Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

crlf0710 and others added 12 commits April 8, 2021 02:52
… r=Manishearth

Stablize `non-ascii-idents`

This is the stablization PR for RFC 2457. Currently this is waiting on fcp in [tracking issue](rust-lang#55467).

r? `@Manishearth`
…llaumeGomez

rustdoc: Reduce visual weight of attributes.

Followup from rust-lang#83337. As part of that PR, we stopped hiding attributes behind a toggle, because most things have just zero or one attributes. However, this made clear that the current rendering of attributes emphasizes them a lot, which distracts from function signatures. This PR changes their color of attributes to be the same as the toggles, and reduces their font weight.

This also removes `#[lang]` from the list of ALLOWED_ATTRIBUTES. This attribute is an implementation detail rather than part of the public-facing documentation.

![image](https://user-images.githubusercontent.com/220205/115131061-cc407d80-9fa9-11eb-9a77-ad3f3217f391.png)

Demo at https://hoffman-andrews.com/rust/de-emph-attr/std/string/struct.String.html#method.trim
…vink

Slightly change wording in doc comment and fix typo in vec/mod.rs

Suggested by ```@pickfire``` in rust-lang#82760
fix suggestion for unsized function parameters

taken from `@fasterthanlime's` article https://fasterthanli.me/articles/whats-in-the-box
…never-note, r=petrochenkov

Improve an error message.
@rustbot rustbot added the rollup A PR which is a rollup label Apr 18, 2021
@GuillaumeGomez
Copy link
Member Author

@bors: r+ p=6 rollup=never

@bors
Copy link
Collaborator

bors commented Apr 18, 2021

📌 Commit 8eb1f5c has been approved by GuillaumeGomez

@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 Apr 18, 2021
@bors
Copy link
Collaborator

bors commented Apr 18, 2021

⌛ Testing commit 8eb1f5c with merge 0e3f563c698594b6a3995420a3d95a0e20fc96ea...

@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)

---- compile_test stdout ----
diff of stderr:

 error[E0601]: `main` function not found in crate `ice_6251`
   --> $DIR/ice-6251.rs:4:1
    |
 LL | / fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
 LL | |     std::iter::empty()
 LL | | }
    | |_^ consider adding a `main` function to `$DIR/ice-6251.rs`
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
   --> $DIR/ice-6251.rs:4:45
    |
 LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
    |                                             ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = help: unsized fn params are gated as an unstable feature
 help: function arguments must have a statically known size, borrowed types always have a known size
    |
-LL | fn bug<T>() -> impl Iterator<Item = [(); { |&x: [u8]| x }]> {
-   |                                             ^
+LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: &[u8]| x }]> {
 
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
   --> $DIR/ice-6251.rs:4:54
    |
 LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
    |                                                      ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: the return type of a function must have a statically known size
 error[E0308]: mismatched types
   --> $DIR/ice-6251.rs:4:44
    |
    |
 LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
    |                                            ^^^^^^^^^^^ expected `usize`, found closure
    = note: expected type `usize`
    = note: expected type `usize`
            found closure `[closure@$DIR/ice-6251.rs:4:44: 4:55]`
 error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0277, E0308, E0601.
 For more information about an error, try `rustc --explain E0277`.
 For more information about an error, try `rustc --explain E0277`.
 

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-4cfe8e74ca7ddba1/out/test_build_base/crashes/ice-6251.stage-id.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args crashes/ice-6251.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/clippy-driver" "tests/ui/crashes/ice-6251.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-4cfe8e74ca7ddba1/out/test_build_base" "--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/build/clippy-4cfe8e74ca7ddba1/out/test_build_base/crashes/ice-6251.stage-id" "-A" "unused" "--emit=metadata" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "-Dwarnings" "-Zui-testing" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-43d16fd8e2fbc291.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-3f3ead7dae58a5a8.rlib" "--extern" "clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-934c285f6858724f.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-7f4531ca9e916653.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-3365d689274e8da9.rlib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/build/clippy-4cfe8e74ca7ddba1/out/test_build_base/crashes/ice-6251.stage-id.aux"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
{"message":"`main` function not found in crate `ice_6251`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate.\n\nTo fix this error, add a `main` function:\n\n```\nfn main() {\n    // Your program will start here.\n    println!(\"Hello world!\");\n}\n```\n\nIf you don't know the basics of Rust, you can look at the\n[Rust Book][rust-book] to get started.\n\n[rust-book]: https://doc.rust-lang.org/book/\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6251.rs","byte_start":100,"byte_end":185,"line_start":4,"line_end":6,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {","highlight_start":1,"highlight_end":61},{"text":"    std::iter::empty()","highlight_start":1,"highlight_end":23},{"text":"}","highlight_start":1,"highlight_end":2}],"label":"consider adding a `main` function to `tests/ui/crashes/ice-6251.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0601]: `main` function not found in crate `ice_6251`\n  --> tests/ui/crashes/ice-6251.rs:4:1\n   |\nLL | / fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {\nLL | |     std::iter::empty()\nLL | | }\n   | |_^ consider adding a `main` function to `tests/ui/crashes/ice-6251.rs`\n\n"}
{"message":"the size for values of type `[u8]` cannot be known at compilation time","code":{"code":"E0277","explanation":"You tried to use a type which doesn't implement some trait in a place which\nexpected that trait.\n\nErroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function. Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function. It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6251.rs","byte_start":144,"byte_end":145,"line_start":4,"line_end":4,"column_start":45,"column_end":46,"is_primary":true,"text":[{"text":"fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {","highlight_start":45,"highlight_end":46}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `[u8]`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"unsized fn params are gated as an unstable feature","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"function arguments must have a statically known size, borrowed types always have a known size","code":null,"level":"help","spans":[{"file_name":"tests/ui/crashes/ice-6251.rs","byte_start":147,"byte_end":147,"line_start":4,"line_end":4,"column_start":48,"column_end":48,"is_primary":true,"text":[{"text":"fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {","highlight_start":48,"highlight_end":48}],"label":null,"suggested_replacement":"&","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `[u8]` cannot be known at compilation time\n  --> tests/ui/crashes/ice-6251.rs:4:45\n   |\nLL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {\n   |                                             ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `[u8]`\n   = help: unsized fn params are gated as an unstable feature\nhelp: function arguments must have a statically known size, borrowed types always have a known size\n   |\nLL | fn bug<T>() -> impl Iterator<Item = [(); { |x: &[u8]| x }]> {\n   |                                                ^\n\n"}
{"message":"the size for values of type `[u8]` cannot be known at compilation time","code":{"code":"E0277","explanation":"You tried to use a type which doesn't implement some trait in a place which\nexpected that trait.\n\nErroneous code example:\n\n```compile_fail,E0277\n// here we declare the Foo trait with a bar method\ntrait Foo {\n    fn bar(&self);\n}\n\n// we now declare a function which takes an object implementing the Foo trait\nfn some_func<T: Foo>(foo: T) {\n    foo.bar();\n}\n\nfn main() {\n    // we now call the method with the i32 type, which doesn't implement\n    // the Foo trait\n    some_func(5i32); // error: the trait bound `i32 : Foo` is not satisfied\n}\n```\n\nIn order to fix this error, verify that the type you're using does implement\nthe trait. Example:\n\n```\ntrait Foo {\n    fn bar(&self);\n}\n\nfn some_func<T: Foo>(foo: T) {\n    foo.bar(); // we can now use this method since i32 implements the\n               // Foo trait\n}\n\n// we implement the trait on the i32 type\nimpl Foo for i32 {\n    fn bar(&self) {}\n}\n\nfn main() {\n    some_func(5i32); // ok!\n}\n```\n\nOr in a generic context, an erroneous code example would look like:\n\n```compile_fail,E0277\nfn some_func<T>(foo: T) {\n    println!(\"{:?}\", foo); // error: the trait `core::fmt::Debug` is not\n                           //        implemented for the type `T`\n}\n\nfn main() {\n    // We now call the method with the i32 type,\n    // which *does* implement the Debug trait.\n    some_func(5i32);\n}\n```\n\nNote that the error here is in the definition of the generic function. Although\nwe only call it with a parameter that does implement `Debug`, the compiler\nstill rejects the function. It must work with all possible input types. In\norder to make this example compile, we need to restrict the generic type we're\naccepting:\n\n```\nuse std::fmt;\n\n// Restrict the input type to types that implement Debug.\nfn some_func<T: fmt::Debug>(foo: T) {\n    println!(\"{:?}\", foo);\n}\n\nfn main() {\n    // Calling the method is still fine, as i32 implements Debug.\n    some_func(5i32);\n\n    // This would fail to compile now:\n    // struct WithoutDebug;\n    // some_func(WithoutDebug);\n}\n```\n\nRust only looks at the signature of the called function, as such it must\nalready specify all requirements that will be used for every type parameter.\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6251.rs","byte_start":153,"byte_end":153,"line_start":4,"line_end":4,"column_start":54,"column_end":54,"is_primary":true,"text":[{"text":"fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {","highlight_start":54,"highlight_end":54}],"label":"doesn't have a size known at compile-time","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the trait `std::marker::Sized` is not implemented for `[u8]`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"the return type of a function must have a statically known size","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0277]: the size for values of type `[u8]` cannot be known at compilation time\n  --> tests/ui/crashes/ice-6251.rs:4:54\n   |\nLL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {\n   |                                                      ^ doesn't have a size known at compile-time\n   |\n   = help: the trait `std::marker::Sized` is not implemented for `[u8]`\n   = note: the return type of a function must have a statically known size\n\n"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.\n\nErroneous code examples:\n\n```compile_fail,E0308\nfn plus_one(x: i32) -> i32 {\n    x + 1\n}\n\nplus_one(\"Not a number\");\n//       ^^^^^^^^^^^^^^ expected `i32`, found `&str`\n\nif \"Not a bool\" {\n// ^^^^^^^^^^^^ expected `bool`, found `&str`\n}\n\nlet x: f32 = \"Not a float\";\n//     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str`\n//     |\n//     expected due to this\n```\n\nThis error occurs when an expression was used in a place where the compiler\nexpected an expression of a different type. It can occur in several cases, the\nmost common being when calling a function and passing an argument which has a\ndifferent type than the matching type in the function declaration.\n"},"level":"error","spans":[{"file_name":"tests/ui/crashes/ice-6251.rs","byte_start":143,"byte_end":154,"line_start":4,"line_end":4,"column_start":44,"column_end":55,"is_primary":true,"text":[{"text":"fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {","highlight_start":44,"highlight_end":55}],"label":"expected `usize`, found closure","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `usize`\nfound closure `[closure@tests/ui/crashes/ice-6251.rs:4:44: 4:55]`","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"error[E0308]: mismatched types\n  --> tests/ui/crashes/ice-6251.rs:4:44\n   |\nLL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {\n   |                                            ^^^^^^^^^^^ expected `usize`, found closure\n   |\n   = note: expected type `usize`\n           found closure `[closure@tests/ui/crashes/ice-6251.rs:4:44: 4:55]`\n\n"}
{"message":"Some errors have detailed explanations: E0277, E0308, E0601.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"Some errors have detailed explanations: E0277, E0308, E0601.\n"}
{"message":"For more information about an error, try `rustc --explain E0277`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about an error, try `rustc --explain E0277`.\n"}

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

@bors
Copy link
Collaborator

bors commented Apr 18, 2021

💔 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 Apr 18, 2021
@JohnTitor
Copy link
Member

Failed by #84313, closing.

@JohnTitor JohnTitor closed this Apr 19, 2021
@GuillaumeGomez GuillaumeGomez deleted the rollup-3aepyer branch April 19, 2021 08:19
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.