about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-05-24Suggest adding a semicolon to a closure without blockChayim Refael Friedman-0/+27
This transforms `|| expr` into `|| { expr; }`.
2022-05-24Modify MIR building to drop `foo` in `[foo; 0]`Jakob Degen-0/+164
2022-05-24Add support for embedding pretty printers via the `#[debugger_visualizer]` ↵ridwanabdillahi-81/+242
attribute. Add tests for embedding pretty printers and update documentation. Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run. Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section. Respond to PR comments and update documentation.
2022-05-24Update messagesOli Scherer-4/+4
2022-05-24Make a test independent of 64/32 bitOli Scherer-14/+4
2022-05-24Add the transmute and asm checks to typeck as deferred checksOli Scherer-263/+572
2022-05-24macros: introduce `fluent_messages` macroDavid Wood-0/+109
Adds a new `fluent_messages` macro which performs compile-time validation of the compiler's Fluent resources (i.e. that the resources parse and don't multiply define the same messages) and generates constants that make using those messages in diagnostics more ergonomic. For example, given the following invocation of the macro.. ```ignore (rust) fluent_messages! { typeck => "./typeck.ftl", } ``` ..where `typeck.ftl` has the following contents.. ```fluent typeck-field-multiply-specified-in-initializer = field `{$ident}` specified more than once .label = used more than once .label-previous-use = first use of `{$ident}` ``` ...then the macro parse the Fluent resource, emitting a diagnostic if it fails to do so, and will generate the following code: ```ignore (rust) pub static DEFAULT_LOCALE_RESOURCES: &'static [&'static str] = &[ include_str!("./typeck.ftl"), ]; mod fluent_generated { mod typeck { pub const field_multiply_specified_in_initializer: DiagnosticMessage = DiagnosticMessage::fluent("typeck-field-multiply-specified-in-initializer"); pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage = DiagnosticMessage::fluent_attr( "typeck-field-multiply-specified-in-initializer", "previous-use-label" ); } } ``` When emitting a diagnostic, the generated constants can be used as follows: ```ignore (rust) let mut err = sess.struct_span_err( span, fluent::typeck::field_multiply_specified_in_initializer ); err.span_default_label(span); err.span_label( previous_use_span, fluent::typeck::field_multiply_specified_in_initializer_label_previous_use ); err.emit(); ``` Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-24trait selection errors should poison the typeck results, too, so that const ↵Oli Scherer-10/+17
eval can avoid running at all
2022-05-24Emit weird lint name lints after expansionest31-30/+195
Previously, we were emitting weird name lints (for renamed or unknown lints) before expansion, most importantly before cfg expansion. This meant that the weird name lints would not fire for lint attributes hidden inside cfg_attr. The same applied for lint level specifications of those lints. By moving the lints for the lint names to the post-expansion phase, these issues are resolved.
2022-05-24Rollup merge of #97298 - compiler-errors:if-else-stmt-braces, r=davidtwcoDylan DPC-0/+90
Parse expression after `else` as a condition if followed by `{` Fixes #49361. Two things: 1. This wording needs help. I can never find a natural/intuitive phrasing when I write diagnostics :sweat_smile: 2. Do we even want to show the "wrap in braces" case? I would assume most of the time the "add an `if`" case is the right one.
2022-05-24Add GUI test for click on setting textGuillaume Gomez-2/+8
2022-05-24Add flag for stricter checks on uninit/zeroed5225225-6/+38
2022-05-24RFC3239: Add tests for compact `cfg(target(..))`Loïc BRANSTETT-0/+152
2022-05-24add and update testsb-naber-2/+25
2022-05-24Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obkbors-77/+79
Refactor call terminator to always include destination place In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things. cc `@RalfJung` `@eddyb` who were involved in the original conversation r? rust-lang/mir-opt
2022-05-24Auto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitorbors-0/+155
Rollup of 5 pull requests Successful merges: - #97240 (Typo suggestion for a variable with a name similar to struct fields) - #97289 (Lifetime variance fixes for clippy) - #97290 (Turn on `fast_submodules` unconditionally) - #97336 (typo) - #97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-23Parse expression after `else` as a condition if followed by `{`Michael Goulet-0/+90
2022-05-24Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, ↵Yuki Okushi-0/+155
r=compiler-errors Typo suggestion for a variable with a name similar to struct fields closes #97133
2022-05-24Auto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrumbors-5/+4
Disallow compare-mode=nll test differences This ensures that new tests don't get added not as revisions if they have nll output. This will make stabilization PR easier. r? `@Mark-Simulacrum`
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-77/+79
2022-05-23Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddlebors-0/+3
rustdoc: Remove fields_stripped fields (and equivalents) Fixes #90588. r? `@camelid`
2022-05-23rustc: Fix ICE in native library error reportingVadim Petrochenkov-0/+11
2022-05-23Fix precise field capture of univariant enumsTomasz Miąsko-0/+27
When constructing a MIR from a THIR field expression, introduce an additional downcast projection before accessing a field of an enum. When rebasing a place builder on top of a captured place, account for the fact that a single HIR enum field projection corresponds to two MIR projection elements: a downcast element and a field element.
2022-05-23Rollup merge of #97309 - JohnTitor:issue-90400, r=compiler-errorsDylan DPC-0/+106
Add some regression tests for #90400 This adds two regression tests taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836. Note that we cannot close the issue right now as the [original code](https://github.com/rust-lang/rust/issues/90400#issue-1039577786) still triggers an ICE. r? `@compiler-errors`
2022-05-23add typo suggestions for all `AssocSuggestion` variantsTakayuki Maeda-4/+104
2022-05-23Add some regression tests for #90400Yuki Okushi-0/+106
2022-05-23Rollup merge of #97303 - compiler-errors:arg-typos, r=jackh726Dylan DPC-1/+26
Fix some typos in arg checking algorithm Fixes #97197 Also fixes a typo where if we're missing args A, B, C, we actually say A, B, B
2022-05-23Rollup merge of #97271 - JohnTitor:issue-91949, r=compiler-errorsDylan DPC-0/+55
Add regression test for #91949 Closes #91949 This needs `build-fail` because the original bug only appeared with `cargo build`. r? `@compiler-errors`
2022-05-23Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillotDylan DPC-23/+1
Remove feature: `crate` visibility modifier FCP completed in #53120.
2022-05-22Fix some typos in arg checking algorithmMichael Goulet-1/+26
2022-05-22Do writeback of child expressions before parent expressionMichael Goulet-5/+42
2022-05-22Disallow non-same compare-mode-nllJack Huey-5/+4
2022-05-23Auto merge of #96455 - dtolnay:writetmp, r=m-ou-sebors-0/+70
Make write/print macros eagerly drop temporaries This PR fixes the 2 regressions in #96434 (`println` and `eprintln`) and changes all the other similar macros (`write`, `writeln`, `print`, `eprint`) to match the old pre-#94868 behavior of `println` and `eprintln`. argument position | before #94868 | after #94868 | after this PR --- |:---:|:---:|:---: `write!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat: `write!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat: `writeln!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat: `writeln!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat: `print!("…", $tmp)` | :rage: | :rage: | :smiley_cat: `println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat: `eprint!("…", $tmp)` | :rage: | :rage: | :smiley_cat: `eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat: `panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat: Example of code that is affected by this change: ```rust use std::sync::Mutex; fn main() { let mutex = Mutex::new(0); print!("{}", mutex.lock().unwrap()) /* no semicolon */ } ``` You can see several real-world examples like this in the Crater links at the top of #96434. This code failed to compile prior to this PR as follows, but works after this PR. ```console error[E0597]: `mutex` does not live long enough --> src/main.rs:5:18 | 5 | print!("{}", mutex.lock().unwrap()) /* no semicolon */ | ^^^^^^^^^^^^--------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... 6 | } | - | | | `mutex` dropped here while still borrowed | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard` ```
2022-05-22Add test of temporaries inside format_args of core/std macrosDavid Tolnay-0/+70
2022-05-22Use revisions for NLL in lifetimesJack Huey-145/+398
2022-05-22Use revisions for NLL in suggestionsJack Huey-93/+330
2022-05-22Use revisions for NLL in issuesJack Huey-78/+159
2022-05-22Use revisions for NLL in hrtbJack Huey-71/+95
2022-05-22Use revisions for NLL in traitsJack Huey-26/+110
2022-05-22Use revisions for NLL in async-awaitJack Huey-31/+76
2022-05-22Use revisions or ignore-compare-mode-nll for NLL in generic-associated-typesJack Huey-44/+26
2022-05-22Use revisions for NLL in generatorJack Huey-24/+39
2022-05-22Use revisions for NLL in various directoriesJack Huey-120/+180
2022-05-22Use revisions for NLL in object-lifetimeJack Huey-35/+67
2022-05-22Use revisions for NLL in borrowckJack Huey-26/+121
2022-05-22Use revisions for NLL in const-generics and matchJack Huey-14/+30
2022-05-22Use revisions for NLL in closuresJack Huey-18/+36
2022-05-22Use revisions for NLL in associated-typesJack Huey-130/+280
2022-05-22Use revisions for NLL in nllJack Huey-41/+48
2022-05-22Use revisions for NLL in impl-traitJack Huey-45/+65