about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-02-18Auto merge of #108209 - petrochenkov:doclean, r=notriddlebors-16/+16
rustdoc: Cleanup doc link extraction
2023-02-18Rollup merge of #108186 - ↵Matthias Krüger-14/+86
compiler-errors:closures-with-late-bound-types-r-bad, r=cjgillot Deny non-lifetime bound vars in `for<..> ||` closure binders Moves the check for illegal bound var types from astconv to resolve_bound_vars. If a binder is defined to have a type or const late-bound var that's not allowed, we'll resolve any usages to ty error or const error values, so we shouldn't ever see late-bound types or consts in places they aren't expected. Fixes #108184 Fixes #108181 Fixes #108192
2023-02-18Rollup merge of #108162 - clubby789:issue-108155, r=NilstriebMatthias Krüger-0/+15
Don't eagerly convert principal to string Fixes #108155 ~~I haven't yet been able to reproduce the ICE in a minimal example unfortunately.~~ Added a test
2023-02-18Rollup merge of #108031 - jieyouxu:issue-108019, r=estebankMatthias Krüger-4/+135
Don't recover lifetimes/labels containing emojis as character literals Fixes #108019. Note that at the time of this commit, `unic-emoji-char` seems to have data tables only up to Unicode 5.0, but Unicode is already newer than this. A newer emoji such as `🥺` will not be recognized as an emoji but older emojis such as `🐱` will. This PR leaves a couple of FIXMEs where `unic_emoji_char::is_emoji` is used.
2023-02-18rustdoc: Cleanup broken link callbacksVadim Petrochenkov-16/+16
2023-02-18Add addl testMichael Goulet-0/+24
2023-02-18Move late-bound arg type checks to resolve_bound_varsMichael Goulet-0/+48
2023-02-18Auto merge of #99679 - repnop:kernel-address-sanitizer, r=cuviperbors-0/+75
Add `kernel-address` sanitizer support for freestanding targets This PR adds support for KASan (kernel address sanitizer) instrumentation in freestanding targets. I included the minimal set of `x86_64-unknown-none`, `riscv64{imac, gc}-unknown-none-elf`, and `aarch64-unknown-none` but there's likely other targets it can be added to. (`linux_kernel_base.rs`?) KASan uses the address sanitizer attributes but has the `CompileKernel` parameter set to `true` in the pass creation.
2023-02-18Adjust tracking issue for non_lifetime_bindersMichael Goulet-14/+14
2023-02-17Auto merge of #105274 - saethlin:instcombine-mut-ref, r=cjgillotbors-26/+8
Enable instcombine for mutable reborrows `instcombine` used to contain this comment, which is no longer accurate because there it is fine to copy `&mut _` in MIR: ```rust // The dereferenced place must have type `&_`, so that we don't copy `&mut _`. ``` So let's try replacing that check with something much more permissive...
2023-02-17Don't eagerly convert principal to stringclubby789-0/+15
2023-02-17Auto merge of #108159 - matthiaskrgr:rollup-5k2j7cx, r=matthiaskrgrbors-0/+52
Rollup of 6 pull requests Successful merges: - #107592 (Default `repr(C)` enums to `c_int` size) - #107956 (Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`) - #108126 (fix a line, and do a consistency fix) - #108144 (Add compiler-errors to a few more triagebot groups) - #108149 (typo) - #108154 (`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-17Rollup merge of #107592 - workingjubilee:use-16-bit-enum-on-16-bit-targets, ↵Matthias Krüger-0/+52
r=WaffleLapkin Default `repr(C)` enums to `c_int` size This is what ISO C strongly implies this is correct, and many processor-specific ABIs imply or mandate this size, so "everyone" (LLVM, gcc...) defaults to emitting enums this way. However, this is by no means guaranteed by ISO C, and the bare-metal Arm targets show it can be overridden, which rustc supports via `c-enum-min-bits` in a target.json. The override is a flag named `-fshort-enums` in clang and gcc, but introducing a CLI flag is probably unnecessary for rustc. This flag can be used by non-Arm microcontroller targets, like AVR and MSP430, but it is not enabled for them by default. Rust programmers who know the size of a target's enums can use explicit reprs, which also lets them match C23 code. This change is most relevant to 16-bit targets: AVR and MSP430. Most of rustc's targets use 32-bit ints, but ILP64 does exist. Regardless, rustc should now correctly handle enums for both very small and very large targets. Thanks to William for confirming MSP430 behavior, and to Waffle for better style and no-core `size_of` asserts. Fixes rust-lang/rust#107361 Fixes rust-lang/rust#77806
2023-02-17add predicate evaluation logicBoxy-2/+11
2023-02-17Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_impl, ↵Matthias Krüger-0/+40
r=compiler-errors Do not ICE on unmet trait alias impl bounds Fixes #108132 I've also added some documentation to the `impl_def_id` field of `DerivedObligationCause` to try and minimise the risk of such errors in future. r? `@compiler-errors`
2023-02-17Rollup merge of #108009 - c410-f3r:moar-tests, r=petrochenkovMatthias Krüger-0/+0
Move some tests r? `@petrochenkov`
2023-02-17Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillotMatthias Krüger-30/+234
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2023-02-16Default repr(C) enums to c_int sizeJubilee Young-0/+52
This is what ISO C strongly implies this is correct, and many processor-specific ABIs imply or mandate this size, so "everyone" (LLVM, gcc...) defaults to emitting enums this way. However, this is by no means guaranteed by ISO C, and the bare-metal Arm targets show it can be overridden, which rustc supports via `c-enum-min-bits` in a target.json. The override is a flag named `-fshort-enums` in clang and gcc, but introducing a CLI flag is probably unnecessary for rustc. This flag can be used by non-Arm microcontroller targets, like AVR and MSP430, but it is not enabled for them by default. Rust programmers who know the size of a target's enums can use explicit reprs, which also lets them match C23 code. This change is most relevant to 16-bit targets: AVR and MSP430. Most of rustc's targets use 32-bit ints, but ILP64 does exist. Regardless, rustc should now correctly handle enums for both very small and very large targets. Thanks to William for confirming MSP430 behavior, and to Waffle for better style and no-core size_of asserts. Co-authored-by: William D. Jones <thor0505@comcast.net> Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-02-16Do not ICE on unmet trait alias impl boundsAlan Egerton-0/+40
2023-02-16Rollup merge of #108115 - eggyal:unmet_trait_alias_bound, r=compiler-errorsMatthias Krüger-0/+30
Do not ICE on unmet trait alias bounds Rework of #108093 following feedback on that PR. Fixes #108072 r? `@compiler-errors`
2023-02-16Rollup merge of #108057 - GuillaumeGomez:fix-reexport-attr-merge, r=notriddleMatthias Krüger-0/+33
Prevent some attributes from being merged with others on reexports Final fix for https://github.com/rust-lang/rust/issues/59368. As discussed on zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Filtering.20sub.20attributes.20in.20ast.3A.3AAttribute), we need to clone the `Attribute` to be able to filter some parts of it. Then we need to go through the attributes to able to only keep what we want (everything except a few attributes in short). As for the second commit, when I wrote the test, I realized that the code to traverse all reexports one by one to collect all their attributes was not completely working so I fixed the few issues remaining. r? `@notriddle`
2023-02-16Rollup merge of #106347 - estebank:removal-suggestion, r=TaKO8KiMatthias Krüger-206/+188
More accurate spans for arg removal suggestion Partially address #106304.
2023-02-16Move testsCaio-0/+0
2023-02-16Enable instcombine for mutable reborrowsBen Kimock-26/+8
2023-02-16Do not ICE on unmet trait alias boundsAlan Egerton-0/+30
2023-02-16Auto merge of #101841 - nnethercote:rm-save-analysis, r=Mark-Simulacrumbors-1439/+40
Remove save-analysis. Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. Closes https://github.com/rust-lang/rust/issues/43606
2023-02-16Auto merge of #108116 - Dylan-DPC:rollup-h3n2vxl, r=Dylan-DPCbors-0/+52
Rollup of 6 pull requests Successful merges: - #106372 (Use id-based thread parking on SOLID) - #108050 (Fix index out of bounds ICE in `point_at_expr_source_of_inferred_type`) - #108084 (Constify `RangeBounds`, `RangeX::contains` and `RangeX::is_empty` (where applicable).) - #108101 (don't clone types that are copy) - #108102 (simplify some refs) - #108103 (be nice and don't slice) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-16Rollup merge of #108050 - martingms:issue-108042-fix, r=compiler-errorsDylan DPC-0/+52
Fix index out of bounds ICE in `point_at_expr_source_of_inferred_type` There might be more type params than args to a method call, which leads to an index out of bounds panic. I'm not familiar with this code at all, so unsure whether this is the right fix, but at least this patch fixes #108042 for me (I hit the same issue with similar code)
2023-02-16Remove save-analysis.Nicholas Nethercote-1439/+40
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-16Auto merge of #107449 - saethlin:enable-copyprop, r=oli-obkbors-261/+300
Enable CopyProp r? `@tmiasko` `@rustbot` label +A-mir-opt
2023-02-16Deny some late-bound ty/ct in some positions, add testsMichael Goulet-0/+156
2023-02-16Add feature gate for non_lifetime_bindersMichael Goulet-30/+78
2023-02-16Auto merge of #108096 - matthiaskrgr:rollup-ncexzf6, r=matthiaskrgrbors-35/+73
Rollup of 10 pull requests Successful merges: - #107034 (Migrating rustc_infer to session diagnostics (part 4)) - #107972 (Fix unintentional UB in ui tests) - #108010 (Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans) - #108021 (make x look for x.py if shell script does not exist) - #108047 (Use `target` instead of `machine` for mir interpreter integer handling.) - #108049 (Don't suggest `#[doc(hidden)]` trait methods with matching return type) - #108066 (Better names for illegal impl trait positions) - #108076 (rustdoc: Use more let chain) - #108088 (clarify correctness of `black_box`) - #108094 (Demonstrate I/O in File examples) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-15Auto merge of #108012 - compiler-errors:issue-107999, r=oli-obkbors-0/+42
Don't ICE in `might_permit_raw_init` if reference is polymorphic Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition. cc `@saethlin` fixes #107999
2023-02-15Rollup merge of #108066 - compiler-errors:better-labels-for-bad-impl-trait, ↵Matthias Krüger-23/+23
r=petrochenkov Better names for illegal impl trait positions Just some wording tweaks, no behavior changes.
2023-02-15Rollup merge of #108049 - clubby789:dont-suggest-unstable, r=compiler-errorsMatthias Krüger-0/+35
Don't suggest `#[doc(hidden)]` trait methods with matching return type Fixes #107983, addressing the bad suggestion. The test can probably be made more specific to this case, but I'm unsure how. `@rustbot` label +A-diagnostics
2023-02-15Rollup merge of #107972 - saethlin:fix-test-ub, r=michaelwoeristerMatthias Krüger-12/+15
Fix unintentional UB in ui tests `@matthiaskrgr` found UB in a bunch of the ui tests. This PR fixes a batch of miscellaneous tests I didn't think needed reviewers from a particular part of the project.
2023-02-15Skip method calls with arity mismatchMartin Gammelsæter-10/+1
2023-02-15Add point-at-inference ui test for wrong arity caseMartin Gammelsæter-0/+61
2023-02-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-396/+25
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-15Fix unintentional UB in ui testsBen Kimock-12/+15
2023-02-15Don't suggest `#[doc(hidden)]` methodsclubby789-0/+35
2023-02-15Auto merge of #108070 - Dylan-DPC:rollup-v6xw7vk, r=Dylan-DPCbors-12/+395
Rollup of 7 pull requests Successful merges: - #105300 (rework min_choice algorithm of member constraints) - #107163 (Remove some superfluous type parameters from layout.rs.) - #107173 (Suggest the correct array length on mismatch) - #107411 (Handle discriminant in DataflowConstProp) - #107968 (Enable `#[thread_local]` on armv6k-nintendo-3ds) - #108032 (Un📦ing the Resolver) - #108060 (Revert to using `RtlGenRandom` as a fallback) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-15Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obkDylan DPC-10/+77
Handle discriminant in DataflowConstProp cc ``@jachris`` r? ``@JakobDegen`` This PR attempts to extend the DataflowConstProp pass to handle propagation of discriminants. We handle this by adding 2 new variants to `TrackElem`: `TrackElem::Variant` for enum variants and `TrackElem::Discriminant` for the enum discriminant pseudo-place. The difficulty is that the enum discriminant and enum variants may alias each another. This is the issue of the `Option<NonZeroUsize>` test, which is the equivalent of https://github.com/rust-lang/unsafe-code-guidelines/issues/84 with a direct write. To handle that, we generalize the flood process to flood all the potentially aliasing places. In particular: - any write to `(PLACE as Variant)`, either direct or through a projection, floods `(PLACE as OtherVariant)` for all other variants and `discriminant(PLACE)`; - `SetDiscriminant(PLACE)` floods `(PLACE as Variant)` for each variant. This implies that flooding is not hierarchical any more, and that an assignment to a non-tracked place may need to flood a tracked place. This is handled by `for_each_aliasing_place` which generalizes `preorder_invoke`. As we deaggregate enums by putting `SetDiscriminant` last, this allows to propagate the value of the discriminant. This refactor will allow to make https://github.com/rust-lang/rust/pull/107009 able to handle discriminants too.
2023-02-15Rollup merge of #107173 - clubby789:suggest-array-length, r=compiler-errorsDylan DPC-2/+54
Suggest the correct array length on mismatch Fixes #107156 I wasn't able to find a way to get the `Span` for the actual array size unfortunately, so this suggestion can't be applied automatically. ``@rustbot`` label +A-diagnostics
2023-02-15Rollup merge of #105300 - aliemjay:member-lower, r=oli-obkDylan DPC-0/+264
rework min_choice algorithm of member constraints See [this comment](https://github.com/rust-lang/rust/pull/105300#issuecomment-1384312743) for the description of the new algorithm. Fixes #63033 Fixes #104639 This uses a more general algorithm than #89056 that doesn't treat `'static` as a special case. It thus accepts more code. For example: ```rust async fn test2<'s>(_: &'s u8, _: &'_ &'s u8, _: &'_ &'s u8) {} ``` I claim it's more correct as well because it fixes #104639. cc ``@nikomatsakis`` ``@lqd`` ``@tmandry`` ``@eholk`` ``@chenyukang`` ``@oli-obk`` r? types
2023-02-15Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, ↵bors-0/+181
r=compiler-errors use semantic equality for const param type equality assertion Fixes #107898 See added test for what caused this ICE --- The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics: - it will ICE when there are infer vars in a projection in a const param ty - it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq` - i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic. This impl feels pretty Not Great to me although i am not sure what a better idea would be. - We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing) - `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments. We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better. We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it. r? `@compiler-errors`
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-0/+75
2023-02-14Try to fix codegen tests for ??? LLVM 14 ???Ben Kimock-5/+5
2023-02-14Fix codegen testsBen Kimock-94/+94