summary refs log tree commit diff
path: root/src/test/ui/consts/rfc-2203-const-array-repeat-exprs
AgeCommit message (Collapse)AuthorLines
2020-12-20make sure [CONST; N] drops N timesRalf Jung-2/+16
2020-12-20add test that repeating non-Copy constants worksRalf Jung-0/+13
2020-09-02pretty: trim paths of unique symbolsDan Aloni-32/+29
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2019-11-22Fix tests for RFC 2203 in a `const`Dylan MacKenzie-29/+44
The previous test was incorrect. `const fn`s are *always* promotable when inside a `const`, so it should pass. The error was caused by a bug in `promote_consts`. I've added a failing test outside a `const` alongside the existing one, which is now run-pass.
2019-07-07tests: Add tests that use const fns.David Wood-0/+39
2019-07-07tests: Update and add tests for RFC 2203.David Wood-32/+96
2019-07-07rustc_mir: Re-use `report_selection_error`.David Wood-12/+22
This commit replaces the new error that was being emitted in NLL type check with a call to `report_selection_error` so that the same trait error as before this PR is emitted.
2019-07-07syntax: Add feature gate.David Wood-3/+4
This commit adds a `const_in_array_repeat_expressions` feature gate and only create `Candidate::Repeat` if it is enabled.
2019-07-07rustc/rustc_mir: Implement RFC 2203.David Wood-0/+312
This commit implements RFC 2203, allowing constants in array repeat expressions. Firstly, the check that the array repeat expression implements `Copy` is removed and re-implemented in `rustc_mir::borrow_check::nll::type_check` by emitting an error when the MIR contains a `Operand::Move` and the type does not implement `Copy`. Next, the `qualify_consts` pass is modified to construct a `Candidate::Repeat` when it would be correct to promote a array repeat expression. Finally, the `promote_consts` pass is modified to promote the candidates previously identified.