about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-07-27Fix process-spawn-nonexistent on WSLNilstrieb-5/+7
If appendWindowsPath is set to true (the default IIRC), running invalid commands returns PermissionDenied instead of NotFound.
2022-07-27add tests and commentouz-a-0/+15
2022-07-27lint: add bad opt access internal lintDavid Wood-0/+42
Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`. Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted. A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-27Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obkYuki Okushi-194/+164
Add `Self: ~const Trait` to traits with `#[const_trait]` r? `@oli-obk`
2022-07-27Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obkYuki Okushi-21/+20
Check that RPITs constrained by a recursive call in a closure are compatible Fixes #99073 Adapts a similar visitor pattern to `find_opaque_ty_constraints` (that we use to check TAITs), but with some changes: 0. Only walk the "OnlyBody" children, instead of all items in the RPIT's defining scope 1. Only walk through the body's children if we found a constraining usage 2. Don't actually do any inference, just do a comparison and error if they're mismatched ---- r? `@oli-obk` -- you know all this impl-trait stuff best... is this the right approach? I can explain the underlying issue better if you'd like, in case that might reveal a better solution. Not sure if it's possible to gather up the closure's defining usages of the RPIT while borrowck'ing the outer function, that might be a better place to put this check...
2022-07-27use check_region_obligations_and_report_errors in more places to avoid ICEsMichael Goulet-0/+27
2022-07-27Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, ↵Yuki Okushi-10/+10
r=compiler-errors passes: port more of `check_attr` module Continues from #99213. Port more diagnostics in `rustc_passes::check_attr` to using the diagnostic derive and translation machinery. r? `@compiler-errors`
2022-07-27Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomezYuki Okushi-0/+1
Add a clickable link to the layout section The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
2022-07-27Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillotYuki Okushi-0/+69
Prefer visibility map parents that are not `doc(hidden)` first Far simpler approach to #98876. This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
2022-07-27Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by ↵est31-14/+7
default
2022-07-26Fix vectorcallDaniel Paoliello-24/+134
2022-07-26Auto merge of #99574 - durin42:allocator-patch-redux, r=nikicbors-0/+183
codegen: use new {re,de,}allocator annotations in llvm This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. r? `@nikic`
2022-07-26Check that we do not ICE when anonymous lifetimes appear in AnonConst.Camille GILLOT-0/+24
Fixes #98932.
2022-07-26Rollup merge of #99758 - WaffleLapkin:remove_useless_allow, r=Dylan-DPCMatthias Krüger-1/+0
remove useless `#[allow]` in a test The mentioned issue, https://github.com/rust-lang/rust/issues/54586 was fixed 4 years ago :)
2022-07-26Rollup merge of #99235 - ↵Matthias Krüger-0/+10
WaffleLapkin:rustdoc_implement_support_for_must_implement, r=GuillaumeGomez rustdoc: Add support for `#[rustc_must_implement_one_of]` This PR adds support for `#[rustc_must_implement_one_of]` attribute added in #92164. There is a desire to eventually use this attribute of `Read`, so making it show up in docs is a good thing. I "stole" the styling from cfg notes, not sure what would be a proper styling. Currently it looks like this: ![2022-07-14_15-00](https://user-images.githubusercontent.com/38225716/178968170-913c1dd5-8875-4a95-9848-b075a0bb8998.png) <details><summary>Code to reproduce</summary> <p> ```rust #![feature(rustc_attrs)] #[rustc_must_implement_one_of(a, b)] pub trait Trait { fn req(); fn a(){ Self::b() } fn b(){ Self::a() } } ``` </p> </details>
2022-07-26Fix diagnostics for unfulfilled obligationsDeadbeef-19/+1
2022-07-26bless tests, remove nonexistent E0395Deadbeef-194/+182
2022-07-26codegen: use new {re,de,}allocator annotations in llvmAugie Fackler-0/+183
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes #90032. [This comment](https://github.com/rust-lang/rust/issues/24194#issuecomment-308791157) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.
2022-07-26Improve error message for unstable default bodyMaybe Waffle-7/+13
2022-07-26Add tests for `#[rustc_default_body_unstable]`Maybe Waffle-0/+119
2022-07-26Lib kind -l link-arg:Daniil Belov-8/+67
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
2022-07-26Simplify testest31-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-07-26remove useless `#[allow]` in a testMaybe Waffle-1/+0
2022-07-26Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-deadDylan DPC-24/+24
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
2022-07-26Rollup merge of #99739 - nnethercote:rm-E0133, r=Dylan-DPCDylan DPC-8/+8
Remove erroneous E0133 code from an error message. This error message is about `derive` and `packed`, but E0133 is for "Unsafe code was used outside of an unsafe function or block". r? ``@estebank``
2022-07-26Rollup merge of #99692 - RalfJung:too-far, r=oli-obkDylan DPC-22/+103
interpret, ptr_offset_from: refactor and test too-far-apart check We didn't have any tests for the "too far apart" message, and indeed that check mostly relied on the in-bounds check and was otherwise probably not entirely correct... so I rewrote that check, and it is before the in-bounds check so we can test it separately.
2022-07-26Rollup merge of #99666 - compiler-errors:issue-99663, r=lcnrDylan DPC-1/+45
Restore `Opaque` behavior to coherence check Fixes #99663. This broke in 84c3fcd2a0285c06a682c9b064640084e4c7271b. I'm not exactly certain that adding this behavior back is necessarily correct, but at least the UI test I provided may stimulate some thoughts. I think delaying a bug here is certainly not correct in the case of opaques -- if we want to change coherence behavior for opaques, then we should at least be emitting a new error. r? ``@lcnr``
2022-07-26Rollup merge of #99618 - compiler-errors:uhh-idk, r=lcnrDylan DPC-43/+2
handle consts with param/infer in `const_eval_resolve` better This PR addresses [this thread here](https://github.com/rust-lang/rust/pull/99449#discussion_r924141230). Was this the change you were looking for ``@lcnr?`` Interestingly, one test has begun to pass. Was that expected? r? ``@lcnr``
2022-07-26Check that RPITs constrained by a recursive call in a closure are compatibleMichael Goulet-21/+20
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-0/+307
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-24/+24
2022-07-26Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitorbors-49/+139
Rollup of 7 pull requests Successful merges: - #98211 (Implement `fs::get_path` for FreeBSD.) - #99353 (Slightly improve mismatched GAT where clause error) - #99593 (Suggest removing the tuple struct field for the unwrapped value) - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`) - #99711 (Remove reachable coverage without counters) - #99718 (Avoid `&str`/`Symbol` to `String` conversions) - #99720 (Sync rustc_codegen_cranelift) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-26Rollup merge of #99711 - tmiasko:coverage, r=wesleywiserYuki Okushi-17/+31
Remove reachable coverage without counters Remove reachable coverage without counters to maintain invariant that either there is no coverage at all or there is a live coverage counter left that provides the function source hash. The motivating example would be a following closure: ```rust let f = |x: bool| { debug_assert!(x); }; ``` Which, with span changes from #93967, with disabled debug assertions, after the final CFG simplifications but before removal of dead blocks, gives rise to MIR: ```rust fn main::{closure#0}(_1: &[closure@a.rs:2:13: 2:22], _2: bool) -> () { debug x => _2; let mut _0: (); bb0: { Coverage::Expression(4294967295) = 1 - 2; return; } ... } ``` Which also makes the initial instrumentation quite suspect, although this pull request doesn't attempt to address that aspect directly. Fixes #98833. r? ``@wesleywiser`` ``@richkadel``
2022-07-26Rollup merge of #99593 - TaKO8Ki:suggest-removing-tuple-struct-field, ↵Yuki Okushi-0/+75
r=compiler-errors Suggest removing the tuple struct field for the unwrapped value fixes #99416
2022-07-26Rollup merge of #99353 - compiler-errors:gat-where-clause-mismatch, r=cjgillotYuki Okushi-32/+33
Slightly improve mismatched GAT where clause error This makes the error reporting a bit more standardized between `where` on GATs and functions. cc #99206 (`@BoxyUwU),` don't want to mark this as as "fixed" because they're still not perfect, but this is still an improvement IMO so I want to land it incrementally. regarding "consider adding where clause to trait definition", we don't actually do that for methods as far as i can tell? i could file an issue to look into that maybe.
2022-07-26Remove erroneous E0133 code from an error message.Nicholas Nethercote-8/+8
This error message is about `derive` and `packed`, but E0133 is for "Unsafe code was used outside of an unsafe function or block".
2022-07-26Use impl generics when suggesting fix on copy implMichael Goulet-0/+95
2022-07-26Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoeristerbors-14/+21
Enable raw-dylib for bin crates Fixes #93842 When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line. I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
2022-07-25handle consts with param/infer in const_eval_resolve betterMichael Goulet-43/+2
2022-07-25Restore Opaque behavior to coherence checkMichael Goulet-1/+45
2022-07-25rustdoc: avoid inlining modules with duplicate namesMichael Howell-0/+21
Fixes rust-lang/rust#99734
2022-07-25Auto merge of #99735 - JohnTitor:rollup-d93jyr2, r=JohnTitorbors-0/+22
Rollup of 9 pull requests Successful merges: - #92390 (Constify a few `(Partial)Ord` impls) - #97077 (Simplify some code that depend on Deref) - #98710 (correct the output of a `capacity` method example) - #99084 (clarify how write_bytes can lead to UB due to invalid values) - #99178 (Lighten up const_prop_lint, reusing const_prop) - #99673 (don't ICE on invalid dyn calls) - #99703 (Expose size_hint() for TokenStream's iterator) - #99709 (`Inherited` always has `TypeckResults` available) - #99713 (Fix sidebar background) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-26Rollup merge of #99713 - GuillaumeGomez:fix-sidebar-background, r=notriddleYuki Okushi-0/+22
Fix sidebar background Fixes #99691. cc `@jsha` r? `@notriddle`
2022-07-25Auto merge of #97313 - cjgillot:ast-lifetimes-anon, r=petrochenkovbors-669/+690
Resolve function lifetime elision on the AST ~Based on https://github.com/rust-lang/rust/pull/97720~ Lifetime elision for functions is purely syntactic in nature, so can be resolved on the AST. This PR replicates the elision logic and diagnostics on the AST, and replaces HIR-based resolution by a `delay_span_bug`. This refactor allows for more consistent diagnostics, which don't have to guess the original code from HIR. r? `@petrochenkov`
2022-07-25Report elision failures on the AST.Camille GILLOT-669/+690
2022-07-25apply review suggestionsMaybe Waffle-1/+1
2022-07-25Add a clickable link to the layout sectionest31-0/+1
2022-07-25passes: port more of `check_attr` moduleDavid Wood-10/+10
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-25Auto merge of #85673 - csmoe:export-exe-sym, r=bjorn3bors-0/+20
RFC-2841: add codegen flag export symbols from executable Closes #84161 r? `@nikomatsakis` `@Mark-Simulacrum`
2022-07-25Bubble up obligationsouz-a-1/+3