about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-11-24Bless run-make testsNilstrieb-10/+10
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24Bless rustdoc-ui testsNilstrieb-64/+64
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24Show number in error message even for one errorNilstrieb-5022/+5022
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24rustdoc-search: avoid infinite where clause unboxMichael Howell-0/+44
Fixes #118242
2023-11-24Auto merge of #118248 - compiler-errors:rollup-tye3vgj, r=compiler-errorsbors-68/+210
Rollup of 7 pull requests Successful merges: - #118187 (Recompile LLVM when it changes in the git sources) - #118210 (intercrate ambiguity causes: ignore candidates which don't apply) - #118215 (Add common trait for crate definitions) - #118238 (memcpy assumptions: update GCC link) - #118243 (EvalCtxt::commit_if_ok don't inherit nested goals) - #118245 (Add `Span` to `TraitBoundModifier`) - #118246 (Remove a hack for effects) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-24Rollup merge of #118245 - fee1-dead-contrib:span-tilde-const, r=compiler-errorsMichael Goulet-64/+64
Add `Span` to `TraitBoundModifier` This improves diagnostics for the message "`~const` is not allowed here", and also fixes the span that we use when desugaring `~const Tr` into `Tr<host>` in effects desugaring.
2023-11-24Rollup merge of #118215 - celinval:smir-def-paths, r=ouz-aMichael Goulet-0/+109
Add common trait for crate definitions In stable mir, we specialize DefId, however some functionality is the same for every definition, such as def paths, and getting their crate. Use a trait to implement those.
2023-11-24Rollup merge of #118210 - lcnr:intercrate-ambiguity-causes-uwu, ↵Michael Goulet-4/+37
r=compiler-errors intercrate ambiguity causes: ignore candidates which don't apply r? `@compiler-errors`
2023-11-24Auto merge of #117934 - Young-Flash:dev, r=petrochenkovbors-4/+50
feat: make `let_binding_suggestion` more reasonable This is my first PR for rustc, which trying to fix https://github.com/rust-lang/rust/issues/117894, I am not familiar with some internal api so maybe some modification here isn't the way to go, appreciated for any review suggestion.
2023-11-24Add `Span` to `TraitBoundModifier`Deadbeef-64/+64
2023-11-24Rollup merge of #118224 - dtolnay:rustdocsortunstable, r=fmeaseMatthias Krüger-0/+11
Sort unstable items last in rustdoc, instead of first As far as I can tell, this is a bug introduced inadvertently by https://github.com/rust-lang/rust/pull/77817 in Rust 1.49. Older toolchains used to sort unstable items last. Notice how in the code before that PR, `(Unstable, Stable) => return Ordering::Greater` in src/librustdoc/html/render/mod.rs. Whereas after that PR, `(Unstable, Stable) => return Ordering::Less`. Compare https://doc.rust-lang.org/1.48.0/std/marker/index.html vs https://doc.rust-lang.org/1.49.0/std/marker/index.html.
2023-11-24Auto merge of #118105 - notriddle:master, r=fmeasebors-20/+61
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 4) Follow up * https://github.com/rust-lang/rust/pull/116214 * https://github.com/rust-lang/rust/pull/116432 * https://github.com/rust-lang/rust/pull/116824
2023-11-23Sort unstable items last in rustdoc, instead of firstDavid Tolnay-3/+3
2023-11-23Add test of rustdoc sort order for stable vs unstable itemDavid Tolnay-0/+11
2023-11-23rustdoc: move doctest tests to folderMichael Howell-0/+1
2023-11-23rustdoc: move ICE tests to uiMichael Howell-0/+7
2023-11-23Auto merge of #118192 - Kyuuhachi:issue-118180, r=fmeasebors-0/+9
Don't print "private fields" on empty tuple structs Closes #118180. While working on this I also noticed that empty struct variants are also rendered rather awkwardly. I'll make another issue for that, since I don't know what the correct rendering would be.
2023-11-24add track_caller for arith opsbohan-4/+81
2023-11-23Don't print "private fields" on empty tuple structsKyuuhachi-0/+9
Test for presence rather than absence Remove redundant tests Issues in those parts will likely be caught by other parts of the test suite.
2023-11-23Add an experimental feature gate for function delegationVadim Petrochenkov-0/+16
In accordance with the [process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md). Detailed description of the feature can be found in the RFC repo - https://github.com/rust-lang/rfcs/pull/3530.
2023-11-23fix intercrate ambiguity causeslcnr-4/+37
2023-11-23feat: make let_binding_suggestion more reasonableYoung-Flash-4/+50
2023-11-23Rollup merge of #118146 - compiler-errors:deref-into-dyn-regions, r=lcnrMatthias Krüger-3/+88
Rework supertrait lint once again I accidentally pushed the wrong commits because I totally didn't check I was on the right computer when updating #118026. Sorry, this should address all the nits in #118026. r? lcnr
2023-11-23Rollup merge of #118131 - lukas-code:multi-default, r=wesleywiserMatthias Krüger-38/+103
improve tool-only help for multiple `#[default]` variants When defining an enum with multiple `#[default]` variants, we emit a tool-only suggestion for every `#[default]`ed variant to remove all other `#[default]`s. This PR improves the suggestion to correctly handle the cases where one variant has multiple `#[default]`s and where different `#[default]`s have the same span due to macro expansions. fixes https://github.com/rust-lang/rust/issues/118119
2023-11-23Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Kibors-12/+20
When failing to import `core`, suggest `std`
2023-11-22Rework supertrait lint once againMichael Goulet-3/+88
2023-11-22Provide structured suggestion for type mismatch in loopEsteban Küber-17/+48
We currently provide only a `help` message, this PR introduces the last two structured suggestions instead: ``` error[E0308]: mismatched types --> $DIR/issue-98982.rs:2:5 | LL | fn foo() -> i32 { | --- expected `i32` because of return type LL | / for i in 0..0 { LL | | return i; LL | | } | |_____^ expected `i32`, found `()` | note: the function expects a value to always be returned, but loops might run zero times --> $DIR/issue-98982.rs:2:5 | LL | for i in 0..0 { | ^^^^^^^^^^^^^ this might have zero elements to iterate on LL | return i; | -------- if the loop doesn't execute, this value would never get returned help: return a value for the case when the loop has zero elements to iterate on | LL ~ } LL ~ /* `i32` value */ | help: otherwise consider changing the return type to account for that possibility | LL ~ fn foo() -> Option<i32> { LL | for i in 0..0 { LL ~ return Some(i); LL ~ } LL ~ None | ``` Fix #98982.
2023-11-22When failing to import `core`, suggest `std`Esteban Küber-12/+20
2023-11-22Auto merge of #118178 - compiler-errors:rollup-0i11w85, r=compiler-errorsbors-0/+156
Rollup of 6 pull requests Successful merges: - #118012 (Add support for global allocation in smir) - #118013 (Enable Rust to use the EHCont security feature of Windows) - #118100 (Enable profiler in dist-powerpc64-linux) - #118142 (Tighten up link attributes for llvm-wrapper bindings) - #118147 (Fix some unnecessary casts) - #118161 (Allow defining opaques in `check_coroutine_obligations`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-22Rollup merge of #118161 - compiler-errors:coroutine-obligation-opaques, r=lcnrMichael Goulet-0/+17
Allow defining opaques in `check_coroutine_obligations` In the new trait solver, when an obligation stalls on an unresolved coroutine witness, we will stash away the *root* obligation, even if the stalled obligation is only a distant descendent of the root obligation, since the new solver is purely recursive. This means that we may need to reprocess alias-relate obligations (and others) which may define opaque types in the new solver. Currently, we use the coroutine's def id as the defining anchor in `check_coroutine_obligations`, which will allow defining no opaque types, resulting in errors like: ``` error[E0271]: type mismatch resolving `{coroutine@<source>:6:5: 6:17} <: impl Clone` --> <source>:6:5 | 6 | / move |_: ()| { 7 | | let () = yield (); 8 | | } | |_____^ types differ ``` So this PR fixes the defining anchor and does the same trick as `check_opaque_well_formed`, where we manually compare opaques that were defined against their hidden types to make sure they weren't defined differently when processing these stalled coroutine obligations. r? `@lcnr` cc `@cjgillot`
2023-11-22Rollup merge of #118013 - sivadeilra:user/ardavis/ehcont, r=wesleywiserMichael Goulet-0/+20
Enable Rust to use the EHCont security feature of Windows In the future Windows will enable Control-flow Enforcement Technology (CET aka Shadow Stacks). To protect the path where the context is updated during exception handling, the binary is required to enumerate valid unwind entrypoints in a dedicated section which is validated when the context is being set during exception handling. The required support for EHCONT Guard has already been merged into LLVM, long ago. This change simply adds the Rust codegen option to enable it. Relevant LLVM change: https://reviews.llvm.org/D40223 This also adds a new `ehcont-guard` option to the bootstrap config which enables EHCont Guard when building std. We at Microsoft have been using this feature for a significant period of time; we are confident that the LLVM feature, when enabled, generates well-formed code. We currently enable EHCONT using a codegen feature, but I'm certainly open to refactoring this to be a target feature instead, or to use any appropriate mechanism to enable it.
2023-11-22Rollup merge of #118012 - celinval:smir-alloc, r=ouz-aMichael Goulet-0/+119
Add support for global allocation in smir Add APIs to StableMir to support global allocation. Before this change, StableMir users had no API available to retrieve Allocation provenance information. They had to resource to internal APIs instead. One example is retrieving the Allocation of an `&str`. See test for an example on how the API can be used.
2023-11-22Update existing testsGuillaume Gomez-4/+4
2023-11-22Add regression test for cfg merging on re-exportsGuillaume Gomez-0/+30
2023-11-22Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkinbors-214/+82
Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka https://github.com/rust-lang/rfcs/pull/3324. The FCP was completed here: https://github.com/rust-lang/rust/issues/65991#issuecomment-1817552398. ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by https://github.com/rust-lang/rust/pull/101718 Fixes https://github.com/rust-lang/rust/issues/65991
2023-11-22Add CrateDef trait and methods to get def namesCelina G. Val-0/+109
2023-11-22Auto merge of #112380 - jieyouxu:useless-bindings-lint, r=WaffleLapkinbors-2/+3
Add allow-by-default lint for unit bindings ### Example ```rust #![warn(unit_bindings)] macro_rules! owo { () => { let whats_this = (); } } fn main() { // No warning if user explicitly wrote `()` on either side. let expr = (); let () = expr; let _ = (); let _ = expr; //~ WARN binding has unit type let pat = expr; //~ WARN binding has unit type let _pat = expr; //~ WARN binding has unit type // No warning for let bindings with unit type in macro expansions. owo!(); // No warning if user explicitly annotates the unit type on the binding. let pat: () = expr; } ``` outputs ``` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:17:5 | LL | let _ = expr; | ^^^^-^^^^^^^^ | | | this pattern is inferred to be the unit type `()` | note: the lint level is defined here --> $DIR/unit-bindings.rs:3:9 | LL | #![warn(unit_bindings)] | ^^^^^^^^^^^^^ warning: binding has unit type `()` --> $DIR/unit-bindings.rs:18:5 | LL | let pat = expr; | ^^^^---^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:19:5 | LL | let _pat = expr; | ^^^^----^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: 3 warnings emitted ``` This lint is not triggered if any of the following conditions are met: - The user explicitly annotates the binding with the `()` type. - The binding is from a macro expansion. - The user explicitly wrote `let () = init;` - The user explicitly wrote `let pat = ();`. This is allowed for local lifetimes. ### Known Issue It is known that this lint can trigger on some proc-macro generated code whose span returns false for `Span::from_expansion` because e.g. the proc-macro simply forwards user code spans, and otherwise don't have distinguishing syntax context compared to non-macro-generated code. For those kind of proc-macros, I believe the correct way to fix them is to instead emit identifers with span like `Span::mixed_site().located_at(user_span)`. Closes #71432.
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-214/+82
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22Auto merge of #118086 - nnethercote:queries-cleanups, r=bjorn3bors-4/+3
Queries cleanups r? `@bjorn3`
2023-11-22Auto merge of #118071 - Urgau:check-cfg-cargo-feature, r=petrochenkovbors-16/+76
Remove `feature` from the list of well known check-cfg name This PR removes `feature` from the list of well known check-cfg. This is done for multiple reasons: - Cargo is the source of truth, rustc shouldn't have any knowledge of it - It creates a conflict between Cargo and rustc when there are no features defined. In this case Cargo won't pass any `--check-cfg` for `feature` since no feature will ever be passed, but rustc by having in it's list adds a implicit `cfg(feature, values(any()))` which is completely wrong. Having any cfg `feature` is unexpected not allow any `feature` value. While doing this, I took the opportunity to specialise the diagnostic a bit for the case above. r? `@petrochenkov`
2023-11-22add a testRalf Jung-0/+54
2023-11-22Allow defining opaques in check_coroutine_obligationsMichael Goulet-0/+17
2023-11-21Add allocation test and a bit more documentationCelina G. Val-0/+119
2023-11-22Fully rework the algorithm and its explanationNadrieril-27/+34
2023-11-22Keep rows with guards in the matrixNadrieril-14/+14
2023-11-22Merge `Queries::{ongoing_codegen,linker}`.Nicholas Nethercote-2/+1
There is no real need for them to be separate.
2023-11-22Make `Compiler::{sess,codegen_backend}` public.Nicholas Nethercote-2/+2
And remove the relevant getters on `Compiler` and `Queries`.
2023-11-22Add some testsNadrieril-202/+238
2023-11-22Validate there are no critical call edges in optimized MIRTomasz Miąsko-0/+31
2023-11-21Rollup merge of #118112 - compiler-errors:index-ambiguity-ice, r=aliemjayMatthias Krüger-0/+38
Don't ICE when ambiguity is found when selecting `Index` implementation in typeck Fixes #118111 The problem here is when we're manually "selecting" an impl for `base_ty: Index<?0>`, we don't consider placeholder region errors (leak check) or ambiguous predicates. Those can lead to us not actually emitting any fulfillment errors on line 3131.