summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2022-08-05Upgrade hashbrown to 0.12.3Amanieu d'Antras-2/+2
This fixes a double-free in the `clone_from` function if dropping an existing element in the table panics. See https://github.com/rust-lang/hashbrown/pull/348 for more details.
2022-08-05Upgrade indexmap and thorin-dwp to use hashbrown 0.12Josh Stone-9/+9
This removes the last dependencies on hashbrown 0.11.
2022-08-05Fix backwards-compatibility check for tests with `+whole-archive`Daniel Sommermann-1/+1
Fixes #100066
2022-07-30allow numbers with provenance within CTFE executionRalf Jung-3/+7
This effectively reverts https://github.com/rust-lang/rust/pull/97684 for CTFE
2022-07-21beta backport of arg mismatch bugfixMichael Goulet-6/+2
2022-07-21Rollup merge of #99435 - CAD97:revert-dollar-dollar-crate, r=Mark-SimulacrumMatthias Krüger-0/+2
Revert "Stabilize $$ in Rust 1.63.0" This mechanically reverts commit 9edaa76adce4de737db54194eb13d6c298827b37, the one commit from #95860. https://github.com/rust-lang/rust/issues/99035; the behavior of `$$crate` is potentially unexpected and not ready to be stabilized. https://github.com/rust-lang/rust/pull/99193 attempts to forbid `$$crate` without also destabilizing `$$` more generally. `@rustbot` modify labels +T-compiler +T-lang +P-medium +beta-nominated +relnotes (applying the labels I think are accurate from the issue and alternative partial revert) cc `@Mark-Simulacrum`
2022-07-15Handle fresh lifetimes on bare trait objects.Camille GILLOT-0/+51
2022-07-15promote placeholder bounds to 'static obligationsNiko Matsakis-6/+34
In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries.
2022-07-15Fix sized check ICE in intrisicckMichael Goulet-20/+12
2022-07-09Only register hidden types for opaque types from the current crate, nothing ↵Oli Scherer-1/+2
else would work anyway.
2022-07-09not knowing about opaque types is worse than not knowing about regions, make ↵Oli Scherer-2/+2
sure we don't accidentally mark something as ok-modulo-regions if there are opaque types involved
2022-07-09Remove type flag based opaque type workaroundOli Scherer-8/+0
2022-07-09Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-9/+27
hidden types for opaque types
2022-07-09use a method instead of manually doing what its body doesOli Scherer-1/+1
2022-07-09pessimistically treat all function items as containing an opaque typeOli Scherer-0/+5
2022-07-09Return a FxIndexSet in is_late_bound query.Camille GILLOT-3/+4
This return value is iterated upon by borrowck, hence the need to preserve a deterministic iteration order.
2022-06-24Auto merge of #98447 - JohnTitor:rollup-pponoo3, r=JohnTitorbors-163/+132
Rollup of 9 pull requests Successful merges: - #91264 (Add macro support in jump to definition feature) - #96955 (Remove (transitive) reliance on sorting by DefId in pretty-printer) - #97633 (Session object: Set OS/ABI) - #98039 (Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases) - #98214 (rustc_target: Remove some redundant target properties) - #98280 (Improve suggestion for calling fn-like expr on type mismatch) - #98394 (Fixup missing renames from `#[main]` to `#[rustc_main]`) - #98411 (Update tendril) - #98419 (Remove excess rib while resolving closures) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-24Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errorsYuki Okushi-1/+3
Remove excess rib while resolving closures I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`. I couldn't find a way in which removing this will break anything, all test seem to pass, etc. r? ``@compiler-errors`` cc ``@davidtwco``
2022-06-24Rollup merge of #98394 - Enselic:fixup-rustc_main-renames, r=petrochenkovYuki Okushi-11/+12
Fixup missing renames from `#[main]` to `#[rustc_main]` In #84217 `#[main]` was removed and replaced with `#[rustc_main]`. In some places the rename was forgotten, which makes the current code confusing, because at first glance it seems that `#[main]` is still around. Perform the renames also in these places. I noticed this (after first being confused by it) when working on #97802. r? `@petrochenkov` (since you reviewed the other PR)
2022-06-24Rollup merge of #98280 - compiler-errors:better-call-closure-on-type-err, ↵Yuki Okushi-114/+77
r=estebank Improve suggestion for calling fn-like expr on type mismatch 1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty` 2.) Suggest calling closures even when they're not assigned to a local variable first 3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`) r? ```@estebank```
2022-06-24Rollup merge of #98214 - petrochenkov:islike, r=compiler-errorsYuki Okushi-20/+11
rustc_target: Remove some redundant target properties `is_like_emscripten` is equivalent to `os == "emscripten"`, so it's removed. `is_like_fuchsia` is equivalent to `os == "fuchsia"`, so it's removed. `is_like_osx` also falls into the same category and is equivalent to `vendor == "apple"`, but it's commonly used so I kept it as is for now. `is_like_(solaris,windows,wasm)` are combinations of different operating systems or architectures (see compiler/rustc_target/src/spec/tests/tests_impl.rs) so they are also kept as is. I think `is_like_wasm` (and maybe `is_like_osx`) are sufficiently closed sets, so we can remove these fields as well and replace them with methods like `fn is_like_wasm() { arch == "wasm32" || arch == "wasm64" }`. On other hand, `is_like_solaris` and `is_like_windows` are sufficiently open and I can imagine custom targets introducing other values for `os`. This is kind of a gray area.
2022-06-24Rollup merge of #97633 - mkroening:object-osabi, r=petrochenkovYuki Okushi-6/+15
Session object: Set OS/ABI Closes https://github.com/rust-lang/rust/issues/97535. This depends on * https://github.com/gimli-rs/object/pull/438 This adapts LLVM's behavior of [`MCELFObjectTargetWriter::getOSABI`](https://github.com/llvm/llvm-project/blob/8c8a2679a20f621994fa904bcfc68775e7345edc/llvm/include/llvm/MC/MCELFObjectWriter.h#L72-L86).
2022-06-24Rollup merge of #96955 - Aaron1011:pretty-print-sort, r=petrochenkovYuki Okushi-11/+10
Remove (transitive) reliance on sorting by DefId in pretty-printer This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See #90317
2022-06-24Rollup merge of #91264 - GuillaumeGomez:macro-jump-to-def, r=jshaYuki Okushi-0/+4
Add macro support in jump to definition feature Fixes #91174. To do so, I check if the span comes from an expansion, and if so, I infer the original macro `DefId` or `Span` depending if it's a defined in the current crate or not. There is one limitation due to macro expansion though: ```rust macro_rules! yolo { () => {}} fn foo() { yolo!(); } ``` In `foo`, `yolo!` won't be linked because after expansion, it is replaced by nothing (which seems logical). So I can't get an item from the `Visitor` from which I could tell if its `Span` comes from an expansion. I added a test for this specific limitation alongside others. Demo: https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html As for the empty macro issue that cannot create a jump to definition, you can see it [here](https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html#35). r? ```@jyn514```
2022-06-24Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726bors-121/+455
fix universes in the NLL type tests In the NLL code, we were not accommodating universes in the `type_test` logic. Fixes #98095. r? `@compiler-errors` This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
2022-06-23Rollup merge of #98388 - rosehuds:master, r=davidtwcoMichael Goulet-4/+18
implement `iter_projections` function on `PlaceRef` this makes the api more flexible. the original function now calls the PlaceRef version to avoid duplicating the code.
2022-06-23Rollup merge of #98365 - jyn514:improve-obligation-errors-review-comments, ↵Michael Goulet-23/+19
r=eholk Address review comments from #98259 It got approved so fast I didn't have time to make changes xD r? ``@eholk``
2022-06-23Rollup merge of #98355 - hoodmane:emscripten-no-default, r=petrochenkovMichael Goulet-1/+2
Update no_default_libraries handling for emscripten target ```@sbc100``` says: > `-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]` is almost certainly wrong/out-of-date. This setting defaults to the empty list anyway these days so its redundant. Also we now support `-nodefaultlibs` so you can use that, as with other toolchains. https://github.com/rust-lang/rust/issues/98303#issuecomment-1162163684
2022-06-23Rollup merge of #98353 - beetrees:builtin-macros-cfg-diag, r=davidtwcoMichael Goulet-6/+38
Migrate two diagnostics from the `rustc_builtin_macros` crate Migrate two diagnostics to use the struct derive and be translatable. r? ```@davidtwco```
2022-06-23Rollup merge of #98305 - klensy:no-err-alloc, r=compiler-errorsMichael Goulet-32/+33
prohibit_generics: don't alloc error string if no error emitted Noticed unreaded allocs in DHAT.
2022-06-23Rollup merge of #98283 - TaKO8Ki:point-at-private-fields-in-struct-literal, ↵Michael Goulet-13/+62
r=compiler-errors Point at private fields in struct literal closes #95872
2022-06-23Rollup merge of #98269 - compiler-errors:provide-more-segment-res, ↵Michael Goulet-0/+1
r=petrochenkov Provide a `PathSegment.res` in more cases I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment. This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
2022-06-23Rollup merge of #98259 - jyn514:improve-obligation-errors, r=estebankMichael Goulet-12/+93
Greatly improve error reporting for futures and generators in `note_obligation_cause_code` Most futures don't go through this code path, because they're caught by `maybe_note_obligation_cause_for_async_await`. But all generators do, and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses. At some point, we may want to consider unifying this with the code for `maybe_note_async_await`, so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points. But both functions are quite complicated, and it's not clear to me how to combine them; this seems like a good incremental improvement. Helps with https://github.com/rust-lang/rust/issues/97332. r? ``@estebank`` cc ``@eholk`` ``@compiler-errors``
2022-06-23Rollup merge of #98184 - compiler-errors:elided-lifetime-in-impl-nll, r=cjgillotMichael Goulet-5/+56
Give name if anonymous region appears in impl signature Fixes #98170 We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
2022-06-23run `x.py fmt`Niko Matsakis-9/+2
2022-06-23remove misleading commentNiko Matsakis-4/+1
per aliemjay's suggestion
2022-06-23try to clarify confusing commentNiko Matsakis-1/+9
2022-06-23normalize if-eq bounds before testingNiko Matsakis-1/+2
Hat-tip: aliemjay
2022-06-23apply suggestions from oli-obkNiko Matsakis-8/+8
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-23coallesce docsNiko Matsakis-65/+32
2022-06-23rename IfEqBound to IfEqNiko Matsakis-11/+11
2022-06-23remove VerifyBound::IfEq variantNiko Matsakis-59/+31
2022-06-23Session object: Set OS/ABIMartin Kröning-2/+10
This adapts LLVM's behavior of MCELFObjectTargetWriter::getOSABI [1]. [1]: https://github.com/llvm/llvm-project/blob/8c8a2679a20f621994fa904bcfc68775e7345edc/llvm/include/llvm/MC/MCELFObjectWriter.h#L72-L86
2022-06-23Remove excess rib while resolving closuresMaybe Waffle-1/+3
2022-06-22Set no_default_libraries: false in wasm32_emscripten targetHood Chatham-0/+1
2022-06-22Remove (transitive) reliance on sorting by DefId in pretty-printerAaron Hill-11/+10
This moves us a step closer to removing the `PartialOrd/`Ord` impls for `DefId`. See #90317
2022-06-22Fixup missing renames from `#[main]` to `#[rustc_main]`Martin Nordholts-11/+12
In fc357039f9 `#[main]` was removed and replaced with `#[rustc_main]`. In some place the rename was forgotten, which makes the current code confusing, because at first glance it seems that `#[main]` is still around. Perform the renames also in these places.
2022-06-22implement `iter_projections` function on `PlaceRef`Rose Hudson-4/+18
this makes the api more flexible. the original function now calls the PlaceRef version to avoid duplicating the code.
2022-06-22Auto merge of #98279 - cjgillot:all-fresh-nofn, r=petrochenkovbors-531/+727
Create elided lifetime parameters for function-like types Split from https://github.com/rust-lang/rust/pull/97720 This PR refactor lifetime generic parameters in bare function types and parenthesized traits to introduce the additional required lifetimes as fresh parameters in a `for<>` bound. This PR does the same to lifetimes appearing in closure signatures, and as-if introducing `for<>` bounds on closures (without the associated change in semantics). r? `@petrochenkov`
2022-06-22Rollup merge of #97895 - nbdd0121:unlikely, r=estebankYuki Okushi-31/+13
Simplify `likely!` and `unlikely!` macro The corresponding intrinsics have long been safe-to-call, so the unsafe block is no longer needed.