about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2020-08-04Auto merge of #74850 - TimDiekmann:remove-in-place-alloc, r=Amanieubors-17/+11
Remove in-place allocation and revert to separate methods for zeroed allocations closes rust-lang/wg-allocators#58
2020-08-04Rollup merge of #75084 - Aaron1011:stabilize/ident-new-raw, r=petrochenkovYuki Okushi-0/+61
Stabilize Ident::new_raw Tracking issue: #54723 This is a continuation of PR #59002
2020-08-04Rollup merge of #75083 - JohnTitor:follow-up-unused-braces, r=lcnrYuki Okushi-24/+17
Do not trigger `unused_braces` for `while let` Follow-up for #75031 r? @lcnr
2020-08-04Rollup merge of #75056 - Veykril:path_statements_lint, r=oli-obkYuki Okushi-3/+26
Lint path statements to suggest using drop when the type needs drop Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
2020-08-03Auto merge of #74526 - erikdesjardins:reftrack, r=Mark-Simulacrumbors-1/+8
Add track_caller to RefCell::{borrow, borrow_mut} So panic messages point at the offending borrow. Fixes #74472
2020-08-03Stabilize Ident::new_rawAaron Hill-0/+61
Tracking issue: #54723 This is a continuation of PR #59002
2020-08-03Auto merge of #75076 - tmiasko:simplify-goto, r=oli-obkbors-0/+7
Fix change detection in CfgSimplifier::collapse_goto_chain Check that the old target is different from the new collapsed one, before concluding that anything changed. Fixes #75074 Fixes #75051
2020-08-03Do not trigger `unused_braces` for `while let`Yuki Okushi-24/+17
2020-08-03Merge branch 'master' into remove-in-place-allocTim Diekmann-1029/+2018
2020-08-02Auto merge of #74948 - lzutao:stalize-result-as-deref, r=dtolnaybors-45/+3
Stabilize `Result::as_deref` and `as_deref_mut` FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400. This PR stabilizes two new APIs for `std::result::Result`: ```rust fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref; fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut; ``` This PR also removes two rarely used unstable APIs from `Result`: ```rust fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref; fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut; ``` Closes #50264
2020-08-03Fix change detection in CfgSimplifier::collapse_goto_chainTomasz Miąsko-0/+7
Check that the old target is different from the new collapsed one, before concluding that anything changed.
2020-08-02Rollup merge of #75064 - petrochenkov:llvmtarg, r=Mark-SimulacrumManish Goregaokar-0/+3
compiletest: Support ignoring tests requiring missing LLVM components This PR implements a more principled solution to the problem described in https://github.com/rust-lang/rust/pull/66084. Builds of LLVM backends take a lot of time and disk space. So it usually makes sense to build rustc with ```toml [llvm] targets = "X86" experimental-targets = "" ``` unless you are working on some target-specific tasks. A few tests, however, require non-x86 backends to be built. A new test directive `// needs-llvm-components: component1 component2 component3` makes such tests to be automatically ignored if one of the listed components is missing in the provided LLVM (this is determined through `llvm-config --components`). As a result, the test suite now fully passes with LLVM built only with the x86 backend. The component list in this case is ``` aggressiveinstcombine all all-targets analysis asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcerror orcjit passes profiledata remarks runtimedyld scalaropts selectiondag support symbolize tablegen target textapi transformutils vectorize windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray ``` (With the default target list it's much larger.) ``` aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray ``` https://github.com/rust-lang/rust/pull/66084 is also reverted now. r? @Mark-Simulacrum
2020-08-02Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPCManish Goregaokar-5/+5
fix typos Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-08-02Rollup merge of #75031 - JohnTitor:unused-parens-braces-yield, r=lcnrManish Goregaokar-0/+95
Do not trigger `unused_{braces,parens}` lints with `yield` Fixes #74883 r? @lcnr
2020-08-02Lint path statements to use drop for drop typesLukas Wirth-3/+26
2020-08-02Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkovbors-35/+139
Fix ICEs with `@ ..` binding This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken. The diagnostics are verbose though, it fixes three related issues. cc #74954, #74539, and #74702
2020-08-02compiletest: Support ignoring tests requiring missing LLVM componentsVadim Petrochenkov-0/+3
2020-08-03Recover strictness for `yield`Yuki Okushi-7/+59
2020-08-02fix typosliuzhenyu-5/+5
2020-08-02Auto merge of #74210 - estebank:type-ascriptomatic, r=petrochenkovbors-101/+82
Deduplicate `::` -> `:` typo errors Deduplicate errors caused by the same type ascription typo, including ones suggested during parsing that would get reported again during resolve. Fix #70382.
2020-08-02Auto merge of #74785 - euclio:deprecation-kinds, r=petrochenkovbors-733/+733
report kind of deprecated item in message This is important for fields, which are incorrectly referred to as "items".
2020-08-02Do not trigger `unused_{braces,parens}` lints with `yield`Yuki Okushi-0/+43
2020-08-01Auto merge of #74582 - Lezzz:rename-hair, r=nikomatsakisbors-29/+29
Rename HAIR to THIR (Typed HIR). r? @nikomatsakis Originally suggested by @eddyb
2020-08-01Auto merge of #74945 - dingxiangfei2009:promote-static-ref-deref, r=oli-obkbors-0/+34
[mir] Special treatment for dereferencing a borrow to a static definition Fix #70584. As suggested by @oli-obk in this [comment](https://github.com/rust-lang/rust/issues/70584#issuecomment-626009260), one can chase the definition of the local variable being de-referenced and check if it is a true static variable. If that is the case, `validate_place` will admit the promotion. This is my first time to contribute to `rustc`, and I have two questions. 1. A generalization to some extent is applied to decide if the promotion is possible in the static context. In case that there are more projection operations preceding the de-referencing, `validate_place` recursively decent into inner projection operations. I have put thoughts into its correctness but I am not totally sure about it. 2. I have a hard time to find a good place for the test case. This patch has to do with MIR, but this test case would look out of place compared to other tests in `src/test/ui/mir` or `src/test/ui/borrowck` because it does not generate errors while others do. It is tentatively placed in `src/test/ui/statics` for now. Thank you for any comments and suggestions!
2020-08-01Auto merge of #74717 - ↵bors-0/+17
davidtwco:issue-74636-polymorphized-closures-inherited-params, r=oli-obk mir: add `used_generic_parameters_needs_subst` Fixes #74636. This PR adds a `used_generic_parameters_needs_subst` helper function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. This is used in the MIR interpreter to make the check for some pointer casts and for reflection intrinsics more precise. I've opened this as a draft PR because this might not be the approach we want to fix this issue and we have to decide what to do about the reflection case. r? @eddyb cc @lcnr @wesleywiser
2020-08-01Rollup merge of #74991 - JulianKnodt:74199, r=lcnrYuki Okushi-0/+177
Fix Const-Generic Cycle ICE #74199 This PR intends to fix the bug in Issue #74199 by following the suggestion provided of ignoring the error that causes the ICE. This does not fix the underlying cycle detection issue, but fixes the ICE. Also adds a test to check that it doesn't causes an ICE but returns a valid error for now. r? @lcnr Edit: Also it's funny how this PR number is an anagram of the issue number
2020-07-31Rename HAIR to THIR (Typed HIR).Valentin Lazureanu-29/+29
2020-07-31Removed error check in order to prevent ICEkadmin-0/+177
2020-07-31Reduce verbosity of some type ascription errorsEsteban Küber-101/+82
* Deduplicate type ascription LHS errors * Remove duplicated `:` -> `::` suggestion from parse error * Tweak wording to be more accurate * Modify `current_type_ascription` to reduce span wrangling * remove now unnecessary match arm * Add run-rustfix to appropriate tests
2020-07-31interp: needs_subst -> ensure_monomorphic_enoughDavid Wood-0/+17
This commit adds a `ensure_monomorphic_enough` utility function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. `ensure_monomorphic_enough` is then used throughout interpret where `needs_subst` checks previously existed (in particular, for some pointer casts and for reflection intrinsics more precise). Signed-off-by: David Wood <david@davidtw.co>
2020-07-31Add the proper testsDing Xiang Fei-1/+12
2020-07-31Auto merge of #74956 - ecstatic-morse:const-option-unwrap, r=oli-obkbors-0/+34
Make `Option::unwrap` unstably const This is lumped into the `const_option` feature gate (#67441), which enables a potpourri of `Option` methods. cc @rust-lang/wg-const-eval r? @oli-obk
2020-07-31Stabilize as_deref and as_deref on ResultLzu Tao-7/+3
2020-07-31Remove as_deref_err and as_deref_mut_err from ResultLzu Tao-38/+0
2020-07-31Fix ICEs with `@ ..` bindingYuki Okushi-2/+139
2020-07-31Revert "Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern"Yuki Okushi-33/+0
This reverts commit f5e5eb6f46ef2cf0dd45dba4f975305509334fc6.
2020-07-30Test `Option::unwrap` in a const contextDylan MacKenzie-0/+34
2020-07-30Rollup merge of #74934 - nbdd0121:issue-73976, r=ecstatic-morseManish Goregaokar-8/+8
Improve diagnostics when constant pattern is too generic This PR is a follow-up to PR #74538 and issue #73976 When constants queries Layout, TypeId or type_name of a generic parameter, instead of emitting `could not evaluate constant pattern`, we will instead emit a more detailed message `constant pattern depends on a generic parameter`.
2020-07-31Add comments to explain the test case and the special treatmentDing Xiang Fei-1/+9
2020-07-30Auto merge of #73990 - jumbatm:clashing-extern-decl, r=nagisabors-62/+235
Fix incorrect clashing_extern_declarations warnings. Fixes #73735, fixes #73872. Fix clashing_extern_declarations warning for `#[repr(transparent)]` structs and safely-FFI-convertible enums, and not warning for clashes of struct members of different types, but the same size. r? @nagisa
2020-07-30Special treatment for dereferencing a borrow to a static definitionDing Xiang Fei-0/+15
2020-07-30Auto merge of #74930 - ecstatic-morse:const-size-align-of-val, r=oli-obkbors-0/+79
Make `mem::size_of_val` and `mem::align_of_val` unstably const Implements #46571 but does not stabilize it. I wanted this while working on something today. The only reason not to immediately stabilize are concerns around [custom DSTs](https://github.com/rust-lang/rust/issues/46571#issuecomment-387669352). That proposal has made zero progress in the last two years and const eval is rich enough to support pretty much any user-defined `len` function as long as nightly features are allowed (`raw_ptr_deref`). Currently, this raises a `const_err` lint when passed an `extern type`. r? @oli-obk cc @rust-lang/wg-const-eval
2020-07-30Fix missed same-sized member clash in ClashingExternDeclarations.jumbatm-7/+41
2020-07-30Address code review comments.jumbatm-6/+23
- Make `is_repr_nullable_ptr` freestanding again to avoid usage of ImproperCTypesVisitor in ClashingExternDeclarations (and don't accidentally revert the ParamEnv::reveal_all() fix from a week earlier) - Revise match condition for 1 Adt, 1 primitive - Generalise check for non-null type so that it would also work for ranges which exclude any single value (all bits set, for example) - Make is_repr_nullable_ptr return the representable type instead of just a boolean, to avoid adding an additional, independent "source of truth" about the FFI-compatibility of Option-like enums. Also, rename to `repr_nullable_ptr`.
2020-07-30Apply suggested wording changes from code review.jumbatm-4/+4
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-30Don't emit clashing decl lint for FFI-safe enums.jumbatm-1/+61
An example of an FFI-safe enum conversion is when converting Option<NonZeroUsize> to usize. Because the Some value must be non-zero, rustc can use 0 to represent the None variant, making this conversion is safe. Furthermore, it can be relied on (and removing this optimisation already would be a breaking change).
2020-07-30Add additional clashing_extern_decl cases.jumbatm-62/+124
2020-07-30Fix ui testsGary Guo-8/+8
2020-07-29Test `{align,size}_of_val` in a const contextDylan MacKenzie-0/+79
2020-07-29Rollup merge of #74869 - tmiasko:must-use-closures, r=ecstatic-morseManish Goregaokar-31/+333
Make closures and generators a must use types Warn about unused expressions with closure or generator type. This follows existing precedence of must use annotations present on `FnOnce`, `FnMut`, `Fn` traits, which already indirectly apply to closures in some cases, e.g.,: ```rust fn f() -> impl FnOnce() { || {} } fn main() { // an existing warning: unused implementer of `std::ops::FnOnce` that must be used: f(); // a new warning: unused closure that must be used: || {}; } ``` Closes #74691.