about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-11-02Rollup merge of #90417 - lcnr:stabilize-relaxed-struct-unsizing, r=wesleywiserMatthias Krüger-25/+0
stabilize `relaxed_struct_unsize` closes #81793 the fcp is already complete.
2021-11-01Auto merge of #90463 - matthiaskrgr:rollup-eljk9vo, r=matthiaskrgrbors-23/+211
Rollup of 8 pull requests Successful merges: - #89826 (Feature gate + make must_not_suspend allow-by-default) - #89929 (Handling submodule update failures more gracefully from x.py) - #90333 (rustdoc: remove flicker during page load) - #90349 (Fix rare ICE during typeck in rustdoc scrape_examples) - #90398 (Document `doc(keyword)` unstable attribute) - #90441 (Test that promotion follows references when looking for drop) - #90450 (Remove `rustc_hir::hir_id::HirIdVec`) - #90452 (Remove unnecessary `Option` from `promote_candidate` return type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-01Auto merge of #90462 - pietroalbini:bidi-master, r=nikomatsakis,pietroalbinibors-0/+231
[master] Fix CVE-2021-42574 This PR implements new lints to mitigate the impact of [CVE-2021-42574], caused by the presence of bidirectional-override Unicode codepoints in the compiled source code. [See the advisory][advisory] for more information about the vulnerability. The changes in this PR will be released in tomorrow's nightly release. [CVE-2021-42574]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42574 [advisory]: https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html
2021-11-01Rollup merge of #90441 - tmiasko:test-promotion-needs-drop, r=Mark-SimulacrumMatthias Krüger-9/+100
Test that promotion follows references when looking for drop Noticed that this wasn't covered by any of existing tests. The const checking and const qualification, which currently shares the implementation with promotion, will likely need a different behaviour here (see issue #90193).
2021-10-31Feature gate and make must_not_suspend allow-by-defaultGus Wynn-14/+111
This lint is not yet ready for stable use, primarily due to false positives in edge cases; we want to test it out more before stabilizing.
2021-10-31Test that promotion follows references when looking for dropTomasz Miąsko-9/+100
Noticed that this wasn't covered by any of existing tests. The const checking and const qualification, which currently shares the implementation with promotion, will likely need a different behaviour here (see issue #90193).
2021-10-31Rollup merge of #90430 - jkugelman:must-use-std-a-through-n, r=joshtriplettMatthias Krüger-14/+14
Add #[must_use] to remaining std functions (A-N) I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is half of the remaining items from the `std` crate, from A-N. I added these functions myself. Clippy predictably ignored the `mut` ones, but I don't know why the rest weren't flagged. Check them closely, please? Maybe I overlooked good reasons. ```rust std::backtrace::Backtrace const fn disabled() -> Backtrace; std::backtrace::Backtrace<'a> fn frames(&'a self) -> &'a [BacktraceFrame]; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn key_mut(&mut self) -> &mut K; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_mut(&mut self) -> &mut V; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_key_value(&mut self) -> (&K, &V); std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_key_value_mut(&mut self) -> (&mut K, &mut V); std::env fn var_os<K: AsRef<OsStr>>(key: K) -> Option<OsString>; std::env fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_>; std::io::Error fn get_mut(&mut self) -> Option<&mut (dyn error::Error + Send + Sync + 'static)>; ``` Parent issue: #89692 r? `@joshtriplett`
2021-10-31Rollup merge of #89068 - bjorn3:restructure_rt2, r=joshtriplettMatthias Krüger-1/+1
Restructure std::rt (part 2) A couple more cleanups on top of https://github.com/rust-lang/rust/pull/89011 Blocked on #89011
2021-10-31Lint against RTL unicode codepoints in literals and commentsEsteban Küber-0/+231
Address CVE-2021-42574.
2021-10-31Rollup merge of #89839 - jkugelman:must-use-mem-ptr-functions, r=joshtriplettMatthias Krüger-0/+1
Add #[must_use] to mem/ptr functions There's a lot of low-level / unsafe stuff here. Are there legit use cases for ignoring any of these return values? * No regressions in `./x.py test --stage 1 library/std src/tools/clippy`. * One regression in `./x.py test --stage 1 src/test/ui`. Fixed. * I am unable to run `./x.py doc` on my machine so I'll need to wait for the CI to verify doctests pass. I eyeballed all the adjacent tests and they all look okay. Parent issue: #89692 r? ```@joshtriplett```
2021-10-30Add #[must_use] to remaining std functions (A-N)John Kugelman-14/+14
2021-10-30Add #[must_use] to mem/ptr functionsJohn Kugelman-0/+1
2021-10-30Rollup merge of #90399 - yuvaldolev:as-ref-overly-verbose-diagnostic, r=estebankGuillaume Gomez-0/+12
Skipping verbose diagnostic suggestions when calling .as_ref() on type not implementing AsRef Addresses #89806 Skipping suggestions when calling `.as_ref()` for types that do not implement the `AsRef` trait. r? `@estebank`
2021-10-30Rollup merge of #90375 - yanok:master, r=lcnrGuillaume Gomez-0/+41
Use `is_global` in `candidate_should_be_dropped_in_favor_of` This manifistated in #90195 with compiler being unable to keep one candidate for a trait impl, if where is a global impl and more than one trait bound in the where clause. Before #87280 `candidate_should_be_dropped_in_favor_of` was using `TypeFoldable::is_global()` that was enough to discard the two `ParamCandidate`s. But #87280 changed it to use `TypeFoldable::is_known_global()` instead, which is pessimistic, so now the compiler drops the global impl instead (because `is_known_global` is not sure) and then can't decide between the two `ParamCandidate`s. Switching it to use `is_global` again solves the issue. Fixes #90195.
2021-10-30Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkovGuillaume Gomez-8/+510
Improve and test cross-crate hygiene - Decode the parent expansion for traits and enums in `rustc_resolve`, this was already being used for resolution in typeck - Avoid suggesting importing names with def-site hygiene, since it's often not useful - Add more tests r? `@petrochenkov`
2021-10-30stabilize `relaxed_struct_unsize`lcnr-25/+0
2021-10-30Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnrMatthias Krüger-0/+47
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred Fixes https://github.com/rust-lang/rust/issues/90364 Fixes https://github.com/rust-lang/rust/issues/88997 r? ``@lcnr``
2021-10-30Rollup merge of #90395 - b-naber:const-expr-type-relation, r=oli-obkMatthias Krüger-0/+20
Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts Fixes https://github.com/rust-lang/rust/issues/89304 r? ``@oli-obk``
2021-10-30Rollup merge of #90374 - GuillaumeGomez:unify-rustdoc-book-titles, r=camelidMatthias Krüger-2/+2
Unify titles in rustdoc book doc attributes chapter As discussed in https://github.com/rust-lang/rust/pull/90339. I wasn't able to find out where the link to the titles was used so let's see if the CI fails. :) r? ``@camelid``
2021-10-29Unify titles in rustdoc book doc attributes chapterGuillaume Gomez-2/+2
2021-10-29Explicitly skipping suggestions for 'Pin' as it does not implement the ↵Yuval Dolev-17/+0
'AsRef' trait
2021-10-29Skip suggestions for the AsRef traitYuval Dolev-0/+29
2021-10-29Auto merge of #90373 - tmiasko:union-qualification, r=oli-obkbors-0/+89
Use type based qualification for unions Union field access is currently qualified based on the qualification of a value previously assigned to the union. At the same time, every union access transmutes the content of the union, which might result in a different qualification. For example, consider constants A and B as defined below, under the current rules neither contains interior mutability, since a value used in the initial assignment did not contain `UnsafeCell` constructor. ```rust #![feature(untagged_unions)] union U { i: u32, c: std::cell::Cell<u32> } const A: U = U { i: 0 }; const B: std::cell::Cell<u32> = unsafe { U { i: 0 }.c }; ``` To avoid the issue, the changes here propose to consider the content of a union as opaque and use type based qualification for union types. Fixes #90268. `@rust-lang/wg-const-eval`
2021-10-29ignore type flags insertion in default_anon_const_substs if error occurredb-naber-0/+47
2021-10-29add testb-naber-0/+20
2021-10-29Auto merge of #90214 - tmiasko:indirect-mutation-qualif, ↵bors-0/+93
r=ecstatic-morse,oli-obk Consider indirect mutation during const qualification dataflow Previously a local would be qualified if either one of two separate data flow computations indicated so. First determined if a local could contain the qualif, but ignored any forms of indirect mutation. Second determined if a local could be mutably borrowed (and so indirectly mutated), but which in turn ignored the qualif. The end result was incorrect because the effect of indirect mutation was effectivelly ignored in the all but the final stage of computation. In the new implementation the indirect mutation is directly incorporated into the qualif data flow. The local variable becomes immediately qualified once it is mutably borrowed and borrowed place type can contain the qualif. In general we will now reject additional programs, program that were prevously unintentionally accepted. There are also some cases which are now accepted but were previously rejected, because previous implementation didn't consider whether borrowed place could have the qualif under the consideration. Fixes #90124. r? `@ecstatic-morse`
2021-10-28Add comments to hygiene testsMatthew Jasper-4/+37
2021-10-28Auto merge of #90218 - JakobDegen:adt_significant_drop_fix, r=nikomatsakisbors-0/+37
Fixes incorrect handling of ADT's drop requirements Fixes #90024 and a bunch of duplicates. The main issue was just that the contract of `NeedsDropTypes::adt_components` was inconsistent; the list of types it might return were the generic parameters themselves or the fields of the ADT, depending on the nature of the drop impl. This meant that the caller could not determine whether a `.subst()` call was still needed on those types; it called `.subst()` in all cases, and this led to ICEs when the returned types were the generic params. First contribution of more than a few lines, so feedback definitely appreciated.
2021-10-28Add test casesIlya Yanok-0/+41
2021-10-28Use type based qualification for unionsTomasz Miąsko-0/+89
Union field access is currently qualified based on the qualification of a value previously assigned to the union. At the same time, every union access transmutes the content of the union, which might result in a different qualification. For example, consider constants A and B as defined below, under the current rules neither contains interior mutability, since a value used in the initial assignment did not contain `UnsafeCell` constructor. ```rust #![feature(untagged_unions)] union U { i: u32, c: std::cell::Cell<u32> } const A: U = U { i: 0 }; const B: std::cell::Cell<u32> = unsafe { U { i: 0 }.c }; ``` To avoid the issue, the changes here propose to consider the content of a union as opaque and use type based qualification for union types.
2021-10-27Rollup merge of #90304 - vandenheuvel:test_issue_75961, r=Mark-SimulacrumMatthias Krüger-0/+7
Add regression test for #75961 Closes #75961. Closes #21203.
2021-10-27Rollup merge of #90288 - JakobDegen:import_diagnostics, r=davidtwcoMatthias Krüger-0/+108
Add hint for people missing `TryFrom`, `TryInto`, `FromIterator` import pre-2021 Adds a hint anytime a `TryFrom`, `TryInto`, `FromIterator` import is suggested noting that these traits are automatically imported in Edition 2021.
2021-10-27Rollup merge of #90267 - EliseZeroTwo:elisezerotwo/fix_invalid_attrs_ice, ↵Matthias Krüger-0/+46
r=Aaron1011 fix: inner attribute followed by outer attribute causing ICE Fixes #87936, #88938, and #89971. This removes the assertion that validates that there are no outer attributes following inner attributes. Where the inner attribute is invalid you get an actual error.
2021-10-27test: add test for inner attribute followed by outer attribute causing ICEEliseZeroTwo-0/+46
2021-10-27Add regression test for #75961Bram van den Heuvel-0/+7
2021-10-27Auto merge of #89937 - JohnTitor:fix-89875, r=Amanieubors-0/+14
Properly check `target_features` not to trigger an assertion Fixes #89875 I think it should be a condition instead of an assertion to check if it's a register as it's possible that `reg` is a register class. Also, this isn't related to the issue directly, but `is_target_supported` doesn't check `target_features` attributes. Is there any way to check it on rustc_codegen_llvm? r? `@Amanieu`
2021-10-26Reverting switching test to no_std and adjust output after rebase.Jakob Degen-30/+41
2021-10-26Fix line numbers in testJakob Degen-4/+4
2021-10-26Make `ui/suggestions/suggest-tryinto-edition-change.rs` no_std to avoid ↵Jakob Degen-41/+30
getting inconsistent output between local and CI.
2021-10-26Adds hint if a trait fails to resolve and a newly added one in Edition 2021 ↵Jakob Degen-8/+83
is suggested
2021-10-26Add test checking that Edition 2021 is suggested for .try_into() and fix ↵Jakob Degen-0/+33
other test
2021-10-26Rollup merge of #90305 - vandenheuvel:test_issue_87258, r=Mark-SimulacrumMatthias Krüger-0/+72
Add regression test for #87258 Closes #87258.
2021-10-26Rollup merge of #90303 - WaffleLapkin:regression_test_90164, r=JohnTitorMatthias Krüger-0/+31
Add regression test for issue 90164 Closes #90164 (previously fixed by #90181)
2021-10-26Add regression test for #87258Bram van den Heuvel-0/+72
2021-10-26Add regression test for issue 90164Maybe Waffle-0/+31
2021-10-26Auto merge of #90075 - pierwill:fix-79717, r=petrochenkovbors-76/+150
Edit error messages for `rustc_resolve::AmbiguityKind` variants Edit the language of the ambiguity descriptions for E0659. These strings now appear as notes. Closes #79717.
2021-10-26Consider indirect mutation during const qualification dataflowTomasz Miąsko-0/+93
Previously a local would be qualified if either one of two separate data flow computations indicated so. First determined if a local could contain the qualif, but ignored any forms of indirect mutation. Second determined if a local could be mutably borrowed (and so indirectly mutated), but which in turn ignored the qualif. The end result was incorrect because the effect of indirect mutation was effectivelly ignored in the all but the final stage of computation. In the new implementation the indirect mutation is directly incorporated into the qualif data flow. The local variable becomes immediately qualified once it is mutably borrowed and borrowed place type can contain the qualif. In general we will now reject additional programs, program that were prevously unintentionally accepted. There are also some cases which are now accepted but were previously rejected, because previous implementation didn't consider whether borrowed place could have the qualif under the consideration.
2021-10-26Rollup merge of #90241 - DrMeepster:thiscall_lint_upgrade, r=petrochenkovMatthias Krüger-40/+28
Make thiscall abi on unsupported platforms a hard error As suggested in https://github.com/rust-lang/rust/issues/42202#issuecomment-950205016, this PR makes use of the `thiscall` abi on unsupported a hard error instead of a lint.
2021-10-26Rollup merge of #90181 - notriddle:notriddle/error-pointer, r=estebankMatthias Krüger-74/+161
fix(rustc_typeck): report function argument errors on matching type Fixes #90101
2021-10-26Add a regression test for issue-89875Yuki Okushi-0/+14