about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-10-25Rollup merge of #117152 - compiler-errors:no-ret-coercion, r=chenyukangMatthias Krüger-0/+47
Fix unwrap suggestion for async fn Use `body_fn_sig` to get the expected return type of the function instead of `ret_coercion` in `FnCtxt`. This avoids accessing the `ret_coercion` when it's already mutably borrowed (e.g. when checking `return` expressions). Fixes #117144 r? `@chenyukang`
2023-10-25Rollup merge of #117141 - tmiasko:inline-target-features, r=oli-obkMatthias Krüger-226/+42
Require target features to match exactly during inlining In general it is not correct to inline a callee with a target features that are subset of the callee. Require target features to match exactly during inlining. The exact match could be potentially relaxed, but this would require identifying specific feature that are allowed to differ, those that need to match, and those that can be present in caller but not in callee. This resolves MIR part of #116573. For other concerns with respect to the previous implementation also see areInlineCompatible in LLVM.
2023-10-25Rollup merge of #117111 - Zalathar:zinstrument, r=compiler-errorsMatthias Krüger-6/+8
Remove support for alias `-Z instrument-coverage` This flag was stabilized in rustc 1.60.0 (2022-04-07) as `-C instrument-coverage`, but the old unstable flag was kept around (with a warning) as an alias to ease migration. It should now be reasonable to remove the somewhat tricky code that implemented that alias. Fixes #116980.
2023-10-25Auto merge of #117113 - celinval:smir-stable-ty, r=oli-obkbors-34/+12
Remove fold code and add `Const::internal()` to StableMIR We are not planning to support user generated constant in the foreseeable future, so we are cleaning up the fold logic and user created type for now. Users should use `Instance::resolve` in order to trigger monomorphization. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the `Const` fields private in case we decide to translate them lazily.
2023-10-25Auto merge of #117076 - oli-obk:privacy_visitor_types, r=petrochenkovbors-17/+17
Refactor type visitor walking r? `@petrochenkov` pulling out the uncontroversial parts of https://github.com/rust-lang/rust/pull/113671
2023-10-25Fix unwrap suggestion for async fnMichael Goulet-0/+47
2023-10-25coverage: UI test for unstable value `-C instrument-coverage=branch`Zalathar-6/+8
2023-10-25Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naberbors-23/+135
Fix inline const pattern unsafety checking in THIR Fix THIR unsafety checking of inline constants. - Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering. - Represent inline constants in THIR patterns.
2023-10-24Remove fold code and add Const::internal()Celina G. Val-34/+12
We are not planning to support user generated constant in the foreseeable future, so we are removing the Fold logic for now in favor of the Instance::resolve logic. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the Const fields private in case we decide to translate them lazily.
2023-10-24Auto merge of #115796 - cjgillot:const-prop-rvalue, r=oli-obkbors-140/+613
Generate aggregate constants in DataflowConstProp.
2023-10-24Require target features to match exactly during inliningTomasz Miąsko-1/+1
In general it is not correct to inline a callee with a target features that are subset of the callee. Require target features to match exactly during inlining. The exact match could be potentially relaxed, but this would require identifying specific feature that are allowed to differ, those that need to match, and those that can be present in caller but not in callee. This resolves MIR part of #116573. For other concerns with respect to the previous implementation also see areInlineCompatible in LLVM.
2023-10-24Precommit target features compatibility testTomasz Miąsko-0/+8
2023-10-24Migrate inline_compatibility.rs test to FileCheckTomasz Miąsko-226/+34
2023-10-24Auto merge of #117135 - matthiaskrgr:rollup-zdh18i6, r=matthiaskrgrbors-94/+363
Rollup of 8 pull requests Successful merges: - #116094 (Introduce `-C instrument-coverage=branch` to gate branch coverage) - #116396 (Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`) - #116714 (Derive `Ord`, `PartialOrd` and `Hash` for `SocketAddr*`) - #116792 (Avoid unnecessary renumbering during borrowck) - #116841 (Suggest unwrap/expect for let binding type mismatch) - #116943 (Add target features for LoongArch) - #117010 (Add method to convert internal to stable constructs) - #117127 (Remove `#[allow(incomplete_features)]` from RPITIT/AFIT tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-24Rollup merge of #117127 - compiler-errors:incomplete, r=lqdMatthias Krüger-74/+29
Remove `#[allow(incomplete_features)]` from RPITIT/AFIT tests They've been unnecessary for a while.
2023-10-24Rollup merge of #117010 - celinval:smir-internal, r=oli-obkMatthias Krüger-15/+82
Add method to convert internal to stable constructs This is an alternative implementation to https://github.com/rust-lang/rust/pull/116999. I believe we can still improve the logic a bit here, but I wanted to see which direction we should go first. In this implementation, the API is simpler and we keep Tables somewhat private. The definition is still public though, since we have to expose the Stable trait. However, there's a cost of keeping another thread-local and using `Rc`, but I'm hoping it will be a small cost. r? ``@oli-obk`` r? ``@spastorino``
2023-10-24Rollup merge of #116943 - heiher:target-features, r=wesleywiserMatthias Krüger-1/+3
Add target features for LoongArch
2023-10-24Rollup merge of #116841 - chenyukang:yukang-suggest-unwrap-expect, r=b-naberMatthias Krüger-0/+245
Suggest unwrap/expect for let binding type mismatch Found it when investigating https://github.com/rust-lang/rust/issues/116738 I'm not sure whether it's a good style to suggest `unwrap`, seems it's may helpful for newcomers. #116738 needs another fix to improve it.
2023-10-24Rollup merge of #116094 - Swatinem:coverage-branch-gate, r=wesleywiserMatthias Krüger-4/+4
Introduce `-C instrument-coverage=branch` to gate branch coverage This was extracted from https://github.com/rust-lang/rust/pull/115061 and can land independently from other coverage related work. The flag is unused for now, but is added in advance of adding branch coverage support. It is an unstable, nightly only flag that needs to be used in combination with `-Zunstable-options`, like so: `-Zunstable-options -C instrument-coverage=branch`. The goal is to develop branch coverage as an unstable opt-in feature first, before it matures and can be turned on by default.
2023-10-24Auto merge of #117126 - matthiaskrgr:rollup-8huie8f, r=matthiaskrgrbors-0/+95
Rollup of 5 pull requests Successful merges: - #117081 (fix typos in comments) - #117091 (`OptWithInfcx` naming nits, trait bound simplifications) - #117092 (Add regression test for #117058) - #117093 (Update books) - #117105 (remove change-id assertion in bootstrap test) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-25suggest unwrap/expect for let binding type mismatchyukang-0/+245
2023-10-24Remove incomplete features from RPITIT/AFIT testsMichael Goulet-74/+29
2023-10-24Tweak test to avoid platform dependency.Camille GILLOT-15/+15
2023-10-24Rollup merge of #117092 - matthewjasper:attribute-validation, r=compiler-errorsMatthias Krüger-0/+95
Add regression test for #117058 The new behavior in nightly is correct, so add a test that it stays this way. Closes #117058
2023-10-24Auto merge of #116773 - dtolnay:validatestable, r=compiler-errorsbors-75/+85
Validate `feature` and `since` values inside `#[stable(…)]` Previously the string passed to `#[unstable(feature = "...")]` would be validated as an identifier, but not `#[stable(feature = "...")]`. In the standard library there were `stable` attributes containing the empty string, and kebab-case string, neither of which should be allowed. Pre-existing validation of `unstable`: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![unstable(feature = "kebab-case", issue = "none")] #[unstable(feature = "kebab-case", issue = "none")] pub struct Struct; ``` ```console error[E0546]: 'feature' is not an identifier --> src/lib.rs:5:1 | 5 | #![unstable(feature = "kebab-case", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` For an `unstable` attribute, the need for an identifier is obvious because the downstream code needs to write a `#![feature(...)]` attribute containing that identifier. `#![feature(kebab-case)]` is not valid syntax and `#![feature(kebab_case)]` would not work if that is not the name of the feature. Having a valid identifier even in `stable` is less essential but still useful because it allows for informative diagnostic about the stabilization of a feature. Compare: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![stable(feature = "kebab-case", since = "1.0.0")] #[stable(feature = "kebab-case", since = "1.0.0")] pub struct Struct; ``` ```rust // src/main.rs #![feature(kebab_case)] use repro::Struct; fn main() {} ``` ```console error[E0635]: unknown feature `kebab_case` --> src/main.rs:3:12 | 3 | #![feature(kebab_case)] | ^^^^^^^^^^ ``` vs the situation if we correctly use `feature = "snake_case"` and `#![feature(snake_case)]`, as enforced by this PR: ```console warning: the feature `snake_case` has been stable since 1.0.0 and no longer requires an attribute to enable --> src/main.rs:3:12 | 3 | #![feature(snake_case)] | ^^^^^^^^^^ | = note: `#[warn(stable_features)]` on by default ```
2023-10-24Add regression test for #117058Matthew Jasper-0/+95
2023-10-24Auto merge of #116435 - compiler-errors:re-erased, r=lcnrbors-0/+51
Handle `ReErased` in responses in new solver There are legitimate cases in the compiler where we return `ReErased` for lifetimes that are uncaptured in the hidden type of an opaque. For example, in the test committed below, we ignore ignore the bivariant lifetimes of an opaque when it's inferred as the hidden type of another opaque. This may result in a `type_of(Opaque)` call returning a type that references `ReErased`. Let's handle this gracefully in the new solver. Also added a `rustc_hidden_type_of_opaques` attr to print hidden types. This seems useful for opaques. r? lcnr
2023-10-24Introduce `-C instrument-coverage=branch` to gate branch coverageArpad Borsos-4/+4
This flag has to be used in combination with `-Zunstable-options`, and is added in advance of adding branch coverage instrumentation.
2023-10-23Add test and remove double refCelina G. Val-15/+82
2023-10-24tests/ui/abi/compatibility: Set min-llvm-version to 17 for LoongArch64WANG Rui-0/+1
2023-10-24tests: Add features-gate for LoongArchWANG Rui-1/+2
2023-10-24Auto merge of #116300 - cjgillot:split-move, r=petrochenkovbors-69/+57
Separate move path tracking between borrowck and drop elaboration. The primary goal of this PR is to skip creating a `MovePathIndex` for path that do not need dropping in drop elaboration. The 2 first commits are cleanups. The next 2 commits displace `move` errors from move-path builder to borrowck. Move-path builder keeps the same logic, but does not carry error information any more. The remaining commits allow to filter `MovePathIndex` creation according to types. This is used in drop elaboration, to avoid computing dataflow for paths that do not need dropping.
2023-10-23Auto merge of #117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgrbors-0/+33
Rollup of 6 pull requests Successful merges: - #107159 (rand use getrandom for freebsd (available since 12.x)) - #116859 (Make `ty::print::Printer` take `&mut self` instead of `self`) - #117046 (return unfixed len if pat has reported error) - #117070 (rustdoc: wrap Type with Box instead of Generics) - #117074 (Remove smir from triage and add me to stablemir) - #117086 (Update .mailmap to promote my livename) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-23Rollup merge of #117046 - bvanjoi:fix-116186, r=oli-obkMatthias Krüger-0/+33
return unfixed len if pat has reported error - Fixes #116186 - Fixes #113021 This issue arises due to the creation of a fixed-length pattern, as a result of the mir body corruption. The corruption taints `tcx.eval_to_allocation_raw`, causing it to return `AlreadyReported`. Consequently, this prevents `len.try_eval_target_usize` from evaluating correctly and returns `None`. Lastly, it results in the return of `[usize; min_len]`. To rectify this issue, my approach is that to return unfixed when encountering `ErrorHandled::Reported`. Additionally, in instances of `ErrorHandled::TooGeneric`, the previous logic has been reinstated.
2023-10-23Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkovbors-24/+120
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2023-10-23Let's see what those opaque types actually areMichael Goulet-1/+37
2023-10-23Handle ReErased in responses in new solverMichael Goulet-0/+15
2023-10-23Update `since` stability attributes in testsDavid Tolnay-69/+79
2023-10-23Fix stable feature names in testsDavid Tolnay-9/+9
2023-10-23Auto merge of #107009 - cjgillot:jump-threading, r=pnkfelixbors-24/+1798
Implement jump threading MIR opt This pass is an attempt to generalize `ConstGoto` and `SeparateConstSwitch` passes into a more complete jump threading pass. This pass is rather heavy, as it performs a truncated backwards DFS on MIR starting from each `SwitchInt` terminator. This backwards DFS remains very limited, as it only walks through `Goto` terminators. It is build to support constants and discriminants, and a propagating through a very limited set of operations. The pass successfully manages to disentangle the `Some(x?)` use case and the DFA use case. It still needs a few tests before being ready.
2023-10-23Auto merge of #117087 - matthiaskrgr:rollup-08kkjkz, r=matthiaskrgrbors-1/+175
Rollup of 5 pull requests Successful merges: - #116960 (Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only) - #116978 (Rewrite gdb pretty-printer registration) - #117040 (coverage: Add UI tests for values accepted by `-Cinstrument-coverage`) - #117064 (Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly) - #117073 (Fix suggestion for renamed coroutines feature) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-23Rollup merge of #117040 - Zalathar:instrument-coverage-ui, r=cjgillotMatthias Krüger-1/+70
coverage: Add UI tests for values accepted by `-Cinstrument-coverage` I wanted to clean up the code in `parse_instrument_coverage`, but it occurred to me that we currently don't have any UI tests for the various stable and unstable values supported by this flag. --- Normally it might be overkill to individually test all the different variants of `on`/`off`, but in this case the parsing of those values is mixed in with some other custom code, so I think it's worthwhile being thorough.
2023-10-23Rollup merge of #116960 - lqd:applied-member-constraints-scope, r=matthewjasperMatthias Krüger-0/+105
Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only The location-insensitive analysis considered loans to escape if there were member constraints, which makes *some* sense for scopes and matches the scopes that NLL computes on all the tests. However, polonius and NLLs differ on the fuzzed case #116657, where an SCC has member constraints but no applied ones (and is kinda surprising). The existing UI tests with member constraints impacting scopes all have some constraint applied. This PR changes the location-insensitive analysis to consider a loan to escape if there are applied member constraints, and for extra paranoia/insurance via fuzzing and crater: actually checks the constraint's min choice is indeed a universal region as we expect. (This could be turned into a `debug_assert` and early return as a slight optimization after these periods of verification) The 4 UI tests where member constraints are meaningful for computing scopes still pass obviously, and this also fixes #116657. r? `@matthewjasper`
2023-10-23return unfixed len if pat has reported errorbohan-0/+33
2023-10-23Auto merge of #116837 - oli-obk:smir_run_macro, r=spastorinobors-11/+20
Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver` This is done by moving all the logic into a macro that performs the entire "run" operation in one go. This makes https://github.com/rust-lang/rust/pull/116806 obsolete as a follow up we should make the macro usable without manually having to write ```rust #[macro_use] extern crate rustc_smir; extern crate stable_mir; extern crate rustc_driver; extern crate rustc_interface; use rustc_smir::rustc_internal; ``` in every crate that uses the macro. r? `@spastorino`
2023-10-23Merge associated types with the other alias typesOli Scherer-17/+17
2023-10-23Try to work around 32 bit mingw issuesOli Scherer-0/+3
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-168/+142
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23Avoid having `rustc_smir` depend on `rustc_interface` or `rustc_driver`Oli Scherer-11/+17
2023-10-23coverage: Add UI tests for values accepted by `-Cinstrument-coverage`Zalathar-1/+70