summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2020-11-15Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one ↵Mark Rousskov-24/+5
more case"" This reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2. It retains the test added in that commit as a check-pass test, intended to prevent future (unintentional) regressions.
2020-11-07Auto merge of #78146 - Mark-Simulacrum:revert-76605, r=petrochenkovbors-24/+45
[beta] Revert "Promote missing_fragment_specifier to hard error #75516" This reverts "Promote missing_fragment_specifier to hard error #75516" on just beta. I would like us to explore a more principled fix, perhaps along the lines `@petrochenkov` suggested in #76605, on master when we have more time to test it but I don't want us shipping the breakage in the meantime. I don't personally feel comfortable immediately backporting anything more than a revert here. cc `@matklad` This matches #77456 for 1.47 but targets 1.48 (current beta) instead. r? `@petrochenkov`
2020-11-06Tweak `if let` suggestion to be more liberal with suggestion and to not ICEEsteban Küber-12/+28
Fix #77218. Fix #77238.
2020-11-06Do not ICE with TraitPredicates containing [type error]Esteban Küber-0/+59
Fix #77919.
2020-11-06Test with NLL explicitlyYuki Okushi-4/+19
2020-11-06Do not try to report on closures to avoid ICEYuki Okushi-0/+27
2020-11-06revert #75443 update mir validatorBastian Kauschke-27/+0
2020-11-06Do not ICE on invalid inputEsteban Küber-0/+76
2020-11-06Revert "Promote missing_fragment_specifier to hard error"Mark Rousskov-16/+37
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.
2020-11-06Revert "Move macro test to ui/macros"Mark Rousskov-0/+0
This reverts commit 84fcd0dc991e2f5b9035d118d8c016f35ab37d0a.
2020-11-05Add delay_span_bug to no longer ICEkadmin-0/+16
2020-10-20rustc_parse: More precise spans for `tuple.0.0`Vadim Petrochenkov-12/+12
2020-10-08Add regression test for SimplifyBranchSame miscompilationTomasz Miąsko-0/+21
2020-10-03Rollup merge of #77452 - Mark-Simulacrum:fix-symbol-v0, r=eddybJonas Schievink-0/+18
Permit ty::Bool in const generics for v0 mangling This should unbreak using new-symbol-mangling = true in config.toml (once it lands in beta anyway). Fixes #76365 (well, it will, but seems fine to close as soon as we have support) r? @eddyb (for mangling) but I'm okay with some other reviewer too :)
2020-10-03Rollup merge of #77421 - petrochenkov:globtravel, r=nagisaJonas Schievink-5/+39
Revert "resolve: Avoid "self-confirming" import resolutions in one more case" And remove the assert that https://github.com/rust-lang/rust/pull/70236 tried to avoid instead. Closes https://github.com/rust-lang/rust/issues/74556.
2020-10-03Rollup merge of #77251 - dtolnay:drop, r=Aaron1011Jonas Schievink-13/+72
Bypass const_item_mutation if const's type has Drop impl Follow-up to #75573. This PR disables the const_item_mutation lint in cases that the const has a Drop impl which observes the mutation. ```rust struct Log { msg: &'static str } const LOG: Log = Log { msg: "" }; impl Drop for Log { fn drop(&mut self) { println!("{}", self.msg); } } LOG.msg = "wow"; // prints "wow" ``` r? @Aaron1011
2020-10-03Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matkladJonas Schievink-77/+0
Move Wrapping<T> ui tests into library Part of #76268 r? @matklad
2020-10-02Rollup merge of #77444 - estebank:pat-field-label, r=davidtwcoJonas Schievink-6/+14
Fix span for incorrect pattern field and add label Address #73750.
2020-10-02Rollup merge of #77415 - ecstatic-morse:const-checking-async-block, r=oli-obkJonas Schievink-0/+16
Better error message for `async` blocks in a const-context Improves the error message for the case in #77361. r? @oli-obk
2020-10-02Rollup merge of #76811 - GuillaumeGomez:doc-alias-name-restriction, ↵Jonas Schievink-1/+39
r=oli-obk,ollie27 Doc alias name restriction Fixes #76705.
2020-10-02Rollup merge of #76739 - ↵Jonas Schievink-0/+48
davidtwco:issue-75323-non-static-lifetime-in-anonconst, r=varkor resolve: prohibit anon const non-static lifetimes Fixes #75323, fixes #74447 and fixes #73375. This PR prohibits non-static lifetimes in anonymous constants when only the `min_const_generics` feature is enabled. ~~To do so, `to_region_vid`'s `bug!` had to be changed into a delayed bug, which unfortunately required providing it a `TyCtxt`.~~ --- ~~While I am happy with how the implementation of the error turned out in `rustc_passes::check_const`, emitting an error wasn't sufficient to avoid hitting the ICE later. I also tried implementing the error in `rustc_mir::transform::check_consts::validation` and that worked, but it didn't silence the ICE either. To silence the ICE, I changed it to a delayed bug which worked but was more invasive that I would have liked, and required I return an incorrect lifetime. It's possible that this check should be implemented earlier in the compiler to make the invasive changes unnecessary, but I wasn't sure where that would be and wanted to get some feedback first.~~ The approach taken by this PR has been changed to implement the error in name resolution, which ended up being much simpler. cc @rust-lang/wg-const-eval r? @lcnr
2020-10-02Update testsGuillaume Gomez-1/+39
2020-10-02Permit ty::Bool in const generics for v0 manglingMark Rousskov-0/+18
2020-10-02resolve: prohibit anon const non-static lifetimesDavid Wood-0/+48
This commit modifies name resolution to emit an error when non-static lifetimes are used in anonymous constants when the `min_const_generics` feature is enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-10-02Auto merge of #77396 - wesleywiser:disable-simplifyarmidentity, r=oli-obkbors-0/+35
Disable the SimplifyArmIdentity mir-opt The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved. r? `@oli-obk`
2020-10-02Fix span for incorrect pattern field and add labelEsteban Küber-6/+14
2020-10-01Disable the SimplifyArmIdentity mir-optWesley Wiser-0/+35
The optimization still has some bugs that need to be worked out such as #77359. We can try re-enabling this again after the known issues are resolved.
2020-10-02Rollup merge of #77375 - petrochenkov:inherext, r=oli-obkYuki Okushi-8/+24
rustc_metadata: Do not forget to encode inherent impls for foreign types So I tried to move FFI interface for LLVM from `rustc_codegen_llvm` to `rustc_llvm` and immediately encountered this fascinating issue. Fixes https://github.com/rust-lang/rust/issues/46665.
2020-10-02Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnayYuki Okushi-12/+4
Split sys_common::Mutex in StaticMutex and MovableMutex. The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`. 2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`. The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe. --- This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on #76932 for now.)~~ (See #77380.)
2020-10-02Revert "resolve: Avoid "self-confirming" import resolutions in one more case"Vadim Petrochenkov-5/+39
2020-10-01Regression test for case in #77361Dylan MacKenzie-0/+16
2020-10-01Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obkbors-355/+343
Overhaul const-checking diagnostics The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed. However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time. There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`. As always, meant to be reviewed commit-by-commit. r? `@oli-obk`
2020-09-30Warn on method call mutating const, even if it has destructorDavid Tolnay-2/+27
2020-09-30Add test of VEC.push on a constDavid Tolnay-7/+9
2020-09-30Test a type with drop glue but no Drop implDavid Tolnay-13/+33
2020-09-30Add test of const item mutation with Drop implDavid Tolnay-12/+24
2020-10-01Auto merge of #77379 - camelid:improve-wording-crate-resolution-error, ↵bors-2/+2
r=davidtwco Improve wording for external crate resolution error I think it reads better this way.
2020-10-01Rollup merge of #77371 - camelid:remove-extra-space-in-diagnostic, r=varkorDylan DPC-0/+18
Remove trailing space in error message - Add test for error message - Remove trailing space in error message
2020-10-01Rollup merge of #77360 - oli-obk:zst_const_pat_regression, r=RalfJungDylan DPC-0/+9
References to ZSTs may be at arbitrary aligned addresses fixes #77320 r? @RalfJung
2020-10-01Rollup merge of #77343 - varkor:rustc_args_required_const-validation, r=lcnrDylan DPC-0/+74
Validate `rustc_args_required_const` Fixes https://github.com/rust-lang/rust/issues/74608.
2020-10-01Rollup merge of #77324 - Aaron1011:fix/const-item-mutation-ptr, r=petrochenkovDylan DPC-24/+35
Don't fire `const_item_mutation` lint on writes through a pointer Fixes #77321
2020-10-01Rollup merge of #77303 - lcnr:const-evaluatable-TooGeneric, r=oli-obk,varkorDylan DPC-41/+49
const evaluatable: improve `TooGeneric` handling Instead of emitting an error in `fulfill`, we now correctly stall on inference variables. As `const_eval_resolve` returns `ErrorHandled::TooGeneric` when encountering generic parameters on which we actually do want to error, we check for inference variables and eagerly emit an error if they don't exist, returning `ErrorHandled::Reported` instead. Also contains a small bugfix for `ConstEquate` where we previously only stalled on type variables. This is probably a leftover from when we did not yet support stalling on const inference variables. r? @oli-obk cc @varkor @eddyb
2020-10-01Rollup merge of #77153 - Aaron1011:fix/better-recursive-expand, r=petrochenkovDylan DPC-0/+86
Fix recursive nonterminal expansion during pretty-print/reparse check Makes progress towards #43081 In PR #73084, we started recursively expanded nonterminals during the pretty-print/reparse check, allowing them to be properly compared against the reparsed tokenstream. Unfortunately, the recursive logic in that PR only handles the case where a nonterminal appears inside a `TokenTree::Delimited`. If a nonterminal appears directly in the expanded tokens of another nonterminal, the inner nonterminal will not be expanded. This PR fixes the recursive expansion of nonterminals, ensuring that they are expanded wherever they occur.
2020-09-30Improve wording for external crate resolution errorCamelid-2/+2
I think it reads better this way.
2020-09-30Auto merge of #77372 - jonas-schievink:rollup-e5bdzga, r=jonas-schievinkbors-0/+56
Rollup of 12 pull requests Successful merges: - #77037 (more tiny clippy cleanups) - #77233 (BTreeMap: keep an eye out on the size of the main components) - #77280 (Ensure that all LLVM components requested by tests are available on CI) - #77284 (library: Forward compiler-builtins "mem" feature) - #77296 (liveness: Use Option::None to represent absent live nodes) - #77322 (Add unstable book docs for `-Zunsound-mir-opts`) - #77328 (Use `rtassert!` instead of `assert!` from the child process after fork() in std::sys::unix::process::Command::spawn()) - #77331 (Add test for async/await combined with const-generics.) - #77338 (Fix typo in alloc vec comment) - #77340 (Alloc vec use imported path) - #77345 (Add test for issue #74761) - #77348 (Update books) Failed merges: r? `@ghost`
2020-09-30rustc_metadata: Do not forget to encode inherent impls for foreign typesVadim Petrochenkov-8/+24
2020-09-30Rollup merge of #77345 - samlich:test-issue-74761, r=lcnrJonas Schievink-0/+31
Add test for issue #74761 Adds test for and closes #74761 which previously crashed compiler.
2020-09-30Rollup merge of #77331 - hameerabbasi:issue-74906, r=lcnrJonas Schievink-0/+25
Add test for async/await combined with const-generics. Fixes #74906.
2020-09-30Remove trailing space in error messageCamelid-1/+1
2020-09-30Auto merge of #75810 - hug-dev:cmse-nonsecure-entry, r=jonas-schievinkbors-0/+94
Add support for cmse_nonsecure_entry attribute This pull request adds the `cmse_nonsecure_entry` attribute under an unstable feature. I was not sure if it was fine for me to send directly the pull-request or if I should submit a RFC first. I was told on Zulip that it was fine to do so but please close it if I need first submit a RFC or follow another process instead. The `cmse_nonsecure_entry` attribute is a LLVM attribute that will be available in LLVM 11. I plan to rebase on the [upgrade PR](https://github.com/rust-lang/rust/pull/73526) once merged to make this one compile. This attribute modifies code generation of the function as explained [here](https://developer.arm.com/documentation/ecm0359818/latest/) to make it work with the TrustZone-M hardware feature. This feature is only available on `thumbv8m` targets so I created an error for that if one tries to use this attribute for another target. I added this attribute in Rust as any other LLVM attribute are added but since this one is target-dependent I am not sure if it was the best thing to do. Please indicate me if you think of other ways, like isolating target-dependent attributes together. ---------------- Tracking issue: https://github.com/rust-lang/rust/issues/75835