about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-07-11Make tests work on 32 bit and 64 bitOli Scherer-19/+22
2022-07-11Show sizes in error outputOli Scherer-1/+3
2022-07-11Rename assertion macroOli Scherer-27/+27
2022-07-11Simplify assertion macroOli Scherer-29/+28
2022-07-11Move checks to compile-timeOli Scherer-1/+8
2022-07-11Hide niches in SIMD types, tooOli Scherer-0/+8
2022-07-11Rollup merge of #99147 - compiler-errors:issue-55673, r=lcnrDylan DPC-3/+24
Mention similarly named associated type even if it's not clearly in supertrait Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits. This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible. Fixes #55673
2022-07-11Rollup merge of #99091 - compiler-errors:private-types-should-stay-private, ↵Dylan DPC-1/+47
r=lcnr Do not mention private types from other crates as impl candidates Fixes #99080
2022-07-11Rollup merge of #98907 - compiler-errors:plz-no-float, r=oli-obkDylan DPC-0/+34
Deny float const params even when `adt_const_params` is enabled Supersedes #98825 Fixes #98813 r? ``@oli-obk``
2022-07-11Rollup merge of #98882 - compiler-errors:explain-doc-comments-in-macros, ↵Dylan DPC-2/+8
r=davidtwco explain doc comments in macros a bit Open to suggestions on improving this... macro parsing is very foreign to me. Should we have a structured suggestion to turn them into their regular non-doc comments? Fixes #92846 Fixes #97850
2022-07-11Add tests for -Chelp and -ZhelpGuillaume Gomez-0/+254
2022-07-11Handle tags better.Nicholas Nethercote-118/+78
Currently, for the enums and comparison traits we always check the tag for equality before doing anything else. This is a bit clumsy. This commit changes things so that the tags are handled very much like a zeroth field in the enum. For `eq`/ne` this makes the code slightly cleaner. For `partial_cmp` and `cmp` it's a more notable change: in the case where the tags aren't equal, instead of having a tag equality check followed by a tag comparison, it just does a single tag comparison. The commit also improves how `Hash` works for enums: instead of having duplicated code to hash the tag for every arm within the match, we do it just once before the match. All this required replacing the `EnumNonMatchingCollapsed` value with a new `EnumTag` value. For fieldless enums the new code is particularly improved. All the code now produced is close to optimal, being very similar to what you'd write by hand.
2022-07-11Do not mention private Self types from other cratesMichael Goulet-1/+47
2022-07-11Mention similarly named associated type even if it's not clearly in supertraitMichael Goulet-3/+24
2022-07-11Do not suggest same trait over againMichael Goulet-5/+0
2022-07-11Use fake substs to check for `Self: Sized` predicates on method receiversMichael Goulet-0/+59
2022-07-11Avoid some unnecessary blocks in derive output.Nicholas Nethercote-9/+6
2022-07-11Rename tag-related things.Nicholas Nethercote-90/+89
Use `tag` in names of things referring to tags, instead of the mysterious `vi`. Also change `arg_N` in output to `argN`, which has the same length as `self` and so results in nicer vertical alignments.
2022-07-11Remove unnecessary `&*` sigil pairs in derived code.Nicholas Nethercote-42/+37
By producing `&T` expressions for fields instead of `T`. This matches what the existing comments (e.g. on `FieldInfo`) claim is happening, and it's also what most of the trait-specific code needs. The exception is `PartialEq`, which needs `T` expressions for lots of special case error messaging to work. So we now convert the `&T` back to a `T` for `PartialEq`.
2022-07-11Remove unnecessary sigils and `ref`s in derived code.Nicholas Nethercote-107/+105
E.g. improving code like this: ``` match &*self { &Enum1::Single { x: ref __self_0 } => { ::core::hash::Hash::hash(&*__self_0, state) } } ``` to this: ``` match self { Enum1::Single { x: __self_0 } => { ::core::hash::Hash::hash(&*__self_0, state) } } ``` by removing the `&*`, the `&`, and the `ref`. I suspect the current generated code predates deref-coercion. The commit also gets rid of `use_temporaries`, instead passing around `always_copy`, which makes things a little clearer. And it fixes up some comments.
2022-07-10fix(doctest): treat fatal parse errors as incomplete attributesMichael Howell-0/+16
Fixes #99089
2022-07-11Deny floats even when adt_const_params is enabledMichael Goulet-0/+34
2022-07-10explain doc comments in macros a bitMichael Goulet-2/+8
2022-07-11Rollup merge of #99095 - rhysd:issue-99092, r=compiler-errorsMatthias Krüger-1/+33
Remove duplicate notes from error on inter-crate ambiguous impl of traits Fixes #99092
2022-07-11Rollup merge of #98713 - nikomatsakis:issue-98693, r=jackh726Matthias Krüger-1/+52
promote placeholder bounds to 'static obligations In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries. Fixes #98693 ~~(Marking as WIP because I'm still running tests, haven't add the new test, etc)~~ r? ``@jackh726``
2022-07-11Add a fieldless enum with one variant to `deriving-all-codegen.rs`.Nicholas Nethercote-0/+81
Because the generated code is different to fieldless enum with multiple variants.
2022-07-11Add a non-`Copy` packed struct to `deriving-all-codegen.rs`.Nicholas Nethercote-22/+124
Because the generatedd code is different to a `Copy` packed struct.
2022-07-11Add a struct with an unsized field to the `deriving-all-codegen.rs` test.Nicholas Nethercote-1/+60
It's an interesting case, requiring the use of `&&` in `Debug::fmt`.
2022-07-10Fix drop-tracking ICE when a struct containing a field with a `Drop` impl is ↵Joshua Nelson-32/+344
used across an await Previously, drop-tracking would incorrectly assume the struct would be dropped immediately, which was not true: when the field had a type with a manual `Drop` impl, the drop becomes observable and has to be dropped after the await instead. For reasons I don't understand, this also fixes another error crater popped up related to type parameters. #98476
2022-07-10Don't try to resolve inference variables in WF computation, just registerJack Huey-3/+8
2022-07-11remove a string matching about methodsTakayuki Maeda-31/+72
2022-07-10Auto merge of #98785 - compiler-errors:no-check-expr-in-check-compatible, ↵bors-18/+5
r=estebank Do not call `check_expr` in `check_compatible`, since it has side-effects Fixes a weird suggestion in #98784 found later: Fixes #98894 Fixes #98897
2022-07-10Auto merge of #98463 - mystor:expand_expr_bool, r=eddybbors-1/+70
proc_macro: Fix expand_expr expansion of bool literals Previously, the expand_expr method would expand bool literals as a `Literal` token containing a `LitKind::Bool`, rather than as an `Ident`. This is not a valid token, and the `LitKind::Bool` case needs to be handled seperately. Tests were added to more deeply compare the streams in the expand-expr test suite to catch mistakes like this in the future.
2022-07-10Rollup merge of #99086 - GuillaumeGomez:search-result-crate-filter-dropdown, ↵Matthias Krüger-0/+28
r=notriddle Fix display of search result crate filter dropdown In case a crate name is too long, the `<select>` completely overflows its parent. Another problem is that there is left margin on the `select` which break the alignment. You can see both issues here: ![Screenshot from 2022-07-09 15-31-12](https://user-images.githubusercontent.com/3050060/178108959-0eb5af19-ec60-4d34-a2fd-c27147683c78.png) And with the fix: ![Screenshot from 2022-07-09 15-33-37](https://user-images.githubusercontent.com/3050060/178108980-71030a92-84ee-4ee5-98e3-f97d03a6fbaf.png) cc `@jsha` r? `@notriddle`
2022-07-10Remove duplicate notes from error on inter-crate ambiguous impl of traits ↵rhysd-1/+33
(fix #99092)
2022-07-10Auto merge of #97522 - xfix:stabilize-slice-from-raw-parts, r=dtolnaybors-60/+56
Partially stabilize const_slice_from_raw_parts This doesn't stabilize methods working on mutable pointers. This pull request continues from #94946. Pinging `@rust-lang/wg-const-eval` this because I use `rustc_allow_const_fn_unstable`. I believe this is justifiable as it's already possible to use `slice::from_raw_parts` in stable by abusing `transmute`. The stable alternative to this would be to provide a stable const implementation of `std::ptr::from_raw_parts` (as it can already be implemented in stable). ```rust use std::mem; #[repr(C)] struct Slice<T> { data: *const T, len: usize, } fn main() { let data: *const i32 = [1, 2, 3, 4].as_ptr(); let len = 4; println!("{:?}", unsafe { mem::transmute::<Slice<i32>, &[i32]>(Slice { data, len }) }); } ``` `@rustbot` modify labels: +T-libs-api
2022-07-09Auto merge of #98950 - ChrisDenton:getoverlapped-io, r=thomccbors-0/+81
Windows: Fallback for overlapped I/O Fixes #98947
2022-07-09Partially stabilize const_slice_from_raw_partsKonrad Borowski-60/+56
This doesn't stabilize methods working on mutable pointers.
2022-07-09Do not call `check_expr` in `check_compatible`, since it has side-effects ↵Michael Goulet-18/+5
and we've already checked all args
2022-07-09Add GUI test for search result crate filter dropdownGuillaume Gomez-0/+28
2022-07-09tweak names and output and blessRalf Jung-218/+220
2022-07-09Rollup merge of #99008 - obeis:issue-98974, r=compiler-errorsDylan DPC-6/+24
Adding suggestion for E0530 Closes #98974
2022-07-09Rollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obkDylan DPC-0/+18
fix ICE in ConstProp Fixes https://github.com/rust-lang/rust/issues/96169
2022-07-09Rollup merge of #98350 - pcwalton:dwarf5, r=michaelwoeristerDylan DPC-0/+20
Implement support for DWARF version 5. DWARF version 5 brings a number of improvements over version 4. Quoting from the announcement [1]: > Version 5 incorporates improvements in many areas: better data compression, > separation of debugging data from executable files, improved description of > macros and source files, faster searching for symbols, improved debugging > optimized code, as well as numerous improvements in functionality and > performance. On platforms where DWARF version 5 is supported (Linux, primarily), this commit adds support for it behind a new `-Z dwarf-version=5` flag. [1]: https://dwarfstd.org/Public_Review.php r? ``@michaelwoerister``
2022-07-08Fixup diagnostic-derive testDaniel Xu-1/+1
2022-07-08Fix duplicated type annotation suggestionDaniel Xu-24/+0
Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-08distinguish the method and associated function diagnostic informationYiming Lei-14/+14
Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr
2022-07-08remove broken testJane Losare-Lusby-12/+0
2022-07-08Auto merge of #98816 - estebank:implicit-sized, r=oli-obkbors-99/+230
Track implicit `Sized` obligations in type params When we evaluate `ty::GenericPredicates` we introduce the implicit `Sized` predicate of type params, but we do so with only the `Predicate` its `Span` as context, we don't have an `Obligation` or `ObligationCauseCode` we could influence. To try and carry this information through, we add a new field to `ty::GenericPredicates` that tracks both which predicates come from a type param and whether that param has any bounds already (to use in suggestions). We also suggest adding a `?Sized` bound if appropriate on E0599. Address part of #98539.
2022-07-08fix stderr output file after rebaseJane Losare-Lusby-23/+5