about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
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-22sugg: suggest the usage of boolean value when there is a typo in the keywordVincenzo Palazzo-0/+37
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-50/+51
2022-08-22Auto merge of #99762 - Nilstrieb:unreachable-prop, r=oli-obkbors-155/+265
UnreachableProp: Preserve unreachable branches for multiple targets Before, UnreachablePropagation removed all unreachable branches. This was a pessimization, as it removed information about reachability that was used later in the optimization pipeline. For example, this code ```rust pub enum Two { A, B } pub fn identity(x: Two) -> Two { match x { Two::A => Two::A, Two::B => Two::B, } } ``` basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match. This allows it to be transformed into a simple `x`. If we remove the unreachable branch, the transformation becomes illegal. This was the problem keeping `UnreachablePropagation` from being enabled, so we can enable it now. Something similar already happened in #77800, but it did not show a perf improvement there. Let's try it again anyways! Fixes #68105, although that issue has been fixed for a long time (see #77680).
2022-08-22safe transmute: use `Assume` struct to provide analysis optionsJack Wrenn-687/+1167
This was left as a TODO in #92268, and brings the trait more in line with what was defined in MCP411. `Assume::visibility` has been renamed to `Assume::safety`, as library safety is what's actually being assumed; visibility is just the mechanism by which it is currently checked (this may change). ref: https://github.com/rust-lang/compiler-team/issues/411 ref: https://github.com/rust-lang/rust/issues/99571
2022-08-22Auto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPCbors-38/+184
Rollup of 8 pull requests Successful merges: - #98200 (Expand potential inner `Or` pattern for THIR) - #99770 (Make some const prop mir-opt tests `unit-test`s) - #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase) - #100331 (Guarantee `try_reserve` preserves the contents on error) - #100336 (Fix two const_trait_impl issues) - #100713 (Convert diagnostics in parser/expr to SessionDiagnostic) - #100820 (Use pointer `is_aligned*` methods) - #100872 (Add guarantee that Vec::default() does not alloc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-22Rollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obkDylan DPC-0/+29
Fix two const_trait_impl issues r? ``@oli-obk`` Fixes #100222. Fixes #100543.
2022-08-22Rollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obkDylan DPC-38/+60
Make some const prop mir-opt tests `unit-test`s Most of these have no or only tiny diffs beyond line numbers being changed (would it make sense to not have line numbers in mir-opt tests?). Some things changed a bit, but I think it should all be fine, not sure though.
2022-08-22Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obkDylan DPC-0/+95
Expand potential inner `Or` pattern for THIR Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`. A more ideal solution would be recursively doing this but I haven't found a good way to do that. _fixes #97898_
2022-08-22bless mir-opt testsNilstrieb-384/+384
2022-08-22bless ui testsNilstrieb-9/+9
2022-08-22fix tidyDeadbeef-1/+3
2022-08-22Overhaul 100222 test; wf always remap to nonconstDeadbeef-4/+17
2022-08-22Fix wf check on `#[const_trait]` return typesDeadbeef-0/+14
2022-08-22Auto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPCbors-10/+262
Rollup of 5 pull requests Successful merges: - #93162 (Std module docs improvements) - #99386 (Add tests that check `Vec::retain` predicate execution order.) - #99915 (Recover keywords in trait bounds) - #100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)) - #100757 (Catch overflow early) Failed merges: - #99917 (Move Error trait into core) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-22fluent: update testsXiretza-21/+60
2022-08-22Rollup merge of #100757 - ouz-a:issue-95134, r=jackh726Dylan DPC-7/+39
Catch overflow early Although this code should raise an overflow error, it didn't because [check_recursion_limit](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/select/struct.SelectionContext.html#method.check_recursion_limit) it checks for `depth = 128` but not for `129` which should have triggered the overflow error. Anyways this catches that error early. Fixes #95134
2022-08-22Rollup merge of #99915 - WaffleLapkin:recover_keyword_bounds, r=compiler-errorsDylan DPC-3/+223
Recover keywords in trait bounds (_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_) Recover keywords in trait bound, motivational example: ```rust fn f(_: impl fn()) {} // mistyped, meant `Fn` ``` <details><summary>Current nightly (3 needless and confusing errors!)</summary> <p> ```text error: expected identifier, found keyword `fn` --> ./t.rs:1:15 | 1 | fn _f(_: impl fn()) {} | ^^ expected identifier, found keyword | help: escape `fn` to use it as an identifier | 1 | fn _f(_: impl r#fn()) {} | ++ error: expected one of `:` or `|`, found `)` --> ./t.rs:1:19 | 1 | fn _f(_: impl fn()) {} | ^ expected one of `:` or `|` error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found keyword `fn` --> ./t.rs:1:15 | 1 | fn _f(_: impl fn()) {} | -^^ expected one of 9 possible tokens | | | help: missing `,` error: at least one trait must be specified --> ./t.rs:1:10 | 1 | fn _f(_: impl fn()) {} | ^^^^ ``` </p> </details> This PR: ```text error: expected identifier, found keyword `fn` --> ./t.rs:1:15 | 1 | fn _f(_: impl fn()) {} | ^^ expected identifier, found keyword | help: escape `fn` to use it as an identifier | 1 | fn _f(_: impl r#fn()) {} | ++ error[E0405]: cannot find trait `r#fn` in this scope --> ./t.rs:1:15 | 1 | fn _f(_: impl fn()) {} | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` | ::: /home/waffle/projects/repos/rust/library/core/src/ops/function.rs:74:1 | 74 | pub trait Fn<Args>: FnMut<Args> { | ------------------------------- similarly named trait `Fn` defined here ``` It would be nice to have suggestion in the first error like "have you meant `Fn` trait", instead of a separate error, but the recovery is deep inside ident parsing, which makes it a lot harder to do. r? `@compiler-errors`
2022-08-22Auto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakisbors-44/+95
implied bounds: explicitly state which types are assumed to be wf Adds a new query which maps each definition to the types which that definition assumes to be well formed. The intent is to make it easier to reason about implied bounds. This change should not influence the user-facing behavior of rustc. Notably, `borrowck` still only assumes that the function signature of associated functions is well formed while `wfcheck` assumes that the both the function signature and the impl trait ref is well formed. Not sure if that by itself can trigger UB or whether it's just annoying. As a next step, we can add `WellFormed` predicates to `predicates_of` of these items and can stop adding the wf bounds at each place which uses them. I also intend to move the computation from `assumed_wf_types` to `implied_bounds` into the `param_env` computation. This requires me to take a deeper look at `compare_predicate_entailment` which is currently somewhat weird wrt implied bounds so I am not touching this here. r? `@nikomatsakis`
2022-08-22Simplify create_substs_for_associated_itemMichael Goulet-11/+23
2022-08-22Auto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorinobors-70/+69
Use `AttrVec` more In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently. r? `@spastorino`
2022-08-21fix ICE with extra-const-ub-checksRalf Jung-0/+20
2022-08-21Auto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebankbors-399/+676
Rework "point at arg" suggestions to be more accurate Fixes #100560 Introduce a new set of `ObligationCauseCode`s which have additional bookeeping for what expression caused the obligation, and which predicate caused the obligation. This allows us to look at the _unsubstituted_ signature to find out which parameter or generic type argument caused an obligaton to fail. This means that (in most cases) we significantly improve the likelihood of pointing out the right argument that causes a fulfillment error. Also, since this logic isn't happening in just the `select_where_possible_and_mutate_fulfillment()` calls in the argument checking code, but instead during all trait selection in `FnCtxt`, we are also able to point out the correct argument even if inference means that we don't know whether an obligation has failed until well after a call expression has been checked. r? `@ghost`
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-70/+69
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-08-21bless mir-opt testsNilstrieb-155/+265
2022-08-21Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddleMatthias Krüger-4/+6
rustdoc: Merge source code pages HTML elements together v2 This is the follow-up of https://github.com/rust-lang/rust/pull/100429. I strongly recommend to review it one commit at a time because otherwise it's a lot at once. For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs. | file name | before #100429 | before this PR | with this PR | diff | |-|-|-|-|-| | std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% | | alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% | | alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% | | std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% | So unsurprisingly, the more attributes you have, the bigger the difference. You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html). cc ``````@jsha`````` r? ``````@notriddle``````
2022-08-21Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikicMatthias Krüger-2/+2
update test for LLVM change LLVM commit https://github.com/llvm/llvm-project/commit/c2a38887932e3a46aa3bee35f3f5568ac68282f4 updates the PIC level version selection. Updated an affected rust test to work under both the old and new behaviors. Detected by our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709
2022-08-21Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcmMatthias Krüger-0/+25
Clamp Function for f32 and f64 I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks. If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)
2022-08-21Add test.Camille GILLOT-0/+30
2022-08-21recover `const Tr` bounds (no `~`)Maybe Waffle-11/+6
2022-08-21Suggest moving redundant generic args of an assoc fn to its traitHirochika Matsumoto-0/+101
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-213/+286
2022-08-21Disallow #[primary_span] on LintDiagnosticsXiretza-1/+17
2022-08-21Make derived SessionDiagnostics generic on diagnostic levelXiretza-79/+47
Deriving SessionDiagnostic on a type no longer forces that diagnostic to be one of warning, error, or fatal. The level is instead decided when the struct is passed to the respective Handler::emit_*() method.
2022-08-21Add Handler::struct_diagnostic()Xiretza-1/+1
This unifies the struct_{warn,error,fatal}() methods in one generic method.
2022-08-21Bless tests after #100769Michael Goulet-2/+2
2022-08-21fix `ptr_mask` codegen test wrt llvm opaque pointersMaybe Waffle-1/+1
2022-08-21Make check for overlapping closure span more accurateMichael Goulet-35/+12
2022-08-21Adjust messages, address some nitsMichael Goulet-35/+39
2022-08-21Targeted fixes addressing erroneous suggestionsMichael Goulet-30/+2
2022-08-21Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notesMichael Goulet-4/+0
2022-08-21Point at struct field if possibleMichael Goulet-18/+18
2022-08-21Deduplicate errors that come from places like normalization, sizedMichael Goulet-137/+6
2022-08-21Prefer non-Self non-method types over Self, firstMichael Goulet-40/+46