about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-10-02Auto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomccbors-0/+20
Tell LLVM that `partition_point` returns a valid fencepost This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations. Demonstration that nightly can't do this optimization today, and leaves in the panicking path: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e1074cd2faf5f68e49cffd728ded243a> r? `@thomcc`
2022-10-02Delay evaluating lint primary message until after it would be suppressedMichael Goulet-0/+19
2022-10-02Add a known-bug test for #102498Michael Goulet-0/+39
2022-10-02Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisabors-1/+1
Declare `main` as visibility hidden on targets that default to hidden. On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden. This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.
2022-10-02Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jshaMatthias Krüger-0/+32
rustdoc: remove orphaned link on array bracket This is #98069, but for arrays instead. For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices. For generics, the entire thing becomes a link, just like slices. | Type | Before | After | |--|--|--| | u32 | <code>pub fn alpha() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code> | generic | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>
2022-10-01Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obkbors-8/+8
Compute lint levels by definition Second attempt to https://github.com/rust-lang/rust/pull/101620. I think that I have removed the perf regression.
2022-10-01Auto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-sebors-14/+108
Fix `format_args` capture for macro expanded format strings Since #100996 `format_args` capture for macro expanded strings aren't prevented when the span of the expansion points to a string literal, e.g. ```rust // not a terribly realistic example, but also happens for proc_macros that set // the span of the output to an input str literal, such as indoc macro_rules! x { ($e:expr) => { $e } } fn main() { let a = 1; println!(x!("{a}")); } ``` The tests didn't catch it as the span of `concat!()` points to the macro invocation r? `@m-ou-se`
2022-10-01Compute `lint_levels` by definitionDeadbeef-8/+8
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-1281/+1285
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Recover wrong cased keywords starting functionsMaybe Waffle-3/+129
2022-10-01recover wrong-cased `use`s (`Use`, `USE`, etc)Maybe Waffle-0/+28
2022-10-01`ui-fulldeps`: adopt to the new rustc lint APIMaybe Waffle-39/+43
2022-10-01bless rustdoc-uiMaybe Waffle-48/+48
2022-10-01bless ui testsMaybe Waffle-1194/+1194
2022-10-01Auto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddlebors-0/+233
Migrate sidebar links color to CSS variables and unify themes with ayu Part of https://github.com/rust-lang/rust/pull/98460. This PR does two things: 1. Migrate more theme CSS rules toward CSS variables. 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this. You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`). cc `@jsha` r? `@notriddle`
2022-09-30Tell LLVM that `partition_point` returns a valid fencepostScott McMurray-0/+20
This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.
2022-09-30Allow `hidden` in src/test/codegen/abi-main-signature-32bit-c-int.rsDan Gohman-1/+1
2022-09-30Rollup merge of #102521 - notriddle:notriddle/impl-items-section, ↵Matthias Krüger-11/+31
r=GuillaumeGomez rustdoc: add missing margin to no-docblock methods Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks). See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations <details> # Before ![image](https://user-images.githubusercontent.com/1593513/193318777-2bc082fb-6579-4bd8-a0e3-d23a32b4820f.png) # After ![image](https://user-images.githubusercontent.com/1593513/193318968-b6ccacad-940b-4ed3-a0ae-dcf2079c2bae.png) </details> See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html <details> # Before ![image](https://user-images.githubusercontent.com/1593513/193319636-7ff9c99e-0208-462c-99de-7672e92ce4d6.png) # After ![image](https://user-images.githubusercontent.com/1593513/193322675-403bd165-7394-43e2-8ab4-d1f364666093.png) </details>
2022-09-30Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillotMatthias Krüger-0/+50
Generate synthetic region from `impl` even in closure body within an associated fn Fixes #102209
2022-09-30Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillotMatthias Krüger-8/+8
create def ids for impl traits during ast lowering r? `@cjgillot`
2022-09-30Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholkMatthias Krüger-0/+34
Fix ICE in const_trait check code This fixes #102156.
2022-09-30rustdoc: remove orphaned link on array bracketMichael Howell-0/+32
This is 682889fb06591c4245422b73b005c5d8ae2d0cad, but for arrays instead. For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices. For generics, the entire thing becomes a link, just like slices.
2022-09-30rustdoc: update test cases for `<section>` tags in traitsMichael Howell-11/+11
2022-09-30create def ids for impl traits during ast loweringSantiago Pastorino-8/+8
2022-09-30rustdoc: add gui test for no-docblock marginsMichael Howell-0/+20
2022-09-30Rollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqdMatthias Krüger-1/+0
Reinstate `hir-stats.rs` test for stage 1. It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2. r? ```@lqd```
2022-09-30Rollup merge of #102421 - lyming2007:issue-101866, r=lcnrMatthias Krüger-0/+33
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-30blessBoxy-2/+2
2022-09-30make `compare_const_impl` a query and use it in `instance.rs`Boxy-0/+40
2022-09-30Fix format_args capture for macro expanded format stringsAlex Macleod-14/+108
2022-09-30bless testsb-naber-7/+27
2022-09-30use build-pass for the testX-1/+1
2022-09-30Add GUI test for sidebar links colorGuillaume Gomez-0/+233
2022-09-30Rollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomezMatthias Krüger-11/+8
rustdoc: remove no-op source sidebar `opacity` These rules were added in dc2c9723343c985740be09919236a6e96c4e4433 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything. https://github.com/rust-lang/rust/blob/dc2c9723343c985740be09919236a6e96c4e4433/src/librustdoc/html/static/css/rustdoc.css#L350-L354 The transition was remove with 237d62588ddb4b7a93f3f5c61ea9253eba30ed5d, but the now-redundant `opacity` property was not.
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-5/+27
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-30Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Kibors-0/+20
Serialize return-position `impl Trait` in trait hidden values in foreign libraries Fixes #101630
2022-09-29Enable inline stack probes on X86 with LLVM 16Josh Stone-1/+51
2022-09-30Reinstate `hir-stats.rs` test for stage 1.Nicholas Nethercote-1/+0
It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2.
2022-09-29Auto merge of #101887 - nnethercote:shrink-Res, r=spastorinobors-46/+46
Shrink `hir::def::Res` r? `@spastorino`
2022-09-29rustdoc: update test case now that the UI animation is removedMichael Howell-11/+8
2022-09-29Generate synthetic impl region even in closure body in associated fnMichael Goulet-0/+50
2022-09-29remove the unused :: between trait and type to give user correct diagnostic ↵Yiming Lei-0/+33
information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-29Check generic argument compatibility when projecting assoc tyMichael Goulet-0/+28
2022-09-29Rollup merge of #102447 - notriddle:notriddle/method-toggle, r=jshaMichael Howell-6/+6
rustdoc: add method spacing to trait methods More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed. This PR makes two changes to the appearance of trait pages: * It adds the `method-toggle` class to method toggles on traits, making the DOM more consistent with type pages (which already have this class). ## Before ![image](https://user-images.githubusercontent.com/1593513/192914353-ed17e1eb-df1d-480b-9998-3b5e8283b0ee.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914570-bdd0f2e1-5254-4e2e-9576-a797b82b3b3b.png) * It adds a bottom margin to docblocks nested directly in the implementors list, giving it a similar appearance to if it was nested within a toggle. ## Before ![image](https://user-images.githubusercontent.com/1593513/192914503-1c3f39d5-690f-44ec-8f11-385302477d04.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914702-cbce4b3b-5cc6-49dc-b7f8-73be9e76791c.png)
2022-09-29Rollup merge of #102442 - notriddle:notriddle/header-weight, r=GuillaumeGomezMichael Howell-7/+7
rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc This line was added in c494a06064017f307a8d9dc4797e614d2ed99143, because at the time, the headers had these classes on them. Now, the headers are children of the `<section>` with the class on it. This commit also adds a test case, to make sure the srclink font weight does not regress again.
2022-09-29Rollup merge of #102214 - cassaundra:fix-format-args-span, r=cjgillotMichael Howell-0/+64
Fix span of byte-escaped left format args brace Fix #102057 (see issue for example). Previously, the use of escaped left braces (`\x7B`) in format args resulted in an incorrectly offset span. This patch fixes that by considering any escaped characters within the string instead of using a constant offset.
2022-09-29Rollup merge of #102336 - compiler-errors:issue-102333, r=jackh726Dylan DPC-0/+15
Fix associated type bindings with anon const in GAT position The first commit formats `type_of.rs`, which is really hard to maintain since it uses a bunch of features like `let`-chains and `if let` match arm bindings. Best if you just review the second two diffs. Fixes #102333
2022-09-29Stabilize the `instruction_set` featureYuki Okushi-45/+6
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-09-29Auto merge of #102328 - cuviper:ibm-stack-probes, r=nagisabors-30/+71
Enable inline stack probes on PowerPC and SystemZ The LLVM PowerPC and SystemZ targets have both supported `"probe-stack"="inline-asm"` for longer than our current minimum LLVM 13 requirement, so we can turn this on for all `powerpc`, `powerpc64`, `powerpc64le`, and `s390x` targets in Rust. These are all tier-2 or lower, so CI does not run their tests, but I have confirmed that their `linux-gnu` variants do pass on RHEL. cc #43241
2022-09-28rustdoc: add method spacing to trait methodsMichael Howell-6/+6
More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed.