about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-04-04Use existing llvm methods, instead of rust wrappers for:klensy-67/+17
LLVMRustBuildCleanupPad -> LLVMBuildCleanupPad LLVMRustBuildCleanupRet -> LLVMBuildCleanupRet LLVMRustBuildCatchPad -> LLVMBuildCatchPad LLVMRustBuildCatchRet -> LLVMBuildCatchRet LLVMRustBuildCatchSwitch -> LLVMBuildCatchSwitch
2023-04-04replace LLVMRustAppendModuleInlineAsm with LLVMAppendModuleInlineAsm, ↵klensy-15/+6
LLVMRustMetadataTypeInContext with LLVMMetadataTypeInContext
2023-04-04replace LLVMRustMetadataAsValue with LLVMMetadataAsValueklensy-6/+2
2023-04-04add bunch of fixmes: currently there exist some functions that accept ↵klensy-0/+10
LLVMValueRef, some that accept LLVMMetadataRef, and replacing one with another not always possible without explicit convertion
2023-04-04replace deprecated LLVMSetCurrentDebugLocation with LLVMSetCurrentDebugLocation2klensy-3/+2
2023-04-04Auto merge of #109599 - notriddle:notriddle/use-redundant-glob, r=petrochenkovbors-14/+21
diagnostics: account for glob shadowing when linting redundant imports Fixes #92904
2023-04-04Rollup merge of #109896 - ↵Yuki Okushi-8/+14
Nilstrieb:integers-are-not-fn-ptrs-remember-this-dear-transmuter, r=compiler-errors Never consider int and float vars for `FnPtr` candidates This solves a regression where `0.0.cmp()` was ambiguous when a custom trait with a `cmp` method was in scope. For integers it shouldn't be a problem in practice so I wasn't able to add a test. I'm not sure whether there could be more issues hidden in the shadows as mentioned in the issue, but this should at least fix the problematic regression immediately. fixes #109892 r? oli-obk
2023-04-03Auto merge of #109819 - scottmcm:index-slice, r=WaffleLapkinbors-118/+168
Use `&IndexSlice` instead of `&IndexVec` where possible All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*. r? `@ghost`
2023-04-03Never consider int and float vars for `FnPtr` candidatesNilstrieb-8/+14
This solves a regression where `0.0.cmp()` was ambiguous when a custom trait with a `cmp` method was in scope. FOr integers it shouldn't be a problem in practice so I wasn't able to add a test.
2023-04-03fix(middle): emit error rather than delay bug when reaching limitbohan-5/+21
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-118/+168
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-02Auto merge of #109849 - scottmcm:more-fieldidx-rebase, r=oli-obkbors-46/+51
Use `FieldIdx` in various things related to aggregates Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`. Part 3/? of https://github.com/rust-lang/compiler-team/issues/606 [`IndexSlice`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/vec/struct.IndexVec.html#deref-methods-IndexSlice%3CI,+T%3E) was added in https://github.com/rust-lang/rust/pull/109787
2023-04-02Auto merge of #109008 - clubby789:drop-elaborate-array, r=davidtwcobors-18/+54
Drop array patterns using subslices Fixes #109004 Drops contiguous subslices of an array when moving elements out with a pattern, which improves perf for large arrays r? `@compiler-errors`
2023-04-02Rollup merge of #109846 - matthiaskrgr:clippy2023_04_III, r=NilstriebNilstrieb-30/+21
more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool)
2023-04-02Rollup merge of #109844 - matthiaskrgr:clippy2023_04, r=NilstriebNilstrieb-18/+13
a couple clippy::complexity fixes map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-46/+51
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-04-01slighty simplify a few boolean expressions (clippy::nonminimal_bool)Matthias Krüger-5/+4
2023-04-01use and_then/flat_map for map().flatten()Matthias Krüger-10/+7
2023-04-01fix clippy::iter_kv_mapMatthias Krüger-15/+10
2023-04-01a couple clippy::complexity fixesMatthias Krüger-18/+13
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-04-01Fix `non_exhaustive_omitted_patterns` on argumentsclubby789-0/+3
2023-04-01diagnostics: account for glob shadowing when linting redundant importsMichael Howell-14/+21
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-04-01Auto merge of #109721 - QuinnPainter:armv4t-lld, r=petrochenkovbors-19/+3
Switch to LLD as default linker for {arm,thumb}v4t-none-eabi The LLVM 16 update brought ARMv4t support to LLD. We should use it by default so users don't need to install an external linker. cc `@Lokathor`
2023-03-31Auto merge of #109165 - aliemjay:fix-ice-annotation, r=davidtwcobors-2/+2
allow ReError in CanonicalUserTypeAnnotation Why not? we already allow `TyKind::Error`. Fixes #109072.
2023-03-31Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomezbors-64/+48
Rollup of 7 pull requests Successful merges: - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2) - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`) - #109680 (Fix subslice capture in closure) - #109798 (fluent_messages macro: don't emit the OS error in a note) - #109805 (Source map cleanups) - #109818 (rustdoc: Add GUI test for jump to collapsed item) - #109820 (rustdoc-search: update docs for comma in `?` help popover) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Rollup merge of #109805 - nnethercote:source_map-cleanups, r=bjorn3Guillaume Gomez-25/+26
Source map cleanups r? `@bjorn3`
2023-03-31Rollup merge of #109798 - est31:ftl_test_note, r=davidtwcoGuillaume Gomez-14/+9
fluent_messages macro: don't emit the OS error in a note This makes it possible to make the normalization of the error message precise, allowing us to not normalize all notes away. See https://github.com/rust-lang/rust/pull/109700#discussion_r1152489053
2023-03-31Rollup merge of #109680 - clubby789:array-subslice-2229, r=davidtwcoGuillaume Gomez-3/+2
Fix subslice capture in closure Fixes #109298 by refining captures in the same way for Subslices and Indexes. The comment `// we never capture this` seems to have been inaccurate, as changing it to an assert causes many test failures `@rustbot` label +A-closures
2023-03-31Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddleGuillaume Gomez-22/+11
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes` Fixes #88070. It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem. r? `@jyn514`
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-160/+558
Initial support for return type notation (RTN) See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/ 1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter. * I'd add this in a follow-up. 3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~ * I don't think we actually want this. 5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`. * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it. 7. ~I'm not in love with the feature gate name 😺~ * I renamed it to `return_type_notation` :heavy_check_mark: Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later. r? `@ghost`
2023-03-31allow ReError in CanonicalUserTypeAnnotationAli MJ Al-Nasrawy-2/+2
2023-03-31Auto merge of #109787 - scottmcm:index-slice, r=cjgillotbors-70/+160
Add `IndexSlice` to go with `IndexVec` Moves the methods that don't need full `IndexVec`-ness over to `IndexSlice`, and have `IndexVec` deref to `IndexSlice` so everything keeps working. Doing this for later use in https://github.com/rust-lang/compiler-team/issues/606, where I'm hitting a bunch of things that are just slices and thus there's no way to index with the `FieldIdx`.
2023-03-31Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obkbors-2/+279
Insert alignment checks for pointer dereferences when debug assertions are enabled Closes https://github.com/rust-lang/rust/issues/54915 - [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit) - [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue! - [x] Implement a more helpful panic message like slice bounds checking. r? `@oli-obk`
2023-03-31Auto merge of #109803 - matthiaskrgr:rollup-mojot7k, r=matthiaskrgrbors-16/+10
Rollup of 4 pull requests Successful merges: - #109598 (Improve documentation for str::replace() and str::replacen()) - #109779 (Update gccjit and remove libc 0.1 dependency) - #109784 (Refactor glibc time64 support, riscv32 always has 64-bit `time_t`) - #109793 (add comment to `impl !Error for &str`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Rollup merge of #109779 - uweigand:s390x-gccjit-libc, r=WaffleLapkinMatthias Krüger-16/+10
Update gccjit and remove libc 0.1 dependency Fixes https://github.com/rust-lang/rust/issues/109774.
2023-03-31Improve `with_source_map`.Nicholas Nethercote-11/+14
Rename `with_source_map` as `set_source_map`. Because `with` functions (e.g. `with_session_globals`, `scoped_tls::ScopedKey::with`) are for *getting* a value for the duration of a closure, and `set` functions (e.g. `set_session_globals_then` `scoped_tls::ScopedKey::with`) are for *setting* a value for the duration of a closure. Also fix up the comment, which is wrong: - The bit about `TyCtxt` is wrong. - `span_debug1` doesn't exist any more. - There's only one level of fallback, not two. (This is effectively a follow-up to the changes in #93936.) Also add a comment explaining that `SessionGlobals::source_map` should only be used when absolutely necessary.
2023-03-31Remove an unnecessary use of `with_session_globals`.Nicholas Nethercote-14/+12
We can easily pass in the source map.
2023-03-31Auto merge of #109762 - scottmcm:variantdef-indexvec, r=WaffleLapkinbors-104/+127
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-31Don't emit the OS error in a noteest31-3/+6
This makes it possible to make the normalization of the error message more precise, allowing us to not normalize all notes away.
2023-03-31Use std::fs::read_to_file in fluent_messages macroest31-11/+3
2023-03-31Auto merge of #109750 - compiler-errors:deep-reject-less-permissive-num-var, ↵bors-0/+4
r=lcnr numeric vars can only be unified with numerical types in deep reject Don't consider numeric vars (int and float vars) to unify with non-numeric types during deep reject. This helps us reject incompatible impls sooner.
2023-03-31Update doc(primitive) in rustc_resolveGuillaume Gomez-3/+5
2023-03-30Auto merge of #109791 - compiler-errors:rollup-c3o710k, r=compiler-errorsbors-193/+254
Rollup of 6 pull requests Successful merges: - #109347 (Skip no_mangle if the item has no name.) - #109522 (Implement current_dll_path for AIX) - #109679 (Freshen normalizes-to hack goal RHS in the evaluate loop) - #109704 (resolve: Minor improvements to effective visibilities) - #109739 (Closures always implement `FnOnce` in new solver) - #109758 (Parallel compiler cleanups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-30Rename doc(primitive) into rustc_doc_primitiveGuillaume Gomez-19/+6
2023-03-30Rollup merge of #109758 - nnethercote:parallel-cleanups, r=cjgillotMichael Goulet-36/+45
Parallel compiler cleanups A few small improvements I found while looking closely at this code. r? `@cjgillot` cc `@Zoxc,` `@SparrowLii`
2023-03-30Rollup merge of #109739 - compiler-errors:new-solver-closure-fnonce, r=lcnrMichael Goulet-3/+14
Closures always implement `FnOnce` in new solver We should process `[closure]: FnOnce(Tys...) -> Ty` obligations *before* fallback and closure analysis. We can do this by taking advantage of the fact that `FnOnce` is always implemented by closures, even before we definitely know the closure kind. Fixes compiler-errors/next-solver-hir-issues#15 r? ``@oli-obk`` (trying to spread the reviewer load for new trait solver prs, and this one is pretty self-contained, though feel free to reassign 😸)
2023-03-30Rollup merge of #109704 - petrochenkov:effvisclean, r=jackh726Michael Goulet-42/+35
resolve: Minor improvements to effective visibilities See individual commits.
2023-03-30Rollup merge of #109679 - compiler-errors:normalizes-to-hack-2, r=lcnr,BoxyUwUMichael Goulet-43/+70
Freshen normalizes-to hack goal RHS in the evaluate loop Ensure that we repeatedly equate the unconstrained RHS of the normalizes-to hack goal with the *actual* RHS of the goal, even if the normalizes-to goal loops several times and thus we replace the unconstrained RHS var repeatedly. Alternative to #109583.
2023-03-30Rollup merge of #109522 - bzEq:aix-current-dll-path, r=NilstriebMichael Goulet-0/+44
Implement current_dll_path for AIX AIX doesn't feature `dladdr`, use `loadquery` instead. `loadquery` is documented in https://www.ibm.com/docs/en/aix/7.2?topic=l-loadquery-subroutine.
2023-03-30Rollup merge of #109347 - cjgillot:issue-109305, r=WaffleLapkinMichael Goulet-69/+46
Skip no_mangle if the item has no name. Fixes https://github.com/rust-lang/rust/issues/109305