about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2020-05-06Rollup merge of #71727 - hbina:simplified_usage, r=Mark-SimulacrumDylan DPC-2/+2
SipHasher with keys initialized to 0 should just use new() I believe that is what the `new()` is for, for good reasons.
2020-05-05Rollup merge of #71894 - mibac138:semicolon-not-always-helpful, r=estebankDylan DPC-3/+0
Suggest removing semicolon in last expression only if it's type is known Fixes #67971 Is there a syntax for explicitly checking if a note doesn't exist in test output? Something like `//~ !NOTE ...` I believe r? @estebank deals with diagnostics.
2020-05-05Suggest removing semicolon in last expression only if it's type is knownmibac138-3/+0
2020-05-05Rollup merge of #71902 - mibac138:const-feature-diag, r=varkorDylan DPC-0/+2
Suggest to add missing feature when using gated const features Fixes #71797
2020-05-05Rollup merge of #71711 - Mark-Simulacrum:deignore-tests, r=nikomatsakisDylan DPC-13/+0
Updates to some ignored tests This removes or fixes some ignored test cases. cc #13745
2020-05-04Suggest to add missing feature when using gated const featuresmibac138-0/+2
2020-05-04Auto merge of #71108 - estebank:suggest-proj-type-mismatch-constraint, r=oli-obkbors-22/+4
On type mismatch involving associated type, suggest constraint When an associated type is found when a specific type was expected, if possible provide a structured suggestion constraining the associated type in a bound. ``` error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type ... LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) | ^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9 | LL | qux(x.func()) | ^^^^^^^^ expected `usize`, found associated type | = note: expected type `usize` found associated type `<impl Trait as Trait>::A` help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize` | LL | fn foo(x: impl Trait<A = usize>) { | ^^^^^^^^^^ ``` Fix #71035. Related to #70908.
2020-05-02When a projection is expected, suggest constraining or calling methodEsteban Küber-2/+4
2020-05-02On type mismatch involving associated type, suggest constraintEsteban Küber-20/+0
When an associated type is found when a specific type was expected, if possible provide a structured suggestion constraining the associated type in a bound. ``` error[E0271]: type mismatch resolving `<T as Foo>::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); | ^^^^^^ expected `i32`, found associated type ... LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } | ----- required by this bound in `want_y` | = note: expected type `i32` found associated type `<T as Foo>::Y` help: consider constraining the associated type `<T as Foo>::Y` to `i32` | LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T) | ^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9 | LL | qux(x.func()) | ^^^^^^^^ expected `usize`, found associated type | = note: expected type `usize` found associated type `<impl Trait as Trait>::A` help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize` | LL | fn foo(x: impl Trait<A = usize>) { | ^^^^^^^^^^ ```
2020-05-02Replace convenient function `remove_prefix()` with `replace_prefix()`Donough Liu-2/+0
2020-05-02Suggestion for immutable reference -> mutable pointer should be emittedDonough Liu-2/+1
as `Applicability::Unspecified`
2020-05-02Suggest deref when coercing `ty::Ref` to `ty::RawPtr` with arbitraryDonough Liu-2/+224
mutability
2020-05-01SipHasher::new() is literally with SipHasher with both keys being 0Hanif Bin Ariffin-2/+2
2020-04-30Remove unsized enum testMark Rousskov-13/+0
This was already tested (at least) by src/test/ui/unsized/unsized-enum2.rs
2020-04-30Rollup merge of #71540 - ldm0:ref2ptr, r=oli-obkDylan DPC-0/+122
Suggest deref when coercing `ty::Ref` to `ty::RawPtr` Fixes #32122 Currently we do autoderef when casting `ty::Ref` ->`ty::Ref`, but we don't autoderef when casting `ty::Ref` -> `ty::RawPtr`. This PR make the compiler suggests deref when coercing `ty::Ref` to `ty::RawPtr`
2020-04-30Rollup merge of #71205 - NeoRaider:check_attr, r=jonas-schievinkDylan DPC-4/+13
rustc: fix check_attr() for methods, closures and foreign functions This fixes an issue that previously turned up for methods in https://github.com/rust-lang/rust/pull/69274, but also exists for closures and foreign function: `check_attr` does not call `codegen_fn_attrs()` for these types when it should, meaning that incorrectly used function attributes are not diagnosed without codegen. The issue affects our UI tests, as they run with `--emit=metadata` by default, but as it turns out, this is not the only case: Function attributes are not checked on any dead code without this fix! This makes the fix a **breaking change**. The following very silly Rust programs compiles fine on stable Rust when it should not, which is fixed by this PR. ```rust fn main() { #[target_feature(enable = "sse2")] || {}; } ``` I assume any real-world program which may trigger this issue would at least emit a dead code warning, but of course that is no guarantee that such code does not exist... Fixes #70307
2020-04-29Suggest deref when coercing `ty::Ref` to `ty::RawPtr`Donough Liu-0/+122
2020-04-28Bless test that no longer warnsDylan MacKenzie-1/+1
2020-04-28Add tests from #67088 and the issues mentioned in its descriptionDylan MacKenzie-16/+0
2020-04-27Rollup merge of #71419 - contrun:wrong-namespace-rustc-resolve, r=petrochenkovDylan DPC-0/+15
add message for resolution failure because wrong namespace closes https://github.com/rust-lang/rust/issues/71406
2020-04-27Rollup merge of #71409 - estebank:point-at-ret-question-mark-op, r=petrochenkovDylan DPC-0/+2
Point at the return type on `.into()` failure caused by `?` Fix #35946.
2020-04-26Point at the return type on `.into()` failure caused by `?`Esteban Küber-0/+2
Fix #35946.
2020-04-26use defkind.descr in wrong namespace resolve failureYI-3/+3
2020-04-26Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddybDylan DPC-2/+2
Add all remaining `DefKind`s. r? @eddyb or @Centril ~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~ ~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
2020-04-25Rollup merge of #71330 - ecstatic-morse:const-qualif-lazy, r=oli-obkDylan DPC-27/+106
Only run dataflow for const qualification if type-based check would fail This is the optimization discussed in https://github.com/rust-lang/rust/issues/49146#issuecomment-614012476. We wait for `Qualif::in_any_value_of_ty` to return `true` before running dataflow. For bodies that deal mostly with primitive types, this will avoid running dataflow at all during const qualification. This also removes the `BitSet` used to cache `in_any_value_of_ty` for each local, which was only necessary for an old version of #64470 that also handled promotability.
2020-04-25Rollup merge of #69456 - contrun:fix-misleading-compiler-error, r=estebankDylan DPC-0/+47
fix misleading type annotation diagonstics This solves the method call part of issue https://github.com/rust-lang/rust/issues/69455
2020-04-24Remove redundant `descr`/`descriptive_variant` methods from HIR.Eduard-Mihai Burtescu-2/+2
2020-04-24Rollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morseDylan DPC-3/+15
Tweak `'static` suggestion code Fix #71196.
2020-04-24Rollup merge of #71426 - contrun:fix-e0751-explanation, r=estebankDylan DPC-3/+3
fix error code in E0751.md reference: https://github.com/rust-lang/rust/issues/71304
2020-04-23Cycle errors now occur during const-eval, not checkingDylan MacKenzie-27/+106
2020-04-23fix error code for E0751YI-3/+3
2020-04-22Rollup merge of #71256 - cuviper:must_use_replace, r=estebankDylan DPC-0/+1
Lint must_use on mem::replace This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
2020-04-22Tweak wordingEsteban Küber-3/+3
2020-04-22Tweak `'static` suggestion codeEsteban Küber-3/+15
Fix #71196.
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-10/+1
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-22add message for resolution failure because wrong namespaceYI-0/+15
2020-04-20Ensure tail expression will have a `Ty` for E0746Esteban Küber-6/+3
When the return type is `!Sized` we look for all the returned expressions in the body to fetch their types and provide a reasonable suggestion. The tail expression of the body is normally evaluated after checking whether the return type is `Sized`. Changing the order of the evaluation produces undesirable knock down effects, so we detect the specific case that newcomers are likely to encounter ,returning a single bare trait object, and only in that case we evaluate the tail expression's type so that the suggestion will be accurate.
2020-04-20Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't returnEsteban Küber-6/+18
During development, a function could have a return type set that is a bare trait object by accident. We already suggest using either a boxed trait object or `impl Trait` if the return paths will allow it. We now do so too when there are *no* return paths or they all resolve to `!`. We still don't handle cases where the trait object is *not* the entirety of the return type gracefully.
2020-04-19allow(unused_must_use) in issue-23611-enum-swap-in-drop.rsJosh Stone-1/+2
2020-04-18Add label to item source of bound obligationEsteban Küber-8/+8
2020-04-18Do not emit note for projected derived obligationsEsteban Küber-4/+0
2020-04-18Remove `AssocTypeBound` and propagate bound `Span`sEsteban Küber-12/+9
2020-04-18Maintain chain of derived obligationsEsteban Küber-0/+5
When evaluating the derived obligations from super traits, maintain a reference to the original obligation in order to give more actionable context in the output.
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-10/+1
2020-04-17Fix unused results from mem::replaceJosh Stone-1/+1
2020-04-16ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.Eduard-Mihai Burtescu-64/+11
2020-04-16rustc: fix check_attr() for methods, closures and foreign functionsMatthias Schiffer-4/+13
UI tests are updated with additional error messages that were missing before.
2020-04-14typeck: always expose repeat count `AnonConst`s' parent in `generics_of`.Eduard-Mihai Burtescu-5/+7
2020-04-14typeck: workaround WF hole in `to_const`.Eduard-Mihai Burtescu-1/+10
2020-04-14typeck: track any errors injected during writeback and taint tables ↵Eduard-Mihai Burtescu-2/+54
appropriately.