about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-02-20Auto merge of #105961 - fmease:iat-type-directed-probing, r=jackh726bors-0/+504
Type-directed probing for inherent associated types When probing for inherent associated types (IATs), equate the Self-type found in the projection with the Self-type of the relevant inherent impl blocks and check if all predicates are satisfied. Previously, we didn't look at the Self-type or at the bounds and just picked the first inherent impl block containing an associated type with the name we were searching for which is obviously incorrect. Regarding the implementation, I basically copied what we do during method probing (`assemble_inherent_impl_probe`, `consider_probe`). Unfortunately, I had to duplicate a lot of the diagnostic code found in `rustc_hir_typeck::method::suggest` which we don't have access to in `rustc_hir_analysis`. Not sure if there is a simple way to unify the error handling. Note that in the future, `rustc_hir_analysis::astconv` might not actually be the place where we resolve inherent associated types (see https://github.com/rust-lang/rust/pull/103621#issuecomment-1304309565) but `rustc_hir_typeck` (?) in which case the duplication may naturally just disappear. While inherent associated *constants* are currently resolved during "method" probing, I did not find a straightforward way to incorporate IAT lookup into it as types and values (functions & constants) are two separate entities for which distinct code paths are taken. Fixes #104251 (incl. https://github.com/rust-lang/rust/issues/104251#issuecomment-1338501171). Fixes #105305. Fixes #107468. `@rustbot` label T-types F-inherent_associated_types r? types
2023-02-19Collect fulfillment errors across implsLeón Orell Valerian Liehr-0/+40
2023-02-19Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726bors-24/+36
Properly check for builtin derived code Fixes #108122
2023-02-19Auto merge of #107921 - cjgillot:codegen-overflow-check, r=tmiaskobors-14/+176
Make codegen choose whether to emit overflow checks ConstProp and DataflowConstProp currently have a specific code path not to propagate constants when they overflow. This is meant to have the correct behaviour when inlining from a crate with overflow checks (like `core`) into a crate compiled without. This PR shifts the behaviour change to the `Assert(Overflow*)` MIR terminators: if the crate is compiled without overflow checks, just skip emitting the assertions. This is already what happens with `OverflowNeg`. This allows ConstProp and DataflowConstProp to transform `CheckedBinaryOp(Add, u8::MAX, 1)` into `const (0, true)`, and let codegen ignore the `true`. The interpreter is modified to conform to this behaviour. Fixes #35310
2023-02-19Add a test and several known bugsLeón Orell Valerian Liehr-0/+127
2023-02-19Fix substitution bugLeón Orell Valerian Liehr-2/+53
2023-02-19Use InferCtxt::probe to properly detect ambiguous candidatesLeón Orell Valerian Liehr-0/+36
2023-02-19Use the correct ParamEnvLeón Orell Valerian Liehr-2/+40
2023-02-19Type-directed probing for inherent associated typesLeón Orell Valerian Liehr-0/+212
2023-02-19Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726Guillaume Gomez-0/+77
Fix RPITITs in default trait methods (by assuming projection predicates in param-env) Instead of having special projection logic that allows us to turn `ProjectionTy(RPITIT, [Self#0, ...])` into `OpaqueTy(RPITIT, [Self#0, ...])`, we can instead augment the param-env of default trait method bodies to assume these as projection predicates. This should allow us to only project where we're allowed to! In order to make this work without introducing a bunch of cycle errors, we additionally tweak the `OpaqueTypeExpander` used by `ParamEnv::with_reveal_all_normalized` to not normalize the right-hand side of projection predicates. This should be fine, because if we use the projection predicate to normalize some other projection type, we'll continue to normalize the opaque that it gets projected to. This also makes it possible to support default trait methods with RPITITs in an associated-type based RPITIT lowering strategy without too much extra effort. Fixes #107002 Alternative to #108142
2023-02-19Rollup merge of #108129 - ↵Guillaume Gomez-0/+28
GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov Correctly handle links starting with whitespace Part of https://github.com/rust-lang/rust/issues/107995. I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^' r? `@petrochenkov`
2023-02-19Rollup merge of #107766 - ↵Guillaume Gomez-0/+25
GuillaumeGomez:fix-json-reexports-of-different-items-with-same-name, r=aDotInTheVoid Fix json reexports of different items with same name Fixes #107677. I renamed `from_item_id*` functions into `id_from_item` instead because it makes more sense now. I also simplified the logic around it a bit so that the `ids` function will now directly pass `&clean::Item` to `id_from_item` and the ID will be consistently generated (it caused an issue when I updated the ID for imports). So now, the big change of this PR: I changed how imports' ID is generated: it now includes the target item's ID at the end of the ID. It's to prevent two reexported items with the same name (but different types). r? `@aDotInTheVoid`
2023-02-19Auto merge of #108228 - Dylan-DPC:rollup-i9t13qu, r=Dylan-DPCbors-84/+204
Rollup of 7 pull requests Successful merges: - #104659 (reflow the stack size story) - #106933 (Update documentation of select_nth_unstable and select_nth_unstable_by to state O(n^2) complexity) - #107783 (rustdoc: simplify DOM for `.item-table`) - #107951 (resolve: Fix doc links referring to other crates when documenting proc macro crates directly) - #108130 ("Basic usage" is redundant for there is just one example) - #108146 (rustdoc: hide `reference` methods in search index) - #108189 (Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-19Rollup merge of #108189 - compiler-errors:non_lifetime_binders-bound-stuff, ↵Dylan DPC-0/+85
r=jackh726 Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds 1. When assembling candidates for `for<T> T: Sized`, we can't ICE because the self-type is a bound type. 2. Fix an issue where, when canonicalizing in non-universe preserving mode, we don't actually set the universe for placeholders to the root even though we do the same for region vars. 3. Make `Placeholder("T")` format like `T` in error messages. Fixes #108180 Fixes #108182 r? types
2023-02-19Rollup merge of #108146 - notriddle:notriddle/rustdoc-search-reference, ↵Dylan DPC-0/+8
r=GuillaumeGomez rustdoc: hide `reference` methods in search index They're hidden in the HTML, so it makes no sense in the search engine for `reference::next` or `reference::shrink` to be shown. https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/What.20is.20.60reference.3A.3Ashrink.60.3F
2023-02-19Rollup merge of #107951 - petrochenkov:procmacdoc, r=jackh726Dylan DPC-0/+27
resolve: Fix doc links referring to other crates when documenting proc macro crates directly Fixes https://github.com/rust-lang/rust/issues/107950
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-84/+84
rustdoc: simplify DOM for `.item-table` This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-19Auto merge of #107772 - compiler-errors:dyn-star-backend-is-ptr, r=eholkbors-0/+32
Make `dyn*`'s value backend type a pointer One tweak on top of Ralf's commit should fix using `usize` as a `dyn*`-coercible type, and should fix when we're using various other pointer types when LLVM opaque pointers is disabled. r? `@eholk` but feel free to reassign cc https://github.com/rust-lang/rust/pull/107728#issuecomment-1421231823 `@RalfJung`
2023-02-19Auto merge of #107867 - compiler-errors:new-solver-fn-trait-safety, r=lcnrbors-0/+35
Check that built-in callable types validate their output type is `Sized` (in new solver) Working on parity with old solver. Putting this up for consideration, it's not *really* needed or anything just yet. Maybe it's better to approach this from another direction (like always checking the item bounds when calling `consider_assumption`? we may need that for coinduction to be sound though?) This basically implements #100096 for the new solver.
2023-02-18Add regression test for #107995Guillaume Gomez-0/+28
2023-02-18Replace _with_overflow instrinsics in LowerIntrinsics.Camille GILLOT-0/+90
2023-02-18Fix codegen test.Camille GILLOT-1/+1
2023-02-18Add codegen test.Camille GILLOT-0/+14
2023-02-18Remove overflow checks from ConstProp.Camille GILLOT-14/+72
2023-02-18Add testMichael Goulet-0/+77
2023-02-18Pretty placeholders using their namesMichael Goulet-5/+7
2023-02-18Collapse placeholders to root universe in canonicalizer if not preserving ↵Michael Goulet-2/+44
universes
2023-02-18Don't ICE on bound types in sized conditionsMichael Goulet-0/+41
2023-02-18Make dyn* have the same scalar pair ABI as corresponding fat pointerMichael Goulet-1/+3
2023-02-18Add codegen testMichael Goulet-0/+7
2023-02-18Use inttoptr to support usize as dyn* value, use pointercast to make sure ↵Michael Goulet-0/+23
pointers are compatible
2023-02-18Check that built-in callable types validate their output type is `Sized` (in ↵Michael Goulet-0/+35
new solver)
2023-02-18Add regression test for #107677Guillaume Gomez-0/+25
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-16rustdoc: hide `reference` methods in search indexMichael Howell-0/+8
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`