about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-10-19Auto merge of #90040 - nbdd0121:issue-90038, r=oli-obkbors-0/+21
Fix wrong niche calculation when 2+ niches are placed at the start When the niche is at the start, existing code incorrectly uses 1 instead of count for subtraction. Fix #90038 `@rustbot` label: T-compiler
2021-10-19Fix issue 90038Gary Guo-0/+21
2021-10-19Rollup merge of #89997 - cameron1024:const-str-as-bytes-ice, r=JohnTitorMatthias Krüger-0/+28
Add test for issue #84957 - `str.as_bytes()` in a `const` expression Hi, this PR adds a test for issue #84957 . I'm quite new to rustc so let me know if there's anything else that needs doing 😄 Closes #84957
2021-10-19Rollup merge of #89988 - tmiasko:unpromote-const-drop, r=oli-obkMatthias Krüger-0/+39
Do not promote values with const drop that need to be dropped Changes from #88558 allowed using `~const Drop` in constants by introducing a new `NeedsNonConstDrop` qualif. The new qualif was also used for promotion purposes, and allowed promotion to happen for values that needs to be dropped but which do have a const drop impl. Since for promoted the drop implementation is never executed, this lead to observable change in behaviour. For example: ```rust struct Panic(); impl const Drop for Panic { fn drop(&mut self) { panic!(); } } fn main() { let _ = &Panic(); } ``` Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-19Rollup merge of #89956 - JohnTitor:suggest-case-insensitive-match-names, ↵Matthias Krüger-2/+19
r=estebank Suggest a case insensitive match name regardless of levenshtein distance Fixes #86170 Currently, `find_best_match_for_name` only returns a case insensitive match name depending on a Levenshtein distance. It's a bit unfortunate that that hides some suggestions for typos like `Bar` -> `BAR`. That idea is from https://github.com/rust-lang/rust/pull/46347#discussion_r153701834, but I think it still makes some sense to show a candidate when we find a case insensitive match name as it's more like a typo. Skipped the `candidate != lookup` check because the current (i.e, `levenshtein_match`) returns the exact same `Symbol` anyway but it doesn't seem to confuse anything on UI tests. r? ``@estebank``
2021-10-19Rollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomezMatthias Krüger-0/+31
Fix macro_rules! duplication when reexported in the same module This can append if within the same module a `#[macro_export] macro_rules!` is declared but also a reexport of itself producing two export of the same macro in the same module. In that case we only want to document it once. Before: ``` Module { is_crate: true, items: [ Id("0:4"), // pub use crate::repro as repro2; Id("0:3"), // macro_rules! repro Id("0:3"), // duplicate, same as above ], } ``` After: ``` Module { is_crate: true, items: [ Id("0:4"), // pub use crate::repro as repro2; Id("0:3"), // macro_rules! repro ], } ``` Fixes https://github.com/rust-lang/rust/issues/89852
2021-10-18Auto merge of #89229 - oli-obk:i_love_inferctxt, r=jackh726bors-299/+228
Remove redundant member-constraint check impl trait will, for each lifetime in the hidden type, register a "member constraint" that says the lifetime must be equal or outlive one of the lifetimes of the impl trait. These member constraints will be solved by borrowck But, as you can see in the big red block of removed code, there was an ad-hoc check for member constraints happening at the site where they get registered. This check had some minor effects on diagnostics, but will fall down on its feet with my big type alias impl trait refactor. So we removed it and I pulled the removal out into a (hopefully) reviewable PR that works on master directly.
2021-10-18Do not promote values with const drop that need to be droppedTomasz Miąsko-0/+39
Changes from #88558 allowed using `~const Drop` in constants by introducing a new `NeedsNonConstDrop` qualif. The new qualif was also used for promotion purposes, and allowed promotion to happen for values that needs to be dropped but which do have a const drop impl. Since for promoted the drop implementation is never executed, this lead to observable change in behaviour. For example: ```rust struct Panic(); impl const Drop for Panic { fn drop(&mut self) { panic!(); } } fn main() { let _ = &Panic(); } ``` Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-18Auto merge of #89124 - cjgillot:owner-info, r=michaelwoeristerbors-14/+2
Index and hash HIR as part of lowering Part of https://github.com/rust-lang/rust/pull/88186 ~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~ Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner. r? `@michaelwoerister` cc `@petrochenkov`
2021-10-18Remove regionck member constraint handling and leave it to mir borrowckOli Scherer-320/+76
2021-10-18add test for issue 84957cameron-0/+28
2021-10-18Rollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomezMatthias Krüger-0/+15
Check implementing type for `#[doc(hidden)]` Closes #85526.
2021-10-18Rollup merge of #89974 - est31:let_else_if_error, r=nagisaMatthias Krüger-0/+28
Nicer error message if the user attempts to do let...else if Gives a nice "conditional `else if` is not supported for `let...else`" error when encountering a `let...else if` pattern, as suggested in the [let...else tracking issue](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205).
2021-10-18Rollup merge of #89965 - JohnTitor:fix-let-else-ice-with-ref-mut, r=petrochenkovMatthias Krüger-0/+19
Fix ICE with `let...else` and `ref mut` Fixes #89960, opened for review. I'm not satisfied with the current diagnostics, any ideas?
2021-10-17Check implementing type for `#[doc(hidden)]`pierwill-0/+15
Closes #85526.
2021-10-17Nicer error message if the user attempts to do let...else ifest31-0/+28
2021-10-17Rollup merge of #89975 - JohnTitor:gats-tests-85921, r=jackh726Matthias Krüger-0/+19
Add a regression test for #85921 Closes #85921 r? `@jackh726`
2021-10-17Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisaMatthias Krüger-73/+73
Some "parenthesis" and "parentheses" fixes "Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that. Inspired by #89958
2021-10-17Rollup merge of #89946 - JohnTitor:fix-89686, r=petrochenkovMatthias Krüger-0/+58
Fix an ICE with TAITs and Future Fixes #89686
2021-10-17Rollup merge of #89738 - eddyb:extern-crate-recursion, r=nagisaMatthias Krüger-0/+66
ty::pretty: prevent infinite recursion for `extern crate` paths. Fixes #55779, fixes #87932. This fix is based on `@estebank's` idea in https://github.com/rust-lang/rust/issues/55779#issuecomment-614758510 - but instead of trying to get `try_print_visible_def_path_recur`'s cycle detection to work in this case, this PR "just" disables the "visible path" feature when printing the path to an `extern crate`, so that the old recursion chain of `try_print_visible_def_path -> print_def_path -> try_print_visible_def_path`, is now impossible. Both tests have been confirmed to crash `rustc` because of a stack overflow, without the fix.
2021-10-17Auto merge of #89514 - davidtwco:polymorphize-shims-and-predicates, r=lcnrbors-1/+43
polymorphization: shims and predicates Supersedes #75737 and #75414. This pull request includes up some changes to polymorphization which hadn't landed previously and gets stage2 bootstrapping and the test suite passing when polymorphization is enabled. There are still issues with `type_id` and polymorphization to investigate but this should get polymorphization in a reasonable state to work on. - #75737 and #75414 both worked but were blocked on having the rest of the test suite pass (with polymorphization enabled) with and without the PRs. It makes more sense to just land these so that the changes are in. - #75737's changes remove the restriction of `InstanceDef::Item` on polymorphization, so that shims can now be polymorphized. This won't have much of an effect until polymorphization's analysis is more advanced, but it doesn't hurt. - #75414's changes remove all logic which marks parameters as used based on their presence in predicates - given #75675, this will enable more polymorphization and avoid the symbol clashes that predicate logic previously sidestepped. - Polymorphization now explicitly checks (and skips) foreign items, this is necessary for stage2 bootstrapping to work when polymorphization is enabled. - The conditional determining the emission of a note adding context to a post-monomorphization error has been modified. Polymorphization results in `optimized_mir` running for shims during collection where that wouldn't happen previously, some errors are emitted during `optimized_mir` and these were considered post-monomorphization errors with the existing logic (more errors and shims have a `DefId` coming from the std crate, not the local crate), adding a note that resulted in tests failing. It isn't particularly feasible to change where polymorphization runs or prevent it from using `optimized_mir`, so it seemed more reasonable to not change the conditional. - `characteristic_def_id_of_type` was being invoked during partitioning for self types of impl blocks which had projections that depended on the value of unused generic parameters of a function - this caused a ICE in a debuginfo test. If partitioning is enabled and the instance needs substitution then this is skipped. That test still fails for me locally, but not with an ICE, but it fails in a fresh checkout too, so 🤷‍♂️. r? `@lcnr`
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-73/+73
2021-10-17Add a regression test for #85921Yuki Okushi-0/+19
2021-10-17Rollup merge of #89907 - GuillaumeGomez:correctly-emit-errors, r=camelidYuki Okushi-1/+0
Remove FIXME since there is nothing to be fixed Resolves #88593. The errors are deduplicated when displayed to users. They only appear multiple times in UI tests. cc ``@jyn514`` r? ``@camelid``
2021-10-17Fix ICE with `let...else` and `ref mut`Yuki Okushi-0/+19
2021-10-16Remove FIXME since there is nothing to be fixed.Guillaume Gomez-1/+0
The errors are deduplicated when displayed to users. They only appear multiple times in UI tests.
2021-10-17Suggest a case insensitive match name regardless of levenshtein distanceYuki Okushi-2/+19
2021-10-16Auto merge of #89860 - camsteffen:macro-semi, r=petrochenkovbors-554/+575
Remove trailing semicolon from macro call span Macro call site spans are now less surprising/more consistent since they no longer contain a semicolon after the macro call. The downside is that we need to do a little guesswork to get the semicolon in diagnostics. But this should not be noticeable since it is rare for the semicolon to not immediately follow the macro call.
2021-10-16Fix an ICE with TAITs and FutureYuki Okushi-0/+58
2021-10-16Rollup merge of #89918 - JohnTitor:gats-tests, r=jackh726Matthias Krüger-0/+55
Add some GATs related regression tests Closes #88287, closes #88405
2021-10-16Rollup merge of #89914 - jackh726:gat_genericboundfailure, r=estebankMatthias Krüger-16/+19
Emit impl difference error for GenericBoundFailure too Fixes #86787 r? ````@estebank````
2021-10-16Rollup merge of #89912 - davidtwco:issue-89280-split-lines-multiple-lines, ↵Matthias Krüger-0/+33
r=oli-obk emitter: current substitution can be multi-line Fixes #89280. In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. r? ````@oli-obk````
2021-10-16Rollup merge of #89902 - rusticstuff:outline-atomics-linux-only, ↵Matthias Krüger-0/+1
r=workingjubilee Restrict the aarch64 outline atomics test to Linux The test was introduced in #83655, which enables the `outline-atomics` feature for aarch64-unknown-linux-* but not for any other aarch64 targets. The test did not check for Linux causing test failures on aarch64-apple-darwin. r? `@workingjubilee`
2021-10-16Rollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, ↵Matthias Krüger-8/+5
r=oli-obk Stabilize `unreachable_unchecked` as `const fn` Closes #53188 This PR stabilizes `core::hint::unreachable_unchecked` as `const fn`. MIRI is able to detect when this method is called. Stabilization was delayed until `const_panic` was stabilized so as to avoid users calling this method in its place (thus resulting in runtime UB). With #89508, that is no longer an issue. ````@rustbot```` label +A-const-eval +A-const-fn +T-lang +S-blocked (not sure why it's T-lang, but that's what the tracking issue is)
2021-10-15Auto merge of #84096 - m-ou-se:windows-bcrypt-random, r=dtolnaybors-2/+2
Use BCryptGenRandom instead of RtlGenRandom on Windows. This removes usage of RtlGenRandom on Windows, in favour of BCryptGenRandom. BCryptGenRandom isn't available on XP, but we dropped XP support a while ago.
2021-10-15simplify constrain_opaque_typesNiko Matsakis-216/+389
2021-10-16Add some GATs related regression testsYuki Okushi-0/+55
2021-10-15Emit impl difference error for GenericBoundFailure toojackh726-16/+19
2021-10-15emitter: current substitution can be multi-lineDavid Wood-0/+33
In `splice_lines`, there is some arithmetic to compute the required alignment such that future substitutions in a suggestion are aligned correctly. However, this assumed that the current substitution's span was only on a single line. In circumstances where this was not true, it could result in a arithmetic overflow when the substitution's end column was less than the substitution's start column. Signed-off-by: David Wood <david.wood@huawei.com>
2021-10-15Rework the equivalent test to work with sidebar-items.jsLoïc BRANSTETT-3/+3
2021-10-15Add missing bcrypt.lib to make-fulldeps Makefile.Mara Bos-2/+2
2021-10-15Add equivalent test in src/test/rustdocLoïc BRANSTETT-0/+14
2021-10-15Bless testsCameron Steffen-554/+575
2021-10-15Auto merge of #89903 - matthiaskrgr:rollup-s0c69xl, r=matthiaskrgrbors-74/+111
Rollup of 7 pull requests Successful merges: - #86011 (move implicit `Sized` predicate to end of list) - #89821 (Add a strange test for `unsafe_code` lint.) - #89859 (add dedicated error variant for writing the discriminant of an uninhabited enum variant) - #89870 (Suggest Box::pin when Pin::new is used instead) - #89880 (Use non-checking TLS relocation in aarch64 asm! sym test.) - #89885 (add long explanation for E0183) - #89894 (Remove unused dependencies from rustc_const_eval) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-15Rollup merge of #89885 - cameron1024:long-explanation-E0183, r=GuillaumeGomezMatthias Krüger-3/+4
add long explanation for E0183 Addresses #61137
2021-10-15Rollup merge of #89880 - adamgemmell:dev/nc-relocation, r=AmanieuMatthias Krüger-1/+1
Use non-checking TLS relocation in aarch64 asm! sym test. The checking variant ensures that the offset required is not larger than 12 bits - hence we wouldn't ever need the upper 12 bits. It's unlikely to ever fail in this small test but this is technically correct. This was noticed incidentally when we found that LLD doesn't support the `tprel_lo12` relocation, even though LLVM can apparently generate it when using `-mtls-size=12`.
2021-10-15Rollup merge of #89870 - tmandry:box-pin, r=estebankMatthias Krüger-13/+7
Suggest Box::pin when Pin::new is used instead This fixes an incorrect diagnostic. **Based on #89390**; only the last commit is specific to this PR. "Ignore whitespace changes" also helps here.
2021-10-15Rollup merge of #89821 - crlf0710:unsafe_code_lint_test, r=Mark-SimulacrumMatthias Krüger-0/+32
Add a strange test for `unsafe_code` lint. The current behavior is a little surprising to me. I'm not sure whether people would change it, but at least let me document the current behavior with a test. I learnt about this from the [totally-speedy-transmute](https://docs.rs/totally-speedy-transmute) crate. cc #10599 the original implementation pr.
2021-10-15Rollup merge of #86011 - tlyu:correct-sized-bound-spans, r=estebankMatthias Krüger-57/+67
move implicit `Sized` predicate to end of list In `Bounds::predicates()`, move the implicit `Sized` predicate to the end of the generated list. This means that if there is an explicit `Sized` bound, it will be checked first, and any resulting diagnostics will have a more useful span. Fixes #85998, at least partially. ~~Based on #85979, but only the last 2 commits are new for this pull request.~~ (edit: rebased) A full fix would need to deal with where-clauses, and that seems difficult. Basically, predicates are being collected in multiple stages, and there are two places where implicit `Sized` predicates can be inserted: once for generic parameters, and once for where-clauses. I think this insertion is happening too early, and we should actually do it only at points where we collect all of the relevant trait bounds for a type parameter. I could use some help interpreting the changes to the stderr output. It looks like reordering the predicates changed some diagnostics that don't obviously have anything to do with `Sized` bounds. Possibly some error reporting code is making assumptions about ordering of predicates? The diagnostics for src/test/ui/derives/derives-span-Hash-*.rs seem to have improved, no longer pointing at the type parameter identifier, but src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs became less verbose for some reason. I also ran into an instance of #84970 while working on this, but I kind of expected that could happen, because I'm reordering predicates. I can open a separate issue on that if it would be helpful. ``@estebank`` this seems likely to conflict (slightly?) with your work on #85947; how would you like to resolve that?
2021-10-15test fix: aarch64 atomics are only outlined on Linux.Hans Kratz-0/+1