about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
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-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-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-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-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-21recover `const Tr` bounds (no `~`)Maybe Waffle-11/+6
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-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
2022-08-21Rework ambiguity errorsMichael Goulet-142/+47
2022-08-21Note closure kind mismatch causeMichael Goulet-8/+78
2022-08-21Revert closure mismatch spansMichael Goulet-133/+85
2022-08-21Do not favor projection type when pointing out arg causing fulfillment errorMichael Goulet-13/+13
2022-08-21Skip mentioning lang itemMichael Goulet-8/+3
2022-08-21Account for relative pathsMichael Goulet-53/+100
2022-08-21Rework point-at-argMichael Goulet-519/+1003
2022-08-20Allow other directives before the `ret`scottmcm-1/+1
2022-08-20Auto merge of #100810 - matthiaskrgr:rollup-xep778s, r=matthiaskrgrbors-26/+351
Rollup of 9 pull requests Successful merges: - #97963 (net listen backlog set to negative on Linux.) - #99935 (Reenable disabled early syntax gates as future-incompatibility lints) - #100129 (add miri-test-libstd support to libstd) - #100500 (Ban references to `Self` in trait object substs for projection predicates too.) - #100636 (Revert "Revert "Allow dynamic linking for iOS/tvOS targets."") - #100718 ([rustdoc] Fix item info display) - #100769 (Suggest adding a reference to a trait assoc item) - #100777 (elaborate how revisions work with FileCheck stuff in src/test/codegen) - #100796 (Refactor: remove unnecessary string searchings) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-20Rollup merge of #100796 - TaKO8Ki:remove-unnecessary-string-searching, ↵Matthias Krüger-12/+18
r=compiler-errors Refactor: remove unnecessary string searchings This patch removes unnecessary string searchings for checking if function arguments have `&` and `&mut`.
2022-08-20Rollup merge of #100777 - pnkfelix:expand-codegen-tests-readme, r=TaKO8KiMatthias Krüger-0/+22
elaborate how revisions work with FileCheck stuff in src/test/codegen elaborate how revisions work with FileCheck stuff in src/test/codegen
2022-08-20Rollup merge of #100769 - ↵Matthias Krüger-0/+55
TaKO8Ki:suggest-adding-reference-to-trait-assoc-item, r=cjgillot Suggest adding a reference to a trait assoc item fixes #100289
2022-08-20Rollup merge of #100718 - GuillaumeGomez:fix-item-info, r=jshaMatthias Krüger-5/+9
[rustdoc] Fix item info display Fixes #100369. The solution I came up with was simply to wrap the "text part" of the `item-info` into another span so that `flex` wouldn't mess with it. Live demo is [here](https://rustdoc.crud.net/imperio/fix-item-info/foo/struct.ItemInfo.html). r? ``@jsha``
2022-08-20Rollup merge of #100500 - cjgillot:verify-self-predicate, r=lcnrMatthias Krüger-1/+31
Ban references to `Self` in trait object substs for projection predicates too. Fixes https://github.com/rust-lang/rust/issues/100484 Fixes https://github.com/rust-lang/rust/issues/100485 r? ````@lcnr````
2022-08-20Rollup merge of #99935 - CAD97:unstable-syntax-lints, r=petrochenkovMatthias Krüger-8/+216
Reenable disabled early syntax gates as future-incompatibility lints - MCP: https://github.com/rust-lang/compiler-team/issues/535 The approach taken by this PR is - Introduce a new lint, `unstable_syntax_pre_expansion`, and reenable the early syntax gates to emit it - Use the diagnostic stashing mechanism to stash warnings the early warnings - When the hard error occurs post expansion, steal and cancel the early warning - Don't display any stashed warnings if errors are present to avoid the same noise problem that hiding type ascription errors is avoiding Commits are working commits, but in a coherent steps-to-implement manner. Can be squashed if desired. The preexisting `soft_unstable` lint seems like it would've been a good fit, but it is deny-by-default (appropriate for `#[bench]`) and these gates should be introduced as warn-by-default. It may be desirable to change the stash mechanism's behavior to not flush lint errors in the presence of other errors either (like is done for warnings here), but upgrading a stash-using lint from warn to error perhaps is enough of a request to see the lint that they shouldn't be hidden; additionally, fixing the last error to get new errors thrown at you always feels bad, so if we know the lint errors are present, we should show them. Using a new flag/mechanism for a "weak diagnostic" which is suppressed by other errors may also be desirable over assuming any stashed warnings are "weak," but this is the first user of stashing warnings and seems an appropriate use of stashing (it follows the "know more later to refine the diagnostic" pattern; here we learn that it's in a compiled position) so we get to define what it means to stash a non-hard-error diagnostic. cc `````@petrochenkov````` (seconded MCP)
2022-08-20Rollup merge of #100693 - scottmcm:new-llvm15-nops, r=Mark-SimulacrumMatthias Krüger-0/+54
Add LLVM15-specific codegen test for `try`/`?`s that now optimize away These still generated a bunch of code back in Rust 1.63 (<https://rust.godbolt.org/z/z31P8h6rz>), but with LLVM 15 merged they no longer do 🎉
2022-08-20Rollup merge of #100691 - compiler-errors:issue-100690, r=estebankMatthias Krüger-0/+67
Make `same_type_modulo_infer` a proper `TypeRelation` Specifically, this fixes #100690 because we no longer consider a `ReLateBound` and a `ReVar` to be equal. `ReVar` can only be equal to free regions or static.
2022-08-20Rollup merge of #100596 - TaKO8Ki:remove-unnecessary-stderr-files, ↵Matthias Krüger-23/+0
r=Mark-Simulacrum Remove unnecessary stderr files This patch removes stderr files corresponding to revisions that have already been removed.