about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
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.
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-5/+5
Rename fn_has_self_argument to fn_has_self_parameter Rename AssocItemKind::Method to AssocItemKind::Fn Refine has_no_input_arg Refine has_no_input_arg Revert has_no_input_arg Refine suggestion_descr Move as_def_kind into AssocKind Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> Fix tidy check issue Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-13Auto merge of #71105 - Dylan-DPC:rollup-nezezxr, r=Dylan-DPCbors-1/+1
Rollup of 5 pull requests Successful merges: - #70656 (Improve scrollbar display in rustdoc) - #71051 (Suggest .into() over try_into() when it would work) - #71087 (Remove `FnCtxt::impl_self_ty`) - #71097 (Pattern docs) - #71101 (Miri: let machine hook dynamically decide about alignment checks) Failed merges: r? @ghost
2020-04-13Auto merge of #70989 - eddyb:mir-opt-32-pr-ci, r=Mark-Simulacrumbors-0/+1
ci: run mir-opt tests on PR CI also as 32-bit (for `EMIT_MIR_FOR_EACH_BIT_WIDTH`). Background: #69916 and [`src/test/mir-opt/README.md`](https://github.com/rust-lang/rust/blob/master/src/test/mir-opt/README.md): > By default 32 bit and 64 bit targets use the same dump files, which can be problematic in the presence of pointers in constants or other bit width dependent things. In that case you can add > > ``` > // EMIT_MIR_FOR_EACH_BIT_WIDTH > ``` > > to your test, causing separate files to be generated for 32bit and 64bit systems. However, if you change the output of such a test (intentionally or not), or if you add a test and it varies between 32-bit and 64-bit platforms, you have to run this command (for a x64 linux host): `./x.py test --stage 1 --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu --bless src/test/mir-opt` Otherwise, bors trying to merge the PR will fail, since we test 32-bit targets there. But we don't on PR CI, which means there's no way the PR author would know (unless they were burnt by this already and know what to look for). This PR resolves that by running `mir-opt` tests for ~~`i686-unknown-linux-gnu`~~, on PR CI. **EDIT**: switched to `armv5te-unknown-linux-gnueabi` to work around LLVM 7 crashes (see https://github.com/rust-lang/compiler-builtins/pull/311#issuecomment-612270089), found during testing. cc @rust-lang/wg-mir-opt @rust-lang/infra
2020-04-13Remove `FnCtxt::impl_self_ty`Yuki Okushi-1/+1
2020-04-12fix issue 69130David Renshaw-0/+28
2020-04-12Auto merge of #69926 - RoccoDev:master, r=estebank,varkorbors-8/+21
rustc: Add a warning count upon completion This adds a `build completed with one warning/x warnings` message, similar to the already present `aborted due to previous error` message.
2020-04-11rustc: Add a warning count upon completionRoccoDev-8/+21
2020-04-11tests: add missing `// no-system-llvm` annotation to #69841 test.Eduard-Mihai Burtescu-0/+1
2020-04-11Rollup merge of #70982 - ldm0:fncoerce, r=eddybMazdak Farrokhzad-0/+14
Normalize function signature in function casting check procedure Fixes #54094 ```rust trait Zoo { type X; } impl Zoo for u16 { type X = usize; } fn foo(abc: <u16 as Zoo>::X) {} fn main() { let x: *const u8 = foo as _; } ``` Currently a `FnDef` need to be checked if it's able to cast to `FnPtr` before it is actually casted. But the signature of `FnPtr` target's associated types are not normalized: https://github.com/rust-lang/rust/blob/96d77f0e5f103612d62b85938aacfb33f5768433/src/librustc_typeck/check/cast.rs#L536-L553 However, during the coercion check, the signature of `FnPtr` target's associated types are normalized (The `<u16 as Zoo>::X` turns into `usize`). https://github.com/rust-lang/rust/blob/96d77f0e5f103612d62b85938aacfb33f5768433/src/librustc_typeck/check/coercion.rs#L687-L729 This inconsistency leads to the error:`Err(Sorts(ExpectedFound { expected: <u16 as Zoo>::X, found: usize }))`.
2020-04-10Rollup merge of #69745 - estebank:predicate-obligations-3, r=nikomatsakis,eddybMazdak Farrokhzad-19/+38
Use `PredicateObligation`s instead of `Predicate`s Keep more information about trait binding failures. Use more specific spans by pointing at bindings that introduce obligations. Subset of #69709. r? @eddyb
2020-04-10Tidy fixDonough Liu-1/+1
2020-04-10Rollup merge of #70784 - estebank:suggest-type-fundamental-method, ↵Mazdak Farrokhzad-2/+16
r=matthewjasper Consider methods on fundamental `impl` when method is not found on numeric type Fix #47759.
2020-04-10Normalize function signature in function casting checkDonough Liu-0/+14
2020-04-09Consider methods on fundamental `impl` when method is not found on numeric typeEsteban Küber-2/+16
Fix #47759.