about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-08-26Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJungbors-429/+282
interpret: remove support for uninitialized scalars With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely. I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided. Fixes https://github.com/rust-lang/miri/issues/2187 r? `@oli-obk`
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-429/+282
initialized Scalar
2022-08-26Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiserbors-24/+30
session: stabilize split debuginfo on linux Stabilize the `-Csplit-debuginfo` flag... - ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance. - ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-26Auto merge of #101037 - GuillaumeGomez:rollup-opn6kj1, r=GuillaumeGomezbors-17/+173
Rollup of 8 pull requests Successful merges: - #95005 (BTree: evaluate static type-related check at compile time) - #99742 (Add comments about stdout locking) - #100128 (Document that `RawWakerVTable` functions must be thread-safe.) - #100956 (Reduce right-side DOM size) - #101006 (Fix doc cfg on reexports) - #101012 (rustdoc: remove unused CSS for `.variants_table`) - #101023 (rustdoc: remove `type="text/css"` from stylesheet links) - #101031 (Remove unused build dependency) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-26Rollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddleGuillaume Gomez-0/+33
Fix doc cfg on reexports Fixes #83428. The problem was that the newly inlined item cfg propagation was not working since its real parent is different than its current one. For the implementation, I decided to put it directly into `CfgPropagation` instead of inside `inline.rs` because I thought it would be simpler to maintain and to not forget if new kind of items are added if it's all done in one place. r? `@notriddle`
2022-08-26Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddleGuillaume Gomez-17/+140
Reduce right-side DOM size This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time. So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node. On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results: | file name | before this PR | with this PR | diff | |-|-|-|-| | std/default/trait.Default.html | 2189 | 1331 | 39.2% | | std/vec/struct.Vec.html | 14073 | 13842 | 1.7% | | std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% | | std/ops/trait.Index.html | 642 | 630 | 1.9% | | gtk4/WidgetExt | 3269 | 3061 | 6.4% | You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html). r? `@notriddle`
2022-08-26Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillotbors-9/+12
Shrink `thir::Expr` r? `@cjgillot`
2022-08-26Auto merge of #100705 - compiler-errors:issue-100620, r=oli-obkbors-0/+19
Avoid reporting overflow in `is_impossible_method` Fixes #100620 We're evaluating a new predicate in a different param-env than it was checked during typeck, so be more careful about handling overflow errors. Instead of using `FulfillmentCtxt`, using `InferCtxt::evaluate_obligation` by itself will give us back the overflow error, so we can throw it away properly. This may give us more false-positives, but it doesn't regress the `<HashMap as Iterator>::rev` example that originally motivated adding `is_impossible_method` in the first place.
2022-08-26Rollup merge of #100978 - nnethercote:fix-100948, r=petrochenkovYuki Okushi-0/+29
Handle `Err` in `ast::LitKind::to_token_lit`. Fixes #100948. r? ``@petrochenkov``
2022-08-26Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebankYuki Okushi-14/+14
distinguish the method and associated function diagnostic information Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter ``` modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr ```
2022-08-25Add test for missing cfg propagation for reexportGuillaume Gomez-0/+33
2022-08-25Auto merge of #100571 - cjgillot:mir-cost-visit, r=compiler-errorsbors-0/+30
Check projection types before inlining MIR Fixes https://github.com/rust-lang/rust/issues/100550 I'm very unhappy with this solution, having to duplicate MIR validation code, but at least it removes the ICE. r? `@compiler-errors`
2022-08-25Auto merge of #100977 - JohnTitor:rollup-8hc7rxh, r=JohnTitorbors-75/+110
Rollup of 8 pull requests Successful merges: - #99332 (Stabilize `#![feature(label_break_value)]`) - #99954 (let-else: break out to one scope higher for let-else) - #100188 (Parser will not suggest invalid expression when use public) - #100780 (save_analysis: Migrate diagnostic) - #100808 (Migrate `rustc_interface` diagnostics ) - #100921 (Add a warning about `Option/Result::and()` being eagerly evaluated) - #100960 (rustdoc: ayu code color selector more specific) - #100964 (Sync rustc_codegen_cranelift) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-25Handle `Err` in `ast::LitKind::to_token_lit`.Nicholas Nethercote-0/+29
Fixes #100948.
2022-08-24Auto merge of #99946 - tmiasko:elide-storage-makers, r=oli-obkbors-149/+34
Elide superfluous storage markers Follow the existing strategy of omitting the storage markers for temporaries introduced for internal usage when elaborating derefs and deref projections. Those temporaries are simple scalars which are used immediately after being defined and never have their address taken. There is no benefit from storage markers from either liveness analysis or code generation perspective.
2022-08-25Rollup merge of #100188 - chenyukang:fix-issue-100165, r=estebankYuki Okushi-0/+50
Parser will not suggest invalid expression when use public Fixes #100165
2022-08-25Rollup merge of #99954 - dingxiangfei2009:break-out-let-else-higher-up, ↵Yuki Okushi-0/+11
r=oli-obk let-else: break out to one scope higher for let-else ```@est31``` This PR follows up with #99518 which is to break out to the last remainder scope. It breaks to the out-most `region_scope` of the block if the first statement is a `let-else`.
2022-08-25Rollup merge of #99332 - jyn514:stabilize-label-break-value, r=petrochenkovYuki Okushi-75/+49
Stabilize `#![feature(label_break_value)]` See the stabilization report in https://github.com/rust-lang/rust/issues/48594#issuecomment-1186213313.
2022-08-24Add color test for anchors in all themesGuillaume Gomez-1/+100
2022-08-24Extend GUI test to check colors for all srclink elementsGuillaume Gomez-7/+31
2022-08-24Update rustdoc tests for simplified rightside DOMGuillaume Gomez-9/+9
2022-08-24Rollup merge of #100945 - ↵Matthias Krüger-2/+25
TaKO8Ki:add-missing-test-case-for-impl-generic-mismatch, r=Dylan-DPC Add a missing test case for impl generic mismatch This suggestion use different span depending on whether the method has generics or not, so I added a test case about the method with some generics.
2022-08-24Rollup merge of #100940 - ↵Matthias Krüger-0/+26
TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead Do not suggest adding a bound to a opaque type fixes #100442
2022-08-24Rollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obkMatthias Krüger-55/+55
Use par_body_owners for liveness I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here. Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.
2022-08-24Rollup merge of #100912 - tmiasko:make-include, r=TaKO8KiMatthias Krüger-273/+273
Diagnose missing includes in run-make tests
2022-08-24Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwcoMatthias Krüger-0/+40
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing The error can be quite confusing to newcomers. Fixes #100873. I'm not so sure about the message, open to wording suggestions.
2022-08-24Rollup merge of #100888 - ↵Matthias Krüger-14/+3
spastorino:coherence-negative-impls-implied-bounds, r=lcnr Coherence negative impls implied bounds Fixes #93875 This PR is rebased on top of #100789 and it would need to include that one which is already r+ed. r? ``@nikomatsakis`` cc ``@lcnr`` (which I've talked about https://github.com/rust-lang/rust/commit/3222f420d9d2312efe0735eb48160c7b070adc54, I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).
2022-08-24Rollup merge of #100826 - ↵Matthias Krüger-0/+31
vincenzopalazzo:macros/wrong_sugg_with_positional_arg, r=TaKO8Ki sugg: take into count the debug formatting Closes https://github.com/rust-lang/rust/issues/100648 This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way ``@rustbot`` r? ``@compiler-errors`` N.B: I did not find a full way to test the change, any idea?
2022-08-25use a minimized exampleTakayuki Maeda-31/+14
2022-08-24add a missing test case for impl generic mismatchTakayuki Maeda-2/+25
2022-08-24Store blocks in `Thir`.Nicholas Nethercote-9/+12
Like expressions, statements, and match arms. This shrinks `thir::Stmt` and is a precursor to further shrinking `thir::Expr`.
2022-08-24do not suggest adding a bound to a opaque typeTakayuki Maeda-0/+43
2022-08-23Stabilize `#![feature(label_break_value)]`Joshua Nelson-75/+49
# Stabilization proposal The feature was implemented in https://github.com/rust-lang/rust/pull/50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now). There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`. There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed). 1. nrc's original comment about cost-benefit analysis: https://github.com/rust-lang/rust/issues/48594#issuecomment-422235234 2. joshtriplett's comments about seeing use cases: https://github.com/rust-lang/rust/issues/48594#issuecomment-422281176 3. withoutboats's comments that Rust does not need more control flow constructs: https://github.com/rust-lang/rust/issues/48594#issuecomment-450050630 Many different examples of code that's simpler using this feature have been provided: - A lexer by rpjohnst which must repeat code without label-break-value: https://github.com/rust-lang/rust/issues/48594#issuecomment-422502014 - A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: https://github.com/rust-lang/rust/issues/48594#issuecomment-427628251. This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize). - Several examples by JohnBSmith: https://github.com/rust-lang/rust/issues/48594#issuecomment-434651395 - Several examples by Centril: https://github.com/rust-lang/rust/issues/48594#issuecomment-440154733 - An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: https://github.com/rust-lang/rust/issues/48594#issuecomment-443557569 - Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: https://github.com/rust-lang/rust/issues/48594#issuecomment-1184213006 Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: https://github.com/rust-lang/rust/issues/48594#issuecomment-450246249 nrc later resolved their concern, mostly because of the aforementioned macro problems. joshtriplett suggested that macros could be able to generate IR directly (https://github.com/rust-lang/rust/issues/48594#issuecomment-451685983) but there are no open RFCs, and the design space seems rather speculative. joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: https://github.com/rust-lang/rust/issues/48594#issuecomment-632960804 withoutboats has regrettably left the language team. joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: https://github.com/rust-lang/rust/issues/48594#issuecomment-1111269353 [issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+ ## Report + Feature gate: - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/src/test/ui/feature-gates/feature-gate-label_break_value.rs + Diagnostics: - https://github.com/rust-lang/rust/blob/6b2d3d5f3cd1e553d87b5496632132565b6779d3/compiler/rustc_parse/src/parser/diagnostics.rs#L2629 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L749 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L1001 - https://github.com/rust-lang/rust/blob/111df9e6eda1d752233482c1309d00d20a4bbf98/compiler/rustc_passes/src/loops.rs#L254 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L2079 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L1569 + Tests: - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs ## Interactions with other features Labels follow the hygiene of local variables. label-break-value is permitted within `try` blocks: ```rust let _: Result<(), ()> = try { 'foo: { Err(())?; break 'foo; } }; ``` label-break-value is disallowed within closures, generators, and async blocks: ```rust 'a: { || break 'a //~^ ERROR use of unreachable label `'a` //~| ERROR `break` inside of a closure } ``` label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]: ```rust fn labeled_match() { match false 'b: { //~ ERROR block label not supported here _ => {} } } macro_rules! m { ($b:block) => { 'lab: $b; //~ ERROR cannot use a `block` macro fragment here unsafe $b; //~ ERROR cannot use a `block` macro fragment here |x: u8| -> () $b; //~ ERROR cannot use a `block` macro fragment here } } fn foo() { m!({}); } ``` [_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html [_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
2022-08-23Auto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwcobors-21/+60
fluent: mandate slug names to be prefixed by crate name This is currently only convention, but not actively checked for. Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it. This will conflict with #100671, so I'll leave it as draft until that's merged.
2022-08-23sugg: take into count the debug formattingVincenzo Palazzo-0/+31
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-23Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexingChayim Refael Friedman-0/+40
The error can be quite confusing to newcomers.
2022-08-23Rollup merge of #100309 - compiler-errors:issue-100300, r=sanxiynDylan DPC-11/+60
Extend comma suggestion to cases where fields arent missing Fixes #100300
2022-08-23Rollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-deadDylan DPC-50/+51
Do not re-parse function signatures to suggest generics This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters. This allows to avoid re-parsing a function's source code. Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs. All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.
2022-08-23Permit negative impls coherence to take advantage of implied boundsSantiago Pastorino-14/+3
2022-08-23Use par_body_owners for livenessSeo Sanghyeon-55/+55
2022-08-23parser will not give wrong help message for 'public'yukang-0/+50
2022-08-23Diagnose missing includes in run-make testsTomasz Miąsko-273/+273
2022-08-23Auto merge of #100904 - matthiaskrgr:rollup-z3yzivj, r=matthiaskrgrbors-3/+268
Rollup of 9 pull requests Successful merges: - #100382 (Make the GATS self outlives error take into GATs in the inputs) - #100565 (Suggest adding a missing semicolon before an item) - #100641 (Add the armv4t-none-eabi target to the supported_targets) - #100789 (Use separate infcx to solve obligations during negative coherence) - #100832 (Some small bootstrap cleanup) - #100861 (fix ICE with extra-const-ub-checks) - #100862 (tidy: remove crossbeam-utils) - #100887 (Refactor part of codegen_call_terminator) - #100893 (Remove out-of-context comment in `mem::MaybeUninit` documentation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-23Rollup merge of #100861 - RalfJung:const-ice, r=oli-obkMatthias Krüger-0/+20
fix ICE with extra-const-ub-checks Fixes https://github.com/rust-lang/rust/issues/100771
2022-08-23Rollup merge of #100789 - compiler-errors:issue-99662, r=spastorinoMatthias Krüger-2/+18
Use separate infcx to solve obligations during negative coherence I feel like I fixed this already but I may have fixed it then forgot to push the branch... Also fixes up some redundant param-envs being passed around (since they're already passed around in the `Obligation`) Fixes #99662 r? ``@spastorino``
2022-08-23Rollup merge of #100565 - ↵Matthias Krüger-0/+205
TaKO8Ki:suggest-adding-missing-semicolon-before-item, r=compiler-errors Suggest adding a missing semicolon before an item fixes #100533
2022-08-23Rollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errorsMatthias Krüger-1/+25
Make the GATS self outlives error take into GATs in the inputs Before, the reasoning was that outlives should factor in to the outlives error, because that value is produced and inputs aren't. However, this is potentially confusing, and we can just require this for now and relax it later if we need. GATs in where clauses still don't count for the self outlives error, and I've added a test for that. This now errors: ```rust trait Input { type Item<'a>; //~^ missing required fn takes_item<'a>(&'a self, item: Self::Item<'a>); } ``` I've also added a test that this does not: ```rust trait WhereClause { type Item<'a>; fn takes_item<'a>(&'a self) where Self::Item<'a>: ; } ``` r? ``@compiler-errors``
2022-08-23Auto merge of #100678 - GuillaumeGomez:improve-rustdoc-json-tests, ↵bors-567/+552
r=aDotInTheVoid Improve rustdoc json tests Fixes #100588. r? `@aDotInTheVoid`
2022-08-23./x.py test --blessTomasz Miąsko-149/+34
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-50/+51