about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-10-14Auto merge of #102783 - RalfJung:tls, r=thomccbors-2/+2
sync thread_local key conditions exactly with what the macro uses This makes the `cfg` in `mod.rs` syntactically the same as those in `local.rs`. I don't think this should actually change anything, but seems better to be consistent? I looked into this due to https://github.com/rust-lang/rust/issues/102549, but this PR would make it *less* likely that `__OsLocalKeyInner` is going to get provided, so this cannot help with that issue. r? `@thomcc`
2022-10-14Rollup merge of #103031 - est31:match_guard_irrefutable_let, r=oli-obkDylan DPC-14/+23
Suppress irrefutable let patterns lint for prefixes in match guards In match guards, irrefutable prefixes might use the bindings created by the match pattern. Ideally, we check for this, but we can do the next best thing and just not lint for irrefutable prefixes in match guards. Fixes #98361
2022-10-14Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8KiDylan DPC-7/+5
More dupe word typos I only picked those changes (from the regex search) that I am pretty certain doesn't change meaning and is just a typo fix. Do correct me if any fix is undesirable and I can revert those. Thanks.
2022-10-14Rollup merge of #102938 - c410-f3r:here-we-go-again, r=petrochenkovDylan DPC-28/+0
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-14Rollup merge of #102914 - ↵Dylan DPC-1/+73
GuillaumeGomez:migrate-css-highlight-without-change, r=notriddle Migrate css highlight without change This is a "previous" version of https://github.com/rust-lang/rust/pull/102663: only migrating to CSS variables, no changes. It's a bit more verbose because rules are not coherent between themes. r? ``@notriddle``
2022-10-14Rollup merge of #102856 - cjgillot:impl-single-check, r=petrochenkovDylan DPC-29/+30
Only test duplicate inherent impl items in a single place Based on https://github.com/rust-lang/rust/pull/100387 r? ``@petrochenkov``
2022-10-14wasm-ignore some tests that access thread-local private detailsRalf Jung-2/+2
2022-10-14Add testMichael Goulet-0/+42
2022-10-14more dupe word typosRageking8-7/+5
2022-10-14Auto merge of #103026 - matthiaskrgr:rollup-gfmlfkt, r=matthiaskrgrbors-55/+329
Rollup of 7 pull requests Successful merges: - #103000 (Add suggestion to the "missing native library" error) - #103006 (rustdoc: don't ICE on `TyKind::Typeof`) - #103008 (replace ReErased with fresh region vars in opaque types) - #103011 (Improve rustdoc `unsafe-fn` GUI test) - #103013 (Add new bootstrap entrypoints to triagebot) - #103016 (Ensure enum cast moves) - #103021 (Add links to relevant pages to find constraint information) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-14Suppress irrefutable let patterns lint for prefixes in match guardsest31-14/+23
In match guards, irrefutable prefixes might use the bindings created by the match pattern. Ideally, we check for this, but we can do the next best thing and just not lint for irrefutable prefixes in match guards.
2022-10-14Rollup merge of #103016 - nbdd0121:enum, r=pnkfelixMatthias Krüger-24/+65
Ensure enum cast moves Fix #102389 r? ``@pnkfelix``
2022-10-14Rollup merge of #103011 - GuillaumeGomez:improve-unsafe-fn-gui-test, r=notriddleMatthias Krüger-31/+22
Improve rustdoc `unsafe-fn` GUI test r? ``@notriddle``
2022-10-14Rollup merge of #103008 - aliemjay:opaque-parent-substs, r=oli-obkMatthias Krüger-0/+194
replace ReErased with fresh region vars in opaque types See inline comments. Prior art #102943. cc ``@compiler-errors`` ``@oli-obk`` Fixes #100267 Fixes #101940 Fixes #102649 Fixes #102510
2022-10-14Rollup merge of #103006 - WaffleLapkin:rustdoc_dont, r=compiler-errorsMatthias Krüger-0/+18
rustdoc: don't ICE on `TyKind::Typeof` Fixes #102986 I'm not sure why rustdoc started seeing `TyKind::Typeof` all of a sudden (the code being editted was last touched 3 months ago), probably something to do with error recovery? idk.
2022-10-14Rollup merge of #103000 - wesleywiser:suggest_libname, r=compiler-errorsMatthias Krüger-0/+30
Add suggestion to the "missing native library" error If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like `foo.lib` or `libfoo.a` when we expect them to simply provide `foo`. In this situation, we now detect that case and suggest the user only provide the library name itself.
2022-10-13Auto merge of #102700 - oli-obk:0xDEAD_TAIT, r=compiler-errorsbors-7/+54
Check hidden types in dead code fixes #99490 r? `@compiler-errors` best reviewed commit by commit
2022-10-13Report duplicate definition in impls with overlap check.Camille GILLOT-29/+30
2022-10-13Fix testGary Guo-1/+1
2022-10-13Bless testsGary Guo-23/+47
2022-10-13Add test for issue 102389Gary Guo-0/+17
2022-10-13replace ReErased with fresh region vars in opaque typesAli MJ Al-Nasrawy-0/+194
2022-10-13Move some tests to more reasonable directoriesCaio-28/+0
2022-10-13Add test for issue 102986Maybe Waffle-0/+18
2022-10-13Improve code for unsafe-fn rustdoc GUI testGuillaume Gomez-31/+22
2022-10-13Rollup merge of #102999 - compiler-errors:issue-102985, r=fee1-deadDylan DPC-0/+37
Delay `is_intrinsic` query until after we've determined the callee is a function Fixes #102985
2022-10-13Rollup merge of #102956 - TaKO8Ki:fix-102946, r=fee1-deadDylan DPC-0/+33
Use `full_res` instead of `expect_full_res` Fixes #102946 Fixes #102978
2022-10-13Rollup merge of #102947 - compiler-errors:sort-elaborated-existentials, ↵Dylan DPC-0/+25
r=cjgillot Sort elaborated existential predicates in `object_ty_for_trait` r? `@cjgillot` I think that #102845 caused #102933. Depending on the order that we elaborate these existential projection predicates, there's no guarantee that they'll be sorted by def id, which is what is failing the assertion in the issue. Fixes #102933 Fixes #102973
2022-10-13Rollup merge of #102765 - TaKO8Ki:follow-up-to-102708, r=compiler-errorsDylan DPC-1/+24
Suggest `==` to the first expr which has `ExprKind::Assign` kind follow-up to #102708 [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4241dc33ed8af02e1ef530d6b14903fd)
2022-10-13Add suggestion to the "missing native library" errorWesley Wiser-0/+30
If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like `foo.lib` or `libfoo.a` when we expect them to simply provide `foo`. In this situation, we now detect that case and suggest the user only provide the library name itself.
2022-10-13Delay intrinsic call until after we've determined the callee is a functionMichael Goulet-0/+37
2022-10-13Sort elaborated existential predicates in object_ty_for_traitMichael Goulet-0/+25
2022-10-13Rollup merge of #102974 - Rageking8:fix-small-word-dupe-typos, r=JohnTitorYuki Okushi-16/+16
Fix small word dupe typos
2022-10-13Rollup merge of #102967 - Rageking8:add-test-for-issue-102964, r=TaKO8KiYuki Okushi-0/+29
Add test for issue 102964 Fixes #102964
2022-10-13Rollup merge of #102641 - eholk:dyn-star-box, r=compiler-errorsYuki Okushi-0/+17
Support casting boxes to dyn* Boxes have a pointer type at codegen time which LLVM does not allow to be transparently converted to an integer. Work around this by inserting a `ptrtoint` instruction if the argument is a pointer. r? ``@compiler-errors`` Fixes #102427
2022-10-12Auto merge of #101679 - compiler-errors:rpitit-default-body, r=nikomatsakisbors-95/+68
Support default-body trait functions with return-position `impl Trait` in traits Introduce a new `Trait` candidate kind for the `ImplTraitInTrait` projection candidate, which just projects an RPITIT down to its opaque type form. This is a hack until we lower RPITITs to regular associated types, after which we will need to rework how these default bodies are type-checked, so comments are left in a few places for us to clean up later. Fixes #101665
2022-10-13fix small word dupe typosRageking8-16/+16
2022-10-12Rollup merge of #102927 - compiler-errors:let, r=davidtwcoDylan DPC-6/+70
Fix `let` keyword removal suggestion in structs (1.) Fixes a bug where, given this code: ```rust struct Foo { let x: i32, } ``` We were parsing the field name as `let` instead of `x`, which causes issues later on in the type-checking phase. (2.) Also, suggestions for `let: i32` as a field regressed, displaying this extra `help:` which is removed by this PR ``` help: remove the let, the `let` keyword is not allowed in struct field definitions | 2 - let: i32, 2 + : i32, ``` (3.) Makes the suggestion text a bit more succinct, since we don't need to re-explain that `let` is not allowed in this position (since it's in a note that follows). This causes the suggestion to render inline as well. cc `@gimbles,` this addresses a few nits I mentioned in your PR.
2022-10-12Rollup merge of #102719 - Nilstrieb:tidy-alphabetical, r=jackh726Dylan DPC-22/+22
Enforce alphabetical sorting with tidy We have many places where things are supposed to be sorted alphabetically. For the smaller and more recent size assertions, this is mostly upheld, but in other more... alive places it's very messy. This introduces a new tidy directive to check that a section of code is sorted alphabetically and fixes all places where sorting has gone wrong.
2022-10-12Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errorsDylan DPC-8/+125
translation: eager translation Part of #100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context. - **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. - **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. - **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation. - **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`. - **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic. - **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move. This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg` anyway. However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as: let diag = { /* create diagnostic */ }; diag.span_suggestion_with_style( span, fluent::crate::slug, format!("{}", __binding_0), Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.emit(); For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first. Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition. By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added. let diag = { /* create diagnostic */ }; let __code_0 = format!("{}", __binding_0); /* + other formatting */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.span_suggestion_with_style( span, fluent::crate::slug, __code_0, Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.emit(); - **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem. r? ```@compiler-errors```
2022-10-12Add broken test for AFIT with RPITITMichael Goulet-0/+33
2022-10-12add test for issue 102964Rageking8-0/+29
2022-10-12Use `tidy-alphabetical` in the compilerNilstrieb-22/+22
2022-10-12Auto merge of #102460 - flba-eb:fix_85261_prevent_alloc_after_fork, r=thomccbors-1/+42
Prevent UB in child process after calling libc::fork After calling libc::fork, the child process tried to access a TLS variable when processing a panic. This caused a memory allocation which is UB in the child. To prevent this from happening, the panic handler will not access the TLS variable in case `panic::always_abort` was called before. Fixes #85261 (not only on Android systems, but also on Linux/QNX with TLS disabled, see issue for more details) Main drawbacks of this fix: * Panic messages can incorrectly omit `core::panic::PanicInfo` struct in case several panics (of multiple threads) occur at the same time. The handler cannot distinguish between multiple panics in different threads or recursive ones in the same thread, but the message will contain a hint about the uncertainty. * `panic_count::increase()` will be a bit slower as it has an additional `if`, but this should be irrelevant as it is only called in case of a panic.
2022-10-12fix #102946Takayuki Maeda-0/+33
2022-10-12Rollup merge of #102924 - notriddle:notriddle/sidebar-link-class, ↵Dylan DPC-64/+64
r=GuillaumeGomez rustdoc: remove unused classes from sidebar links Since https://github.com/rust-lang/rust/commit/98f05a0282625a5fda6e90ebf3b05a4bd7608f65 removed separate colors from the currently-selected item, there's no need to have item classes on sidebar links. Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-link-class/std/vec/struct.Vec.html While cleaning up the CSS to remove unneeded `.content` selectors, this PR changes the `h1.fqn a` CSS selector to just be `h1 a`, so that the header link color selector is less specific than the typed link at the end. Since https://github.com/rust-lang/rust/pull/89506 made docblocks start at `h2`, the main page link header should be the only h1 in the page now.
2022-10-12Rollup merge of #102890 - camsteffen:adt-sized-representability, r=cjgillotDylan DPC-57/+36
Check representability in adt_sized_constraint Now that representability is a query, we can use it to preemptively avoid a cycle in `adt_sized_constraint`. I moved the representability check into `check_mod_type_wf` to avoid a scenario where rustc quits before checking all the types for representability. This also removes the check from rustdoc, which is alright AFAIK. r? ``@cjgillot``
2022-10-12Rollup merge of #102187 - b-naber:inline-const-source-info, r=eholkDylan DPC-0/+67
Use correct location for type tests in promoted constants Previously we forgot to remap the location in a type test collected when visiting the body of a promoted constant back to the usage location, causing an ICE when trying to get span information for that type test. Fixes https://github.com/rust-lang/rust/issues/102117
2022-10-12Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwcoDylan DPC-2/+2
Migrate rustc_passes diagnostics Picks up abandoned work from https://github.com/rust-lang/rust/pull/100870 I would like to do this collaboratively, as there is a lot of work! Here's the process: - Comment below that you are willing to help and I will add you as a collaborator to my `rust` fork (that gives you write access) - Indicate which file/task you would like to work on (so we don't duplicate work) from the list below - Do the work, push up a commit, comment that you're done with that file/task - Repeat until done 😄 ### Files to Migrate (in `compiler/rustc_passes/src/`) - [x] check_attr.rs ``@CleanCut`` - [x] check_const.rs ``@CleanCut`` - [x] dead.rs ``@CleanCut`` - [x] debugger_visualizer.rs ``@CleanCut`` - [x] diagnostic_items.rs ``@CleanCut`` - [x] entry.rs ``@CleanCut`` - [x] lang_items.rs ``@CleanCut`` - [x] layout_test.rs ``@CleanCut`` - [x] lib_features.rs ``@CleanCut`` - [x] ~liveness.rs~ ``@CleanCut`` Nothing to do - [x] loops.rs ``@CleanCut`` - [x] naked_functions.rs ``@CleanCut`` - [x] stability.rs ``@CleanCut`` - [x] weak_lang_items.rs ``@CleanCut`` ### Tasks - [x] Rebase on current `master` ``@CleanCut`` - [x] Review work from [the earlier PR](https://github.com/rust-lang/rust/pull/100870) and make sure it all looks good - [x] compiler/rustc_error_messages/locales/en-US/passes.ftl ``@CleanCut`` - [x] compiler/rustc_passes/src/check_attr.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/errors.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/lang_items.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/lib.rs ``@CleanCut`` - [x] compiler/rustc_passes/src/weak_lang_items.rs ``@CleanCut``
2022-10-11Fix let removal suggestion in structMichael Goulet-6/+70