about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-07-10Auto merge of #86987 - lcnr:const-default-eval-bound, r=oli-obkbors-23/+10
only check cg defaults wf once instantiated the previous fixmes here didn't make too much sense as I didn't yet fully understand the code further below. That code only runs if the predicates using our generic param default are fully concrete after substituting our default, which never happens if our default is generic. r? `@oli-obk` `@BoxyUwU`
2021-07-10Auto merge of #86968 - inquisitivecrystal:missing-docs-v2, r=oli-obkbors-0/+63
Remove `missing_docs` lint on private 2.0 macros https://github.com/rust-lang/rust/blob/798baebde1fe77e5a660490ec64e727a5d79970d/compiler/rustc_lint/src/builtin.rs#L573-L584 This code is the source of #57569. The problem is subtle, so let me point it out. This code makes the mistake of assuming that all of the macros in `krate.exported_macros` are exported. ...Yeah. For some historical reason, all `macro` macros are marked as exported, regardless of whether they actually are, which is dreadfully confusing. It would be more accurate to say that `exported_macros` currently contains only macros that have paths. This PR renames `exported_macros` to `importable_macros`, since these macros can be imported with `use` while others cannot. It also fixes the code above to no longer lint on private `macro` macros, since the `missing_docs` lint should only appear on exported items. Fixes #57569.
2021-07-09Auto merge of #86419 - ricobbe:raw-dylib-stdcall, r=petrochenkovbors-2/+293
Add support for raw-dylib with stdcall, fastcall functions Next stage of work for #58713: allow `extern "stdcall"` and `extern "fastcall"` with `#[link(kind = "raw-dylib")]`. I've deliberately omitted support for vectorcall, as that doesn't currently work, and I wanted to get this out for review. (I haven't really investigated the vectorcall failure much yet, but at first (very cursory) glance it appears that the problem is elsewhere.)
2021-07-09Auto merge of #85263 - Smittyvb:thir-unsafeck-union-field, r=oli-obkbors-70/+965
Check for union field accesses in THIR unsafeck see also #85259, #83129, https://github.com/rust-lang/project-thir-unsafeck/issues/7 r? `@LeSeulArtichaut`
2021-07-09Add support for raw-dylib with stdcall, fastcall functions on ↵Richard Cobbe-2/+293
i686-pc-windows-msvc.
2021-07-09Don't stub out part of testSmitty-5/+12
2021-07-09Check for union field accesses in THIR unsafeckSmitty-65/+953
2021-07-09Auto merge of #87003 - m-ou-se:rollup-x7mhv3v, r=m-ou-sebors-18/+45
Rollup of 5 pull requests Successful merges: - #86855 (Fix comments about unique borrows) - #86881 (Inline implementation of lookup_line) - #86937 (Change linked tracking issue for more_qualified_paths) - #86994 (Update the comment on `lower_expr_try`) - #87000 (Use #[track_caller] in const panic diagnostics.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-07-09Rollup merge of #87000 - m-ou-se:const-panic-track-caller, r=oli-obkMara Bos-15/+42
Use #[track_caller] in const panic diagnostics. This change stops const panic diagnostics from reporting inside #[track_caller] functions by skipping over them.
2021-07-09Rollup merge of #86937 - rylev:tracking-more-qualified-paths, r=nagisaMara Bos-3/+3
Change linked tracking issue for more_qualified_paths This updates the linked tracking issue for the `more_qualified_paths` feature from the implementation PR #80080 to an actual tracking issue #86935.
2021-07-09Use #[track_caller] in const panic diagnostics.Mara Bos-15/+42
It was already used for the message. This also uses it for the spans used for the error and backtrace.
2021-07-09Auto merge of #86888 - FabianWolff:issue-86600, r=davidtwcobors-266/+42
Fix double warning about illegal floating-point literal pattern This PR fixes #86600. The problem is that the `ConstToPat` struct contains a field `include_lint_checks`, which determines whether lints should be emitted or not, but this field is currently not obeyed at one point, leading to a warning being emitted more than once. I have fixed this behavior here.
2021-07-09Auto merge of #85828 - scottmcm:raw-eq, r=oli-obkbors-2/+121
Stop generating `alloca`s & `memcmp` for simple short array equality Example: ```rust pub fn demo(x: [u16; 6], y: [u16; 6]) -> bool { x == y } ``` Before: ```llvm define zeroext i1 `@_ZN10playground4demo17h48537f7eac23948fE(i96` %0, i96 %1) unnamed_addr #0 { start: %y = alloca [6 x i16], align 8 %x = alloca [6 x i16], align 8 %.0..sroa_cast = bitcast [6 x i16]* %x to i96* store i96 %0, i96* %.0..sroa_cast, align 8 %.0..sroa_cast3 = bitcast [6 x i16]* %y to i96* store i96 %1, i96* %.0..sroa_cast3, align 8 %_11.i.i.i = bitcast [6 x i16]* %x to i8* %_14.i.i.i = bitcast [6 x i16]* %y to i8* %bcmp.i.i.i = call i32 `@bcmp(i8*` nonnull dereferenceable(12) %_11.i.i.i, i8* nonnull dereferenceable(12) %_14.i.i.i, i64 12) #2, !alias.scope !2 %2 = icmp eq i32 %bcmp.i.i.i, 0 ret i1 %2 } ``` ```x86 playground::demo: # `@playground::demo` sub rsp, 32 mov qword ptr [rsp], rdi mov dword ptr [rsp + 8], esi mov qword ptr [rsp + 16], rdx mov dword ptr [rsp + 24], ecx xor rdi, rdx xor esi, ecx or rsi, rdi sete al add rsp, 32 ret ``` After: ```llvm define zeroext i1 `@_ZN4mini4demo17h7a8994aaa314c981E(i96` %0, i96 %1) unnamed_addr #0 { start: %2 = icmp eq i96 %0, %1 ret i1 %2 } ``` ```x86 _ZN4mini4demo17h7a8994aaa314c981E: xor rcx, r8 xor edx, r9d or rdx, rcx sete al ret ```
2021-07-09Auto merge of #86904 - m-ou-se:prelude-collision-check-trait, r=nikomatsakisbors-1/+43
Check FromIterator trait impl in prelude collision check. Fixes #86902.
2021-07-08Add regression testinquisitivecrystal-0/+63
2021-07-09Auto merge of #86869 - sexxi-goose:rfc2229-migration-capture-kind, ↵bors-0/+13
r=nikomatsakis Account for capture kind in auto traits migration Modifies the current auto traits migration for RFC2229 so it takes into account capture kind Closes https://github.com/rust-lang/project-rfc-2229/issues/51 r? `@nikomatsakis`
2021-07-09Auto merge of #86701 - sexxi-goose:optimization, r=nikomatsakisbors-10/+107
2229: Reduce the size of closures with `capture_disjoint_fields` One key observation while going over the closure size profile of rustc was that we are disjointly capturing one or more fields starting at an immutable reference. Disjoint capture over immutable reference doesn't add too much value because the fields can either be borrowed immutably or copied. One possible edge case of the optimization is when a fields of a struct have a longer lifetime than the structure, therefore we can't completely get rid of all the accesses on top of sharef refs, only the rightmost one. Here is a possible example: ```rust struct MyStruct<'a> { a: &'static A, b: B, c: C<'a>, } fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static { let c = || drop(&*m.a.field_of_a); // Here we really do want to capture `*m.a` because that outlives `'static` // If we capture `m`, then the closure no longer outlives `'static' // it is constrained to `'a` } ``` r? `@nikomatsakis`
2021-07-08Bless a UI testScott McMurray-18/+5
2021-07-08Adjust the threshold to look at the ABI, not just the sizeScott McMurray-0/+12
2021-07-08Add another codegen test, array_eq_zeroScott McMurray-0/+9
Showing that this avoids an alloca and private constant.
2021-07-08Stop generating `alloca`s+`memcmp` for simple array equalityScott McMurray-2/+113
2021-07-08Consider capture kind for auto traits migrationRoxane-1/+1
2021-07-08Add new test caseRoxane-0/+13
2021-07-08only check cg defaults wf once instantiatedlcnr-23/+10
2021-07-08Update src/test/ui/rust-2021/future-prelude-collision-unneeded.rsNiko Matsakis-0/+2
2021-07-08Rollup merge of #86913 - Stupremee:document-rustdoc-private-items, r=jyn514Guillaume Gomez-4/+10
Document rustdoc with `--document-private-items` The `tool_doc` macro introduced in #86737 did not use `false` as the default value for `binary` when it is not provided, so the `if` is not even expanded and thus the argument is never provided if the `binary` argument isn't. Resolves #86900 r? ```@Mark-Simulacrum```
2021-07-08Rollup merge of #86903 - GuillaumeGomez:small-header-display, r=Nemo157Guillaume Gomez-6/+1
Fix small headers display You can see it on the `IoSlice` or on the `ErrorKind` pages. Before: ![Screenshot from 2021-07-06 15-26-33](https://user-images.githubusercontent.com/3050060/124610344-b50a8100-de70-11eb-8ab4-ac5de8adf18f.png) ![Screenshot from 2021-07-08 17-51-43](https://user-images.githubusercontent.com/3050060/124953436-7235de00-e015-11eb-9f99-b361c7eb41a9.png) After: ![Screenshot from 2021-07-08 17-48-42](https://user-images.githubusercontent.com/3050060/124953042-12d7ce00-e015-11eb-8132-1ae4552dd969.png) ![Screenshot from 2021-07-08 17-48-47](https://user-images.githubusercontent.com/3050060/124953052-13706480-e015-11eb-89f8-dab96c2f0f63.png) r? `@Nemo157`
2021-07-08Rollup merge of #86838 - lambinoo:I-69630-rust_const_unstable_check_const, ↵Guillaume Gomez-0/+154
r=oli-obk Checking that function is const if marked with rustc_const_unstable Fixes #69630 This one is still missing tests to check the behavior but I checked by hand and it seemed to work. I would not mind some direction for writing those unit tests!
2021-07-08Rollup merge of #84961 - GuillaumeGomez:rework-session-globals, r=oli-obkGuillaume Gomez-23/+28
Rework SESSION_GLOBALS API Fixes #84954. <s>Needs #84953 to be merged first (I cherry-picked its commits to have CI pass).</s> (done) r? ``@Aaron1011``
2021-07-08Fix display of small-section-header elementsGuillaume Gomez-6/+1
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-23/+28
2021-07-08Auto merge of #85363 - EFanZh:gdb-pretty-print-slices, r=michaelwoeristerbors-26/+95
Support pretty printing slices using GDB Support pretty printing `&[T]`, `&mut [T]` and `&mut str` types using GDB. Support pretty printing `&mut [T]` and `&mut str` types using LLDB. Fixes #85219.
2021-07-08Auto merge of #86949 - RalfJung:miri, r=RalfJungbors-8/+8
update Miri Fixes https://github.com/rust-lang/rust/issues/86923 Cc `@rust-lang/miri` r? `@ghost`
2021-07-08fn must be const if marked with stability attributLamb-0/+154
remove trailing newline fix: test with attribute but missing const Update compiler/rustc_passes/src/stability.rs Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com> Add test for extern functions fix: using span_help instead of span_suggestion add test for some ABIs + fmt fix Update compiler/rustc_passes/src/stability.rs Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com> Refractor and add test for `impl const` Add test to make sure no output + cleanup condition ----------------------------- remove stdcall test, failing CI test C abi is already tested in this, so it is not that useful to test another one. The tested code is blind to which specific ABI for now, as long as it's not an intrinsic one
2021-07-08Rollup merge of #86933 - GuillaumeGomez:cleanup-rustdoc-static-files, ↵Yuki Okushi-47/+48
r=Manishearth Clean up rustdoc static files The `html/static` of rustdoc was starting to be quite a mess... So I moved files in sub-folders to make it easier to follow. Here what remains in `html/static` folder: ``` $ ls COPYRIGHT.txt css fonts images js LICENSE-APACHE.txt LICENSE-MIT.txt ``` cc ```@jyn514``` r? ```@Manishearth```
2021-07-08Rollup merge of #86932 - rylev:fix-ice-86895, r=estebankYuki Okushi-0/+11
Fix ICE when misplaced visibility cannot be properly parsed Fixes #86895 The issue was that a failure to parse the visibility was causing the original error to be dropped before being emitted. The resulting error isn't quite as nice as when the visibility is parsed properly, but I'm not sure which error to prioritize here. Displaying both errors might be too confusing. r? ```@estebank```
2021-07-08Rollup merge of #86927 - bjorn3:sync_cg_clif-2021-07-07, r=bjorn3Yuki Okushi-0/+1
Sync rustc_codegen_cranelift The main hightlight this sync is basic support for AArch64. Most things should work on Linux, but there does seem to be an ABI incompatibility causing proc-macros to crash, see https://github.com/bjorn3/rustc_codegen_cranelift/issues/1184. Thanks to ```@afonso360``` for implementing all Cranelift features that were necessary to compile for AArch64 using cg_clif. Also thanks to ```@shamatar``` for implementing the `llvm.x86.addcarry.64` and `llvm.x86.subborrow.64` llvm intrinsics used by num-bigint (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1178) and ```@eggyal``` for implementing multi-threading support for the lazy jit mode. (https://github.com/bjorn3/rustc_codegen_cranelift/pull/1166) r? ```@ghost``` ```@rustbot``` label +A-codegen +A-cranelift +T-compiler
2021-07-08Rollup merge of #86812 - FabianWolff:recover-dyn-mut, r=petrochenkovYuki Okushi-0/+24
Recover from `&dyn mut ...` parse errors Consider this example: ```rust fn main() { let r: &dyn mut Trait; } ``` This currently leads to: ``` error: expected one of `!`, `(`, `;`, `=`, `?`, `for`, lifetime, or path, found keyword `mut` --> src/main.rs:2:17 | 2 | let r: &dyn mut Trait; | ^^^ expected one of 8 possible tokens error: aborting due to previous error ``` However, especially for beginners, I think it is easy to get `&dyn mut` and `&mut dyn` confused. With my changes, I get a help message, and the parser even recovers: ``` error: `mut` must precede `dyn` --> test.rs:2:12 | 2 | let r: &dyn mut Trait; | ^^^^^^^^ help: place `mut` before `dyn`: `&mut dyn` error[E0405]: cannot find trait `Trait` in this scope --> test.rs:2:21 | 2 | let r: &dyn mut Trait; | ^^^^^ not found in this scope error: aborting due to 2 previous errors ```
2021-07-08Rollup merge of #86639 - eholk:lint-tool, r=petrochenkovYuki Okushi-0/+22
Support lint tool names in rustc command line options When rustc is running without a lint tool such as clippy enabled, options for lints such as `clippy::foo` are meant to be ignored. This was already working for those specified by attrs, such as `#![allow(clippy::foo)]`, but this did not work for command line arguments like `-A clippy::foo`. This PR fixes that issue. Note that we discovered this issue while discussing https://github.com/rust-lang/cargo/issues/5034. Fixes #86628.
2021-07-07Cleanup: unify lint name checkingEric Holk-0/+11
This change merges `check_lint_and_tool_name` into `check_lint_name` in order to avoid having two very similar functions. Also adds the `.stderr` file back for the test case, since apparently it is still needed.
2021-07-07Fix test caseEric Holk-12/+1
Previously this was using a `.stderr` file, but that does not seem to work for all cases. This change uses `// error-pattern:` instead.
2021-07-08Ignore Windows debugger pretty-printing testsEFanZh-0/+1
2021-07-07update MiriRalf Jung-8/+8
2021-07-07Clean up rustdoc static filesGuillaume Gomez-47/+48
2021-07-07Document rustdoc with `--document-private-items`Justus K-4/+10
2021-07-07Add generic types to prelude collision lint test.Mara Bos-0/+25
2021-07-07Add test for trait check in prelude collision lint.Mara Bos-1/+16
2021-07-07Fix ICE when misplaced visibility cannot be properly parsedRyan Levick-0/+11
2021-07-07Change linked tracking issue for more qualified pathsRyan Levick-3/+3
2021-07-07Ignore Android debugger pretty-printing testsEFanZh-1/+1