about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-07-24Rollup merge of #74491 - xldenis:constant-binop-opt, r=oli-obkManish Goregaokar-3/+102
Optimize away BitAnd and BitOr when possible This PR lets `const_prop` optimize away `a | true == true` , `a & false == false` and `a * 0 = 0`. While I was writing this I've realized that constant propagation misses a lot of opportunities. For example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2a4b45e772f214210a36749b27223bb0 Constant propagation doesn't seem to... propagate constants, additionally the way constant propagation is currently setup makes it tricky to add cases like `a | false == a`. I tried to organize `eval_rvalue_with_identities` to make the pattern of the optimizations easier to see but it still obscurs what should be a simple peephole optmization. cc @oli-obk
2020-07-24Auto merge of #74676 - lcnr:generics-no-sort, r=varkorbors-2/+34
correctly deal with unsorted generic parameters We now stop sorting generic params and instead correctly handle unsorted params in the rest of the compiler. We still restrict const params to come after type params though, so this PR does not change anything which is visible to users. This might slightly influence perf, so let's prevent any unintentional rollups. @bors rollup=never r? @varkor
2020-07-24Add a system for creating diffs across multiple mir optimizations.Oliver Scherer-483/+314
2020-07-24Rollup merge of #74703 - tmandry:issue-74047, r=oli-obkYuki Okushi-0/+29
Fix ICE while building MIR with type errors See https://github.com/rust-lang/rust/issues/74047#issuecomment-663290913 for background. Replacing a binding with `PatKind::Wild` (introduced in #51789 and later refactored in #67439) caused an ICE downstream while building MIR. I noticed that taking this code out no longer triggers the ICEs it was added to prevent. I'm not sure what else changed, or if this change is _correct_, but it does seem to be passing ui tests at least. r? @oli-obk cc @estebank Fixes #74047.
2020-07-24Rollup merge of #74680 - JohnTitor:missing-backticks, r=lcnrYuki Okushi-13/+13
Add missing backticks in diagnostics note
2020-07-24Rollup merge of #74665 - smmalis37:issue-62200, r=davidtwcoYuki Okushi-0/+26
Don't ICE on unconstrained anonymous lifetimes inside associated types. Fixes #62200. The change here is inspired (copied) by how this case is handled on bare fns at https://github.com/rust-lang/rust/blob/e8b55a4ad230ebec762fdfc4f241ba98a98560af/src/librustc_typeck/astconv.rs#L3083-L3106.
2020-07-24Rollup merge of #74623 - lcnr:polymorphize-functions, r=eddybYuki Okushi-0/+13
polymorphize GlobalAlloc::Function this sadly does not change #74614 r? @eddyb
2020-07-24Rollup merge of #74572 - Mark-Simulacrum:unify-rustc-depr, r=petrochenkovYuki Okushi-3/+3
Internally unify rustc_deprecated and deprecated This PR intentionally tries to be "featureless" in that the behavior is not altered for either attribute, though it more clearly exposes cases where that is the case in the code.
2020-07-23Fix ICE while building MIR with type errorsTyler Mandry-0/+29
Fixes #74047.
2020-07-23added a test case for reporting mismatched traitsAyrton-0/+30
2020-07-23Account for trailing closing angle bracketsEsteban Küber-1/+40
2020-07-23Detect turbofish missing surrounding angle bracketsEsteban Küber-0/+17
2020-07-23Auto merge of #74509 - matthewjasper:empty-verify, r=nikomatsakisbors-0/+101
Use `ReEmpty(U0)` as the implicit region bound in typeck Fixes #74429 r? @nikomatsakis
2020-07-23Add missing backticks in diagnostics noteYuki Okushi-13/+13
2020-07-23test usageBastian Kauschke-2/+15
2020-07-23add more complex param order testBastian Kauschke-1/+20
2020-07-23Auto merge of #74667 - Manishearth:rollup-s6k59sw, r=Manishearthbors-20/+36
Rollup of 8 pull requests Successful merges: - #74141 (libstd/libcore: fix various typos) - #74490 (add a Backtrace::disabled function) - #74548 (one more Path::with_extension example, to demonstrate behavior) - #74587 (Prefer constant over function) - #74606 (Remove Linux workarounds for missing CLOEXEC support) - #74637 (Make str point to primitive page) - #74654 (require type defaults to be after const generic parameters) - #74659 (Improve codegen for unchecked float casts on wasm) Failed merges: r? @ghost
2020-07-23add const genericsBastian Kauschke-0/+11
2020-07-23Normalize bounds fully when checking defaulted typesTyler Mandry-0/+25
2020-07-23Rollup merge of #74659 - alexcrichton:wasm-codegen, r=varkorManish Goregaokar-20/+9
Improve codegen for unchecked float casts on wasm This commit improves codegen for unchecked casts on WebAssembly targets to use the singluar `iNN.trunc_fMM_{u,s}` instructions. Previously rustc would codegen a bare `fptosi` and `fptoui` for float casts but for WebAssembly targets the codegen for these instructions is quite large. This large codegen is due to the fact that LLVM can speculate these instructions so the trapping behavior of WebAssembly needs to be protected against in case they're speculated. The change here is to update the codegen for the unchecked cast intrinsics to have a wasm-specific case where they call the appropriate LLVM intrinsic to generate the right wasm instruction. The intrinsic is explicitly opting-in to undefined behavior so a trap here for out-of-bounds inputs on wasm should be acceptable. cc #73591
2020-07-23Rollup merge of #74654 - lcnr:default-no-more, r=varkorManish Goregaokar-0/+27
require type defaults to be after const generic parameters From current discussions it seems like the goal here is for type and const parameters to be unordered and allow things like `struct Foo<const N: usize, T = u32>(T)` and `struct Foo<T, const N: usize = 7>` this way. Note: This means that using `min_const_generics` it will not be possible for an adt to have both type defaults and const parameters. closes #70471 r? @varkor @eddyb
2020-07-23Auto merge of #74611 - Mark-Simulacrum:revert-74069-bad-niche, r=eddybbors-28/+3
Revert "Compare tagged/niche-filling layout and pick the best one" Reverts rust-lang/rust#74069. It caused a performance regression, see https://github.com/rust-lang/rust/pull/74069#issuecomment-662166827. perf: https://perf.rust-lang.org/compare.html?start=d3df8512d2c2afc6d2e7d8b5b951dd7f2ad77b02&end=cfade73820883adf654fe34fd6b0b03a99458a51 r? @eddyb cc @nnethercote
2020-07-22Include the note in the test.Steven Malis-0/+1
2020-07-23tweak wordingBastian Kauschke-1/+1
Co-authored-by: varkor <github@varkor.com>
2020-07-22Don't ICE on unconstrained anonymous lifetimes inside associated types.Steven Malis-0/+25
2020-07-22Rollup merge of #74618 - JohnTitor:no-more-bad-placeholder, r=estebankManish Goregaokar-6/+14
Do not ICE on assoc type with bad placeholder Fixes #74612 r? @estebank
2020-07-22Rollup merge of #74538 - nbdd0121:issue-73976, r=lcnrManish Goregaokar-0/+102
Guard against non-monomorphized type_id intrinsic call This PR checks whether the type is sufficient monomorphized when calling type_id or type_name intrinsics. If the type is not sufficiently monomorphized, e.g. used in a pattern, the code will be rejected. Fixes #73976
2020-07-22Rollup merge of #74460 - dennis-hamester:rustdoc-warn-pub-to-priv, r=jyn514Manish Goregaokar-5/+28
rustdoc: Always warn when linking from public to private items Change the logic such that linking from a public to a private item always triggers `intra_doc_link_resolution_failure`. Previously, the warning was not emitted when `--document-private-items` is passed. This came up during the discussion in https://github.com/rust-lang/rust/pull/74147#discussion_r452597901.
2020-07-22Rollup merge of #73783 - estebank:impl-dyn-trait-static-lifetime, r=nikomatsakisManish Goregaokar-211/+724
Detect when `'static` obligation might come from an `impl` Partly address #71341.
2020-07-22Improve codegen for unchecked float casts on wasmAlex Crichton-20/+9
This commit improves codegen for unchecked casts on WebAssembly targets to use the singluar `iNN.trunc_fMM_{u,s}` instructions. Previously rustc would codegen a bare `fptosi` and `fptoui` for float casts but for WebAssembly targets the codegen for these instructions is quite large. This large codegen is due to the fact that LLVM can speculate these instructions so the trapping behavior of WebAssembly needs to be protected against in case they're speculated. The change here is to update the codegen for the unchecked cast intrinsics to have a wasm-specific case where they call the appropriate LLVM intrinsic to generate the right wasm instruction. The intrinsic is explicitly opting-in to undefined behavior so a trap here for out-of-bounds inputs on wasm should be acceptable. cc #73591
2020-07-22require type defaults to be after const generic parametersBastian Kauschke-0/+27
as if this is currently possible. HA!
2020-07-22Change error code numberEsteban Küber-20/+19
2020-07-22rustdoc: Add explanation when linting against public to private item linksDennis Hamester-0/+4
The additional note helps explaining why the lint was triggered and that --document-private-items directly influences the link resolution.
2020-07-22rustdoc: Always warn when linking from public to private itemsDennis Hamester-5/+24
Change the logic such that linking from a public to a private item always triggers intra_doc_link_resolution_failure. Previously, the warning was not emitted when --document-private-items is passed. Also don't rely anymore on the item's visibility, which would falsely trigger the lint now that the check for --document-private-items is gone.
2020-07-22Auto merge of #74633 - davidtwco:issue-74614-disable-polymorphisation, ↵bors-34/+62
r=wesleywiser Disable polymorphisation Fixes #74614. This PR disables polymorphisation to fix the regression in #74614 after investigation into the issue makes it clear that the fix won't be trivial. ~~I'll file an issue shortly to replace #74614 with the findings so far.~~ #74636 has been filed to track the fix of the underlying regression. r? @eddyb
2020-07-22Handle fully-qualified paths and add test casesEsteban Küber-16/+302
2020-07-22Use `ty::Instance::resolve` to identify `'static` bound sourceEsteban Küber-54/+49
2020-07-22Further tweak wording of E0759 and introduce E0767Esteban Küber-138/+201
2020-07-22Add more context to diagnosticEsteban Küber-4/+32
2020-07-22Increase accuracy of lifetime bound on trait object impl suggestionEsteban Küber-35/+123
2020-07-22Detect when `'static` obligation might come from an `impl`Esteban Küber-107/+161
Address #71341.
2020-07-22Rollup merge of #74528 - euclio:intra-link-errors, r=jyn514Manish Goregaokar-117/+117
refactor and reword intra-doc link errors This commit refactors intra-doc link error reporting to deduplicate code and decouple error construction from the type of error. This greatly improves flexibility at each error construction site, while reducing the complexity of the diagnostic creation. This commit also rewords the diagnostics for clarity and style: - Diagnostics should not end in periods. - It's unnecessary to say "ignoring it". Since this is a warning by default, it's already clear that the link is ignored.
2020-07-22Rollup merge of #74237 - lzutao:compiletest, r=Mark-SimulacrumManish Goregaokar-8/+8
compiletest: Rewrite extract_*_version functions This makes extract_lldb_version has the same version type like extract_gdb_version.
2020-07-22Rollup merge of #73893 - ajpaverd:cfguard-stabilize, r=nikomatsakisManish Goregaokar-5/+5
Stabilize control-flow-guard codegen option This is the stabilization PR discussed in #68793. It converts the `-Z control-flow-guard` debugging option into a codegen option (`-C control-flow-guard`), and changes the associated tests.
2020-07-22Rollup merge of #73655 - JamieCunliffe:jamie_va-args-c, r=nikicManish Goregaokar-0/+65
va_args implementation for AAPCS. Implement the va args in codegen for AAPCS, this will be used as the default va_args implementation for AArch64 rather than the va_args llvm-ir as it currently is. This should fix the following issues: https://github.com/rust-lang/rust/issues/56475 https://github.com/rust-lang/rust/issues/72579
2020-07-22polymorphize GlobalAlloc::FunctionBastian Kauschke-0/+13
2020-07-22tests: add regression test for #74614David Wood-0/+17
This commit adds a regression test for #74614 so that it is fixed before polymorphisation is re-enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-07-22sess: disable polymorphisationDavid Wood-34/+45
This commit disables polymorphisation to resolve regressions related to closures which inherit unused generic parameters and are then used in casts or reflection. Signed-off-by: David Wood <david@davidtw.co>
2020-07-22Optimize away BitAnd and BitOr when possibleXavier Denis-3/+102
2020-07-22const prop into operandsBastian Kauschke-27/+211