summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-01-05Remove portable_simdMark Rousskov-86/+0
Stand-in for a backport of "Sync portable-simd to remove autosplats #91484".
2022-01-05Add test with `#[rustc_evaluate_where_clauses]`Wesley Wiser-0/+150
As suggested via reviewer feedback.
2022-01-05Fix HashStable implementation on InferTyMichael Goulet-0/+17
2021-11-29Don't treat unnormalized function arguments as well-formedjackh726-30/+49
2021-11-26Auto merge of #91253 - matthiaskrgr:rollup-dnlcjmr, r=matthiaskrgrbors-0/+27
Rollup of 4 pull requests Successful merges: - #91169 (Change cg_ssa's get_param to borrow the builder mutably) - #91176 (If the thread does not get the lock in the short term, yield the CPU) - #91212 (Fix ICE due to out-of-bounds statement index when reporting borrowck error) - #91225 (Fix invalid scrollbar display on source code page) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-26Rollup merge of #91212 - compiler-errors:issue91206, r=oli-obkMatthias Krüger-0/+27
Fix ICE due to out-of-bounds statement index when reporting borrowck error Replace an `[index]` with a `.get` when `statement_index` points to a basic-block terminator (and is therefore out-of-bounds in the statements list). Fixes #91206 Cc ``@camsteffen`` r? ``@oli-obk``
2021-11-26Auto merge of #91164 - Badel2:usefulness-stack-overflow, r=davidtwcobors-0/+14
Fix stack overflow in `usefulness.rs` Fix #88747 Applied the suggestion from `@nbdd0121,` not sure if this has any drawbacks. The first call to `ensure_sufficient_stack` is not needed to fix the test case, but I added it to be safe.
2021-11-26Auto merge of #91205 - Aaron1011:visit_param_env, r=lcnrbors-16/+24
Visit `param_env` field in Obligation's `TypeFoldable` impl This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-26Auto merge of #85102 - estebank:point-at-assignment, r=oli-obkbors-95/+124
Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
2021-11-25Auto merge of #91037 - c410-f3r:testsssssss, r=petrochenkovbors-0/+0
Move some tests to more reasonable directories - 10 cc #73494 r? `@petrochenkov`
2021-11-25Visit `param_env` field in Obligation's `TypeFoldable` implAaron Hill-16/+24
This oversight appears to have gone unnoticed for a long time without causing issues, but it should still be fixed.
2021-11-25Account for type obligation coming from `const` and `static`Esteban Kuber-3/+4
2021-11-25On type mismatch caused by assignment, point at assigneeEsteban Küber-96/+124
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
2021-11-25Add test demonstrating no more ICEMichael Goulet-0/+27
2021-11-25Rollup merge of #91185 - camelid:rm-force-overflow-checks, r=wesleywiserMatthias Krüger-3/+3
Remove `-Z force-overflow-checks` It was replaced several years ago by the stable option `-C overflow-checks`. The goal was to delete the `-Z` flag once users had migrated [1]. Now that it's been several years, it makes sense to delete the old flag. See also the discussion on Zulip [2]. [1]: https://github.com/rust-lang/rust/issues/33134#issuecomment-280484097 [2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224 r? ```@wesleywiser``` cc ```@RalfJung```
2021-11-25Rollup merge of #91111 - cjgillot:hir-no-lower-attrs, r=michaelwoeristerMatthias Krüger-19/+60
Do not visit attributes in `ItemLowerer`. By default, AST visitors visit expressions that appear in key-value attributes. Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code. Since an attribute cannot produce meaningful HIR, just skip them altogether. Fixes https://github.com/rust-lang/rust/issues/81886 Fixes https://github.com/rust-lang/rust/issues/90873 r? `@michaelwoerister`
2021-11-25Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebankMatthias Krüger-64/+64
Print associated types on opaque `impl Trait` types This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future. before: ``` error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32` ``` after: ``` error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32` ``` --- Questions: 1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary? 2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later.. 3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back? 4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that? r? ````@estebank````
2021-11-25Rollup merge of #89359 - fee1-dead:const-it, r=oli-obkMatthias Krüger-0/+71
Various fixes for const_trait_impl A few problems I found while making `Iterator` easier to const-implement. 1. More generous `~const Drop` check. We check for nested fields with caller bounds. For example, an ADT type with fields of types `A`, `B`, `C`, check if all of them are either: - Bounded (`A: ~const Drop`, `B: Copy`) - Known to be able to destruct at compile time (`C = i32`, `struct C(i32)`, `C = some_fn`) 2. Don't treat trait functions marked with `#[default_method_body_is_const]` as stable const fns when checking `const_for` and `const_try` feature gates. I think anyone can review this, so no r? this time.
2021-11-25Move some tests to more reasonable directoriesCaio-0/+0
2021-11-25Auto merge of #88781 - estebank:emoji-idents, r=oli-obkbors-0/+99
Tokenize emoji as if they were valid identifiers In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors. Partially address #86102.
2021-11-25Auto merge of #85346 - estebank:issue-84946, r=nagisa,varkorbors-0/+62
Account for incorrect `impl Foo<const N: ty> {}` syntax Fix #84946
2021-11-25Do not visit attributes in `LateResolutionVisitor`.Camille GILLOT-22/+28
2021-11-24Tweak span and add more testsEsteban Kuber-4/+38
2021-11-24Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelidGuillaume Gomez-18/+42
Create rustdoc_internals feature gate As suggested by ``@camelid`` [here](https://github.com/rust-lang/rust/pull/90398#issuecomment-955093851), since `doc_keyword` and `doc_primitive` aren't meant to be stabilized, we could put them behind a same feature flag. This is pretty much what it would look like (needs to update the tests too). The tracking issue is https://github.com/rust-lang/rust/issues/90418. What do you think ``@rust-lang/rustdoc`` ?
2021-11-24Add test for merged featuresGuillaume Gomez-0/+24
2021-11-24Update error message for doc(keyword)Guillaume Gomez-2/+2
2021-11-24Add feature gate test for "rustdoc_internal" featureGuillaume Gomez-0/+17
2021-11-24Create rustdoc_internals feature gateGuillaume Gomez-18/+1
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-0/+28
Fix #84946
2021-11-24Remove `-Z force-overflow-checks`Noah Lev-3/+3
It was replaced several years ago by the stable option `-C overflow-checks`. The goal was to delete the `-Z` flag once users had migrated [1]. Now that it's been several years, it makes sense to delete the old flag. See also the discussion on Zulip [2]. [1]: https://github.com/rust-lang/rust/issues/33134#issuecomment-280484097 [2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224
2021-11-24Allow features like const_try in d_m_b_i_cDeadbeef-0/+51
2021-11-24Allow more cases to match ~const Drop.Deadbeef-0/+20
2021-11-23Fix stack overflow in `usefulness.rs`Badel2-0/+14
2021-11-23Do not visit attributes in `ItemLowerer`.Camille GILLOT-0/+35
By default, AST visitors visit expressions that appear in key-value attributes. Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code. Since an attribute cannot produce meaningful HIR, just skip them altogether.
2021-11-23Auto merge of #91159 - matthiaskrgr:rollup-91mgg5v, r=matthiaskrgrbors-22/+90
Rollup of 6 pull requests Successful merges: - #90856 (Suggestion to wrap inner types using 'allocator_api' in tuple) - #91103 (Inhibit clicks on summary's children) - #91137 (Give people a single link they can click in the contributing guide) - #91140 (Split inline const to two feature gates and mark expression position inline const complete) - #91148 (Use `derive_default_enum` in the compiler) - #91153 (kernel_copy: avoid panic on unexpected OS error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-23Sort `FxHashSet`'s contents before emitting errors for consistent outputEsteban Kuber-20/+20
2021-11-23review comment: plural of emoji is emojiEsteban Kuber-12/+12
2021-11-23Account for confusable codepoints when recovering emoji identifiersEsteban Kuber-4/+16
2021-11-23fix fmtEsteban Kuber-1/+0
2021-11-23Replace ZWJ with nothing in terminal outputEsteban Kuber-2/+2
2021-11-23Tokenize emoji as if they were valid indentifiersEsteban Kuber-0/+88
In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors.
2021-11-23Fix printing unit return ty, don't elaborate FnOnce unless we see itMichael Goulet-16/+16
2021-11-23Update test outputsMichael Goulet-65/+65
2021-11-23Rollup merge of #91140 - nbdd0121:const_typeck, r=oli-obkMatthias Krüger-22/+32
Split inline const to two feature gates and mark expression position inline const complete This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete. I think I have resolved most outstanding issues related to `inline_const` with #89561 and other PRs. The only thing left that I am aware of is #90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in #89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another. ``@rustbot`` label: T-compiler F-inline_const
2021-11-23Rollup merge of #90856 - ↵Matthias Krüger-0/+58
ken-matsui:suggestion-to-wrap-vec-allocator-api-in-tuple, r=davidtwco Suggestion to wrap inner types using 'allocator_api' in tuple This PR provides a suggestion to wrap the inner types in tuple when being along with 'allocator_api'. Closes https://github.com/rust-lang/rust/issues/83250 ```rust fn main() { let _vec: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api' } ``` ```diff error[E0658]: use of unstable library feature 'allocator_api' --> $DIR/suggest-vec-allocator-api.rs:2:23 | LL | let _vec: Vec<u8, _> = vec![]; - | ^ + | ----^ + | | + | help: consider wrapping the inner types in tuple: `(u8, _)` | = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information = help: add `#![feature(allocator_api)]` to the crate attributes to enable ```
2021-11-23Auto merge of #90788 - ecstatic-morse:issue-90752, r=wesleywiserbors-0/+96
Mark places as initialized when mutably borrowed Fixes the example in #90752, but does not handle some corner cases involving raw pointers and unsafe. See [this comment](https://github.com/rust-lang/rust/issues/90752#issuecomment-965822895) for more information, or the second test. Although I talked about both `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` in #90752, this PR only changes the latter. That's because "maybe uninitialized" is the conservative choice, and marking them as definitely initialized (`!maybe_uninitialized`) when a mutable borrow is created could lead to problems if `addr_of_mut` to an uninitialized local is allowed. Additionally, places cannot become uninitialized via a mutable reference, so if a place is definitely initialized, taking a mutable reference to it should not change that. I think it's correct to ignore interior mutability as nbdd0121 suggests below. Their analysis doesn't work inside of `core::cell`, which *does* have access to `UnsafeCell`'s field, but that won't be an issue unless we explicitly instantiate one with an `enum` within that module. r? `@wesleywiser`
2021-11-24Suggestion to wrap inner types using `allocator_api` in tupleKen Matsui-0/+58
2021-11-22`#![feature(inline_const)]` is no longer incompleteGary Guo-11/+4
2021-11-22Split inline const to two feature gatesGary Guo-11/+28
2021-11-22add rustc option for using LLVM stack smash protectionBenjamin A. Bjørnseth-0/+130
LLVM has built-in heuristics for adding stack canaries to functions. These heuristics can be selected with LLVM function attributes. This patch adds a rustc option `-Z stack-protector={none,basic,strong,all}` which controls the use of these attributes. This gives rustc the same stack smash protection support as clang offers through options `-fno-stack-protector`, `-fstack-protector`, `-fstack-protector-strong`, and `-fstack-protector-all`. The protection this can offer is demonstrated in test/ui/abi/stack-protector.rs. This fills a gap in the current list of rustc exploit mitigations (https://doc.rust-lang.org/rustc/exploit-mitigations.html), originally discussed in #15179. Stack smash protection adds runtime overhead and is therefore still off by default, but now users have the option to trade performance for security as they see fit. An example use case is adding Rust code in an existing C/C++ code base compiled with stack smash protection. Without the ability to add stack smash protection to the Rust code, the code base artifacts could be exploitable in ways not possible if the code base remained pure C/C++. Stack smash protection support is present in LLVM for almost all the current tier 1/tier 2 targets: see test/assembly/stack-protector/stack-protector-target-support.rs. The one exception is nvptx64-nvidia-cuda. This patch follows clang's example, and adds a warning message printed if stack smash protection is used with this target (see test/ui/stack-protector/warn-stack-protector-unsupported.rs). Support for tier 3 targets has not been checked. Since the heuristics are applied at the LLVM level, the heuristics are expected to add stack smash protection to a fraction of functions comparable to C/C++. Some experiments demonstrating how Rust code is affected by the different heuristics can be found in test/assembly/stack-protector/stack-protector-heuristics-effect.rs. There is potential for better heuristics using Rust-specific safety information. For example it might be reasonable to skip stack smash protection in functions which transitively only use safe Rust code, or which uses only a subset of functions the user declares safe (such as anything under `std.*`). Such alternative heuristics could be added at a later point. LLVM also offers a "safestack" sanitizer as an alternative way to guard against stack smashing (see #26612). This could possibly also be included as a stack-protection heuristic. An alternative is to add it as a sanitizer (#39699). This is what clang does: safestack is exposed with option `-fsanitize=safe-stack`. The options are only supported by the LLVM backend, but as with other codegen options it is visible in the main codegen option help menu. The heuristic names "basic", "strong", and "all" are hopefully sufficiently generic to be usable in other backends as well. Reviewed-by: Nikita Popov <nikic@php.net> Extra commits during review: - [address-review] make the stack-protector option unstable - [address-review] reduce detail level of stack-protector option help text - [address-review] correct grammar in comment - [address-review] use compiler flag to avoid merging functions in test - [address-review] specify min LLVM version in fortanix stack-protector test Only for Fortanix test, since this target specifically requests the `--x86-experimental-lvi-inline-asm-hardening` flag. - [address-review] specify required LLVM components in stack-protector tests - move stack protector option enum closer to other similar option enums - rustc_interface/tests: sort debug option list in tracking hash test - add an explicit `none` stack-protector option Revert "set LLVM requirements for all stack protector support test revisions" This reverts commit a49b74f92a4e7d701d6f6cf63d207a8aff2e0f68.