about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-10-11Rollup merge of #89471 - nbdd0121:const3, r=fee1-deadMatthias Krüger-8/+38
Use Ancestory to check default fn in const impl instead of comparing idents Fixes https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Const.20trait.20impl.20inside.20macro
2021-10-11Split impl-with-default-fn test into a pass test and a fail testGary Guo-8/+38
2021-10-11Auto merge of #83908 - Flying-Toast:master, r=davidtwcobors-1/+166
Add enum_intrinsics_non_enums lint There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this. I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662). closes #83899
2021-10-11Rollup merge of #89726 - jkugelman:must-use-alloc-constructors, r=joshtriplettGuillaume Gomez-2/+2
Add #[must_use] to alloc constructors Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add. I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular: * The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with. * `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory? Parent issue: #89692 r? ``@joshtriplett``
2021-10-11Add enum_intrinsics_non_enums lintFlying-Toast-1/+166
2021-10-11Auto merge of #89752 - matthiaskrgr:rollup-v4fgmwg, r=matthiaskrgrbors-0/+15
Rollup of 6 pull requests Successful merges: - #89579 (Add regression test for issue 80108) - #89632 (Fix docblock code display on mobile) - #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module) - #89707 (Apply clippy suggestions for std) - #89722 (Fix spelling: Cannonical -> Canonical) - #89736 (Remove unused CSS rule) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-11Rollup merge of #89579 - workingjubilee:regression-test-80108, r=Mark-SimulacrumMatthias Krüger-0/+15
Add regression test for issue 80108 Closes #80108
2021-10-10Auto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simulacrumbors-358/+205
Cleanup src/test/ui/{simd,simd-intrinsic} Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.
2021-10-10Add regression test for issue 80108Jubilee Young-0/+15
2021-10-10Auto merge of #89739 - matthiaskrgr:rollup-kskwqy5, r=matthiaskrgrbors-23/+146
Rollup of 11 pull requests Successful merges: - #88374 (Fix documentation in Cell) - #88713 (Improve docs for int_log) - #89428 (Feature gate the non_exhaustive_omitted_patterns lint) - #89438 (docs: `std::hash::Hash` should ensure prefix-free data) - #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui) - #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse) - #89713 (Fix ABNF of inline asm options) - #89718 (Add #[must_use] to is_condition tests) - #89719 (Add #[must_use] to char escape methods) - #89720 (Add #[must_use] to math and bit manipulation methods) - #89735 (Stabilize proc_macro::is_available) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-10Rollup merge of #89735 - bjorn3:stabilize_proc_macro_is_available, ↵Matthias Krüger-3/+0
r=petrochenkov Stabilize proc_macro::is_available Tracking issue: https://github.com/rust-lang/rust/issues/71436 The FCP for the stabilization of `proc_macro::is_available` has completed.
2021-10-10Rollup merge of #89428 - DevinR528:reachable-featuregate, r=Nadrieril,camelidMatthias Krüger-20/+146
Feature gate the non_exhaustive_omitted_patterns lint Fixes https://github.com/rust-lang/rust/issues/89374 Add the machinery to gate the new `non_exhaustive_omitted_patterns` lint. relates to https://github.com/rust-lang/rust/pull/89105 and https://github.com/rust-lang/rust/pull/89423
2021-10-10Auto merge of #89633 - rhysd:issue-65230, r=petrochenkovbors-18/+47
Show detailed expected/found types in error message when trait paths are the same Fixes #65230. ### Issue solved by this PR ```rust trait T { type U; fn f(&self) -> Self::U; } struct X<'a>(&'a mut i32); impl<'a> T for X<'a> { type U = &'a i32; fn f(&self) -> Self::U { self.0 } } fn main() {} ``` Compiler generates the following note: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `T` found `T` ``` This note is not useful since the expected type and the found type are the same. ### How this PR solve the issue When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref: ``` note: ...so that the types are compatible --> test.rs:10:28 | 10 | fn f(&self) -> Self::U { | ____________________________^ 11 | | self.0 12 | | } | |_____^ = note: expected `<X<'a> as T>` found `<X<'_> as T>` ``` So that a user can notice what was different between the expected one and the found one.
2021-10-10Stabilize proc_macro::is_availablebjorn3-3/+0
2021-10-10Add #[must_use] to alloc constructorsJohn Kugelman-2/+2
2021-10-10Use E0308 instead of E0495 for checking the error message improvementrhysd-47/+19
because previous test does not cause the expected error message when `-Z borrowck=mir`.
2021-10-09Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obkMatthias Krüger-34/+84
make #[target_feature] work with `asm` register classes Fixes #89289
2021-10-09Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obkMatthias Krüger-0/+1
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes #76824 Closes #89623 cc ``@eddyb,`` ``@oli-obk``
2021-10-08Add feature gate to non_exhaustive_omitted_patterns lintDevin Ragotzy-20/+146
Actually add the feature to the lints ui test Add tracking issue to the feature declaration Rename feature gate to non_exhaustive_omitted_patterns_lint Add more omitted_patterns lint feature gate
2021-10-08Rollup merge of #86506 - b-naber:gen_trait_impl_inconsistent, r=jackh726Guillaume Gomez-4/+39
Don't normalize xform_ret_ty during method candidate assembly Fixes https://github.com/rust-lang/rust/issues/85671 Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.
2021-10-08bless warningsEliza Weisman-0/+1
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-10-09Show detailed expected/found types in error message when trait paths are the ↵rhysd-18/+75
same
2021-10-08Auto merge of #89576 - tom7980:issue-89275-fix, r=estebankbors-0/+43
Prevent error reporting from outputting a recursion error if it finds an ambiguous trait impl during suggestions Closes #89275 This fixes the compiler reporting a recursion error during another already in progress error by trying to make a conversion method suggestion and encounters ambiguous trait implementations that can convert a the original type into a type that can then be recursively converted into itself via another method in the trait. Updated OverflowError struct to be an enum so I could differentiate between passes - it's no longer a ZST but I don't think that should be a problem as they only generate when there's an error in compiling code anyway
2021-10-08testsb-naber-4/+39
2021-10-07Rollup merge of #89622 - m-ou-se:debug-assert-2021, r=estebankJubilee-0/+125
Use correct edition for panic in [debug_]assert!(). See https://github.com/rust-lang/rust/issues/88638#issuecomment-915472783
2021-10-07Rollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoeristerJubilee-6/+96
Implement `#[link_ordinal(n)]` Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name. As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL. Part of #58713.
2021-10-07make #[target_feature] work with `asm` register classesasquared31415-34/+84
2021-10-07Auto merge of #89629 - GuillaumeGomez:rollup-s4r8me6, r=GuillaumeGomezbors-10/+133
Rollup of 7 pull requests Successful merges: - #89298 (Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers ) - #89461 (Add `deref_into_dyn_supertrait` lint.) - #89477 (Move items related to computing diffs to a separate file) - #89559 (RustWrapper: adapt for LLVM API change) - #89585 (Emit item no type error even if type inference fails) - #89596 (Make cfg imply doc(cfg)) - #89615 (Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-07Rollup merge of #89585 - nbdd0121:issue-89574, r=estebankGuillaume Gomez-10/+41
Emit item no type error even if type inference fails Fix #89574 The stashed error should be emitted regardless whether ty references error or not.
2021-10-07Rollup merge of #89461 - crlf0710:dyn_upcasting_lint, r=nikomatsakisGuillaume Gomez-0/+41
Add `deref_into_dyn_supertrait` lint. Initial implementation of #89460. Resolves #89190. Maybe also worth a beta backport if necessary. r? `@nikomatsakis`
2021-10-07Rollup merge of #89298 - gcohara:issue89193, r=workingjubileeGuillaume Gomez-0/+51
Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers closes #89193 r? `@workingjubilee`
2021-10-07Auto merge of #89534 - camsteffen:diag-name, r=oli-obkbors-0/+11
Introduce `tcx.get_diagnostic_name` Introduces a "reverse lookup" for diagnostic items. This is mainly intended for `@rust-lang/clippy` which often does a long series of `is_diagnostic_item` calls for the same `DefId`. r? `@oli-obk`
2021-10-07Add tests for panic and [debug_]assert in Rust 2021.Mara Bos-0/+125
2021-10-06Rollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnrManish Goregaokar-0/+29
Add a test for generic_const_exprs Test that const_eval_resolve evaluates consts with unused inference vars in substs r? ``@lcnr``
2021-10-06Rollup merge of #89528 - FabianWolff:issue-89497, r=jackh726Manish Goregaokar-6/+44
Fix suggestion to borrow when casting from pointer to reference Fixes #89497.
2021-10-06Rollup merge of #89501 - Aaron1011:escaping-name-regions, r=davidtwcoManish Goregaokar-39/+188
Note specific regions involved in 'borrowed data escapes' error Fixes #67007 Currently, a 'borrowed data escapes' error does not mention the specific lifetime involved (except indirectly through a suggestion about adding a lifetime bound). We now explain the specific lifetime relationship that failed to hold, which improves otherwise vague error messages.
2021-10-06Rollup merge of #89329 - tmiasko:print-type-sizes-no-fields, r=jackh726Manish Goregaokar-1/+2
print-type-sizes: skip field printing for primitives Fixes #86528.
2021-10-06Bless testsCameron Steffen-0/+11
2021-10-06Auto merge of #89323 - estebank:derive-binop, r=petrochenkovbors-39/+458
Consider unfulfilled obligations in binop errors When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Fix #84515.
2021-10-06testEllen-0/+29
2021-10-06Add regression test for ice 89574Gary Guo-10/+41
2021-10-05Consider unfulfilled obligations in binop errorsEsteban Kuber-39/+458
When encountering a binop where the types would have been accepted, if all the predicates had been fulfilled, include information about the predicates and suggest appropriate `#[derive]`s if possible. Point at trait(s) that needs to be `impl`emented.
2021-10-05Issue 89275 fix and testTom Farmer-0/+43
Issue 89275 fix and test Fix librustdoc OverflowError usage rust tidy run Issue 89275 fix and test
2021-10-05Rollup merge of #89532 - ecstatic-morse:maybe-live-locals-enum, ↵Manish Goregaokar-0/+32
r=oli-obk,tmiasko Document behavior of `MaybeLiveLocals` regarding enums and field-senstivity This arose from a [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/MaybeLiveLocals.20and.20Discriminants) where a new contributor attempted to implement a dead-store elimination pass using this analysis. They ran into a nasty hack around `SetDiscriminant` the effect of which is to lets handle assignments of literals to enum-typed locals (e.g. `x = Some(4)`) correctly. This took me a while to figure out. Document this oddity, so the next person will have an easier time, and add a test to enshrine the current behavior. r? ``@tmiasko``
2021-10-05Rollup merge of #89523 - Aaron1011:derive-future-compat, r=wesleywiserManish Goregaokar-0/+72
Make `proc_macro_derive_resolution_fallback` a future-breakage lint When `cargo report future-incompatibilities` is stabilized (see #71249), this will cause dependencies that trigger this lint to be included in the report.
2021-10-05Rollup merge of #89442 - GuillaumeGomez:duplicated-doc-alias, r=estebankManish Goregaokar-0/+33
Add check for duplicated doc aliases r? ``@estebank``
2021-10-05Rollup merge of #89317 - JulianKnodt:precise_errors, r=BoxyUwUManish Goregaokar-9/+17
Move generic error message to separate branches This decomposes an error message in generic constants into more specific branches, for better readability. r? ``@lcnr``
2021-10-05Rollup merge of #88871 - FabianWolff:issue-88403, r=jackh726Manish Goregaokar-0/+60
Fix suggestion for nested struct patterns Fixes #88403, and also a similar problem where the unused binding is in a function parameter pattern.
2021-10-05Rollup merge of #88706 - ThePuzzlemaker:issue-88609, r=jackh726Manish Goregaokar-0/+19
Normalize associated type projections when checking return type of main This fixes #88609. Previously, the return type of `fn main()` would not have any associated type projections within normalized before checking if it implements the standard library trait `std::process::Termination`. This commit appears to fix it. This feels vaguely symptomatic of a problem in the underlying trait solving engine, but I am not sure how I would solve that. I am unsure why the example in #88609 with `assert_impl_termination` and `fn foo()` work, but simply `fn main()` doesn't. The way that I solved this is also probably not the best way to do this, so please let me know if there is a better way to do this. I have added a build-pass regression test for this issue.
2021-10-05Note specific regions involved in 'borrowed data escapes' errorAaron Hill-39/+188
Fixes #67007 Currently, a 'borrowed data escapes' error does not mention the specific lifetime involved (except indirectly through a suggestion about adding a lifetime bound). We now explain the specific lifetime relationship that failed to hold, which improves otherwise vague error messages.