about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2019-12-02syntax: Introduce a struct `MacArgs` for macro argumentsVadim Petrochenkov-6/+6
2019-12-02Correct other tests related to const_mut_refsChristian Poveda-7/+16
2019-12-01Miri core engine: use throw_ub instead of throw_panicRalf Jung-191/+37
2019-11-30Rollup merge of #66870 - tmiasko:simplify-ty, r=oli-obkMazdak Farrokhzad-0/+20
SimplifyArmIdentity only for locals with the same type Fixes #66856 Fixes #66851
2019-11-29Bless ui test for libstd reformatDavid Tolnay-2/+2
2019-11-29SimplifyArmIdentity only for locals with the same typeTomasz Miąsko-0/+20
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-28Deduplicate type param constraint suggestion codeEsteban Küber-2/+2
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-3/+39
2019-11-27Simplify `mem_categorization`Matthew Jasper-23/+3
* `Place` is no longer recursive. * The `cmt` type alias is removed * `Upvar` places no longer include the dereferences of the environment closure or of by reference captures. * All non-dereference projections are combined to a single variant. * Various unnecessary types and methods have been removed.
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-21/+3
Various tweaks to diagnostic output
2019-11-25Tweak move error due to non-CopyEsteban Küber-21/+3
2019-11-25Auto merge of #66682 - estebank:fn-type-err, r=davidtwcobors-8/+8
Highlight parts of fn in type errors When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each. Examples: <img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png"> <img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png"> <img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png"> <img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
2019-11-23Highlight parts of fn in type errorsEsteban Küber-8/+8
When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each.
2019-11-23Rollup merge of #66539 - estebank:let-ty, r=CentrilMazdak Farrokhzad-16/+38
Point at type in `let` assignment on type errors Fix #61067.
2019-11-23Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obkbors-79/+2
Enable `if` and `match` in constants behind a feature flag This PR is an initial implementation of #49146. It introduces a `const_if_match` feature flag and does the following if it is enabled: - Allows `Downcast` projections, `SwitchInt` terminators and `FakeRead`s for matched places through the MIR const-checker. - Allows `if` and `match` expressions through the HIR const-checker. - Stops converting `&&` to `&` and `||` to `|` in `const` and `static` items. As a result, the following operations are now allowed in a const context behind the feature flag: - `if` and `match` - short circuiting logic operators (`&&` and `||`) - the `assert` and `debug_assert` macros (if the `const_panic` feature flag is also enabled) However, the following operations remain forbidden: - `while`, `loop` and `for` (see #52000) - the `?` operator (calls `From::from` on its error variant) - the `assert_eq` and `assert_ne` macros, along with their `debug` variants (calls `fmt::Debug`) This PR is possible now that we use dataflow for const qualification (see #64470 and #66385). r? @oli-obk cc @rust-lang/wg-const-eval @eddyb
2019-11-22Rollup merge of #66587 - matthewjasper:handle-static-as-const, r=oli-obkMazdak Farrokhzad-9/+9
Handle statics in MIR as const pointers This is the first PR towards the goal of removing `PlaceBase::Static`. In this PR: * Statics are lowered to dereferencing a const pointer. * The temporaries holding such pointers are tracked in MIR, for the most part this is only used for diagnostics. There are two exceptions: * The borrow checker has some checks for thread-locals that directly use this data. * Const checking will suppress "cannot dereference raw pointer" diagnostics for pointers to `static mut`/`extern static`. This is to maintain the current behaviour (12 tests fail otherwise). The following are left to future PRs (I think that @spastorino will be working on the first 3): * Applying the same treatments to promoted statics. * Removing `PlaceBase::Static`. * Replacing `PlaceBase` with `Local`. * Moving the ever growing collection of metadata that we have for diagnostics in MIR passes somewhere more appropriate. r? @oli-obk
2019-11-22Rollup merge of #66183 - Centril:empty-vis-trait-decl, r=petrochenkovMazdak Farrokhzad-6/+7
*Syntactically* permit visibilities on trait items & enum variants Fixes #65041 Suppose we have `$vis trait_item` or `$vis enum_variant` and `$vis` is a `:vis` macro fragment. Before this PR, this would fail to parse. This is now instead allowed as per language team consensus in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. (See added tests for elaboration.) Moreover, we now also permit visibility modifiers on trait items & enum variants *syntactically* but reject them with semantic checks (in `ast_validation`): ```rust #[cfg(FALSE)] trait Foo { pub fn bar(); } // OK #[cfg(FALSE)] enum E { pub U } // OK ```
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-16/+38
2019-11-21Reorganize, bless and add tests for const control flowDylan MacKenzie-79/+2
This creates a new test directory, `ui/consts/control-flow` to hold tests related to control flow in a const context. It also blesses all existing tests with the new error messages, and adds new tests for the `const_if_match` feature.
2019-11-21Bless remaining test outputMatthew Jasper-9/+9
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-427/+289
Specific labels when referring to "expected" and "found" types
2019-11-20Rollup merge of #66535 - estebank:issue-62480, r=matthewjasperMazdak Farrokhzad-0/+18
Avoid ICE when `break`ing to an unreachable label Fix #62480.
2019-11-20Auto merge of #66392 - estebank:trait-alias-ice, r=eddybbors-0/+29
Do not ICE on trait aliases with missing obligations Fix #65673.
2019-11-19Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomezMazdak Farrokhzad-0/+1
Add explanation message for E0641 Part of #61137
2019-11-19Rollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPCMazdak Farrokhzad-1/+5
Add long error explanation for E0594 Part of #61137. r? @Dylan-DPC
2019-11-19Auto merge of #66206 - PotHix:master, r=estebankbors-2/+2
Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]` The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank Ref: #61286.
2019-11-18Avoid ICE when `break`ing to an unreachable labelEsteban Küber-0/+18
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+14
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-18Surround types with backticks in type errorsEsteban Küber-86/+86
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-153/+15
2019-11-18review comments: tweak prefix stringsEsteban Küber-49/+49
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-240/+240
2019-11-18Update ui testsGuillaume Gomez-1/+5
2019-11-17review commentsEsteban Küber-1/+1
2019-11-17Do not ICE on trait aliases with missing obligationsEsteban Küber-0/+29
2019-11-16Update ui testsclemencetbk-0/+1
2019-11-15Cleaned up unused labelsBart Massey-1/+1
Deleted unused labels from compiler and fixed or allowed unused labels in tests. This patch removes some gratuitous unused labels and turns off the warning for unused labels that are a necessary part of tests. This will permit setting the `unused_labels` lint to `warn`.
2019-11-15Rollup merge of #66388 - estebank:melt-ice, r=CentrilYuki Okushi-0/+33
Do not ICE on recovery from unmet associated type bound obligation Fix #66353. r? @Centril
2019-11-14Auto merge of #66314 - GuillaumeGomez:move-error-codes, r=Centrilbors-0/+2
Move error codes Works towards #66210. r? @Centril Oh btw, for the ones interested, I used this python script to get all error codes content sorted into one final file: <details> ```python from os import listdir from os.path import isdir, isfile, join def get_error_codes(error_codes, f_path): with open(f_path) as f: short_mode = False lines = f.read().split("\n") i = 0 while i < len(lines): line = lines[i] if not short_mode and line.startswith("E0") and line.endswith(": r##\""): error = line error += "\n" i += 1 while i < len(lines): line = lines[i] error += line if line.endswith("\"##,"): break error += "\n" i += 1 error_codes["long"].append(error) elif line == ';': short_mode = True elif short_mode is True and len(line) > 0 and line != "}": error_codes["short"].append(line) while i + 1 < len(lines): line = lines[i + 1].strip() if not line.startswith("//"): break parts = line.split("//") if len(parts) < 2: break if parts[1].strip().startswith("E0"): break error_codes["short"][-1] += "\n" error_codes["short"][-1] += lines[i + 1] i += 1 i += 1 def loop_dirs(error_codes, cur_dir): for entry in listdir(cur_dir): f = join(cur_dir, entry) if isfile(f) and entry == "error_codes.rs": get_error_codes(error_codes, f) elif isdir(f) and not entry.startswith("librustc_error_codes"): loop_dirs(error_codes, f) def get_error_code(err): x = err.split(",") if len(x) < 2: return err x = x[0] if x.strip().startswith("//"): x = x.split("//")[1].strip() return x.strip() def write_into_file(error_codes, f_path): with open(f_path, "w") as f: f.write("// Error messages for EXXXX errors. Each message should start and end with a\n") f.write("// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and\n") f.write("// use `gq` to wrap paragraphs. Use `:set tw=0` to disable.\n\n") f.write("syntax::register_diagnostics! {\n\n") error_codes["long"].sort() for i in error_codes["long"]: f.write(i) f.write("\n\n") f.write(";\n") error_codes["short"] = sorted(error_codes["short"], key=lambda err: get_error_code(err)) for i in error_codes["short"]: f.write(i) f.write("\n") f.write("}\n") error_codes = { "long": [], "short": [] } loop_dirs(error_codes, "src") write_into_file(error_codes, "src/librustc_error_codes/src/error_codes.rs") ``` </details> And to move the error codes into their own files: <details> ```python import os try: os.mkdir("src/librustc_error_codes/error_codes") except OSError: print("Seems like folder already exist, moving on!") data = '' with open("src/librustc_error_codes/error_codes.rs") as f: x = f.read().split('\n') i = 0 short_part = False while i < len(x): line = x[i] if short_part is False and line.startswith('E0') and line.endswith(': r##"'): err_code = line.split(':')[0] i += 1 content = '' while i < len(x): if x[i] == '"##,': break content += x[i] content += '\n' i += 1 f_path = "src/librustc_error_codes/error_codes/{}.md".format(err_code) with open(f_path, "w") as ff: ff.write(content) data += '{}: include_str!("./error_codes/{}.md"),'.format(err_code, err_code) elif short_part is False and line == ';': short_part is True data += ';\n' else: data += line data += '\n' i += 1 with open("src/librustc_error_codes/error_codes.rs", "w") as f: f.write(data) ``` </details>
2019-11-14Fix ui tests with better error code usageGuillaume Gomez-0/+2
2019-11-14Auto merge of #66378 - rkruppe:revert-pr-65134, r=pnkfelixbors-6/+0
Revert #65134 To stop giving people on nightly reasons to `allow(improper_ctypes)` while tweaks to the lint are being prepared. cc #66220
2019-11-14Rollup merge of #66253 - ↵Yuki Okushi-0/+1
ohadravid:improve-errors-after-re-rebalance-coherence, r=estebank Improve errors after re rebalance coherence Following #65247, I noticed that some error messages should be updated to reflect the changes of `re_rebalance_coherence` (also there was a [note](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html#teaching-users) in the RFC about it). First, error message `E0210` was updated to match the RFC, and I also tried to improve a little the error when the "order" of types is problematic. For code like this: ``` #![feature(re_rebalance_coherence)] // Now stable struct Wrap<T>(T); impl<T> From<Wrap<T>> for T { fn from(x: Wrap<T>) -> T { x.0 } } ``` The old error was: ``` error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`) --> src/lib.rs:5:6 | 5 | impl<T> From<Wrap<T>> for T { | ^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter ``` and the new error is: ``` error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`) --> main.rs:66:6 | 66 | impl<T> From<Wrap<T>> for T { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`) | = note: implementing a foreign trait is only possible if at least one of the types for which is it implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last ``` I tried to point at the uncovered `T`, but couldn't get something which was reliable (but I'll be happy to try if someone points me in the right direction). r? @estebank cc @nikomatsakis Fixes #65247
2019-11-13Do not ICE on recovery from unmet associated type bound obligationEsteban Küber-0/+33
2019-11-13Bless const tests with improved diagnosticsDylan MacKenzie-30/+73
2019-11-13Revert "Auto merge of #65134 - ↵Robin Kruppe-6/+0
davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, r=rkruppe" This reverts commit 3f0e16473de5ec010f44290a8c3ea1d90e0ad7a2, reversing changes made to 61a551b4939ec1d5596e585351038b8fbd0124ba.
2019-11-13Rollup merge of #66331 - JohnTitor:add-tests, r=CentrilYuki Okushi-0/+108
Add some tests for fixed ICEs Closes #30904 (fixed between nightly-2019-07-14 and nightly-2019-07-31) Closes #40231 (example 1 is fixed in 1.32.0, example 2 is fixed in 1.38.0) Closes #52432 (fixed in rustc 1.40.0-beta.1 (76b40532a 2019-11-05)) Closes #63279 (fixed in rustc 1.40.0-nightly (246be7e1a 2019-10-25)) r? @Centril
2019-11-13Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPCYuki Okushi-1/+2
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
2019-11-13Add test for issue-40231Yuki Okushi-0/+108
2019-11-11Auto merge of #66213 - tmiasko:mandatory-error-warn, r=petrochenkovbors-23/+13
Make error and warning annotations mandatory in UI tests This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations. Fixes #55596.
2019-11-11syntactically allow visibility on trait item & enum variantMazdak Farrokhzad-6/+7