about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-4/+4
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17Rollup merge of #94731 - TaKO8Ki:const-generic-expr-recovery, ↵Dylan DPC-0/+75
r=davidtwco,oli-obk Suggest adding `{ .. }` around a const function call with arguments closes #91020
2022-03-17Rollup merge of #94309 - eholk:issue-57017, r=tmandryDylan DPC-0/+22
[generator_interior] Be more precise with scopes of borrowed places Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as: ```rust fn status(_client_status: &Client) -> i16 { 200 } fn main() { let client = Client; let g = move || match status(&client) { _status => yield, }; assert_send(g); } ``` In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`. In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues. Joint work with `@nikomatsakis` Fixes #57017 r? `@tmandry`
2022-03-17Rollup merge of #93222 - mark-i-m:errorreported, r=oli-obkDylan DPC-8/+8
Make ErrorReported impossible to construct outside `rustc_errors` There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name. cc #69426 `@varkor` `@eddyb` `@estebank` I actually didn't see that I was assigned to this issue until now...
2022-03-17Rollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726Dylan DPC-1/+6
Improve `unsafe` diagnostic This fixes: https://github.com/rust-lang/rust/issues/90880 I didn't use the exact proposed messages though.
2022-03-17This test now worksSantiago Pastorino-13/+2
2022-03-17Make negative coherence work when there's impl negative on super predicatesSantiago Pastorino-0/+18
2022-03-16erase late-bound regions in dyn projection types for debuginfoMichael Goulet-0/+7
2022-03-16Add double negative trait test caseSantiago Pastorino-0/+12
2022-03-16rustc_error: make ErrorReported impossible to constructmark-8/+8
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-16debuginfo: Fix ICE when generating name for type that produces a layout error.Michael Woerister-0/+44
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-4/+4
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16Reject `#[thread_local]` attribute on non-static itemsTomasz Miąsko-0/+68
2022-03-16Auto merge of #94987 - Dylan-DPC:rollup-5tssuhi, r=Dylan-DPCbors-18/+340
Rollup of 5 pull requests Successful merges: - #94868 (Format core and std macro rules, removing needless surrounding blocks) - #94951 (Extend the irrefutable_let_patterns lint to let chains) - #94955 (Refactor: Use `format_args_capture` in some parts of `rustc_parse`) - #94957 (Improve the explanation about the behaviour of read_line) - #94974 (Ensure that `let_else` does not interact with `let_chains`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-16Rollup merge of #94974 - c410-f3r:let-chain-dashufwrqwemkf-let-else, ↵Dylan DPC-0/+173
r=joshtriplett Ensure that `let_else` does not interact with `let_chains` As requested on https://github.com/rust-lang/rust/pull/94927. cc `@joshtriplett` `@estebank`
2022-03-16Rollup merge of #94951 - est31:irrefutable_let_chain_patterns, r=estebankDylan DPC-10/+159
Extend the irrefutable_let_patterns lint to let chains Implements the suggestion from https://github.com/rust-lang/rust/pull/94927#issuecomment-1067078300 We only look for complete suffixes or prefixes of irrefutable let patterns, so that an irrefutable let pattern in a chain surrounded by refutable ones is not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`). If all patterns in a let chain are irrefutable, we lint as well. Depends on #94958 ~~so I included it into the PR for now~~ *which has been merged since*. r? `@estebank` cc `@joshtriplett` `@c410-f3r`
2022-03-16Rollup merge of #94868 - dtolnay:noblock, r=Dylan-DPCDylan DPC-8/+8
Format core and std macro rules, removing needless surrounding blocks Many of the asserting and printing macros in `core` and `std` are written with prehistoric-looking formatting, like this: https://github.com/rust-lang/rust/blob/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/macros.rs#L96-L101 In modern Rust style this would conventionally be written as follows instead, always using braces and a trailing semicolon on the macro arms: https://github.com/rust-lang/rust/blob/af53809c874e0afb7be966df4d3cfcaa05277c53/library/std/src/macros.rs#L98-L105 Getting rid of the unneeded braces inside the expansion reduces extraneous indentation in macro-expanded code. For example: ```rust println!("repro {}", true); ``` ```rust // before: { ::std::io::_print( ::core::fmt::Arguments::new_v1( &["repro ", "\n"], &[::core::fmt::ArgumentV1::new_display(&true)], ), ); }; ``` ```rust // after: ::std::io::_print( ::core::fmt::Arguments::new_v1( &["repro ", "\n"], &[::core::fmt::ArgumentV1::new_display(&true)], ), ); ```
2022-03-16Auto merge of #94861 - aDotInTheVoid:rdj-trait-tests, r=CraftSpiderbors-0/+150
rustdoc-json: More tests, and better jsondocck errors Helps with #81359 r? `@CraftSpider` `@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +A-testsuite
2022-03-15Bless coverage-reports after core macro blocks changeDavid Tolnay-4/+4
2022-03-15Parse inner attributes on inline const blockDavid Tolnay-0/+9
2022-03-15Include tracking issue in diagnosticJacob Pratt-1/+1
2022-03-16Extend the irrefutable_let_patterns lint to let chainsest31-10/+159
Only look for complete suffixes or prefixes of irrefutable let patterns, so that an irrefutable let pattern in a chain surrounded by refutable ones is not linted, as it is an useful pattern.
2022-03-15Auto merge of #94925 - lcnr:relax-sus-auto-impls, r=estebankbors-1/+22
relax `suspicious_auto_trait_impls` lint wrt lifetimes fixes the warning for https://github.com/rust-lang/rust/issues/93367#issuecomment-1063993489.
2022-03-15Add deprecated_safe feature gate and attribute, cc #94978skippy10110-0/+28
2022-03-15Auto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddlebors-19/+26
Add GUI test to check URLs The first commit merges both file doing kinda the same thing. Didn't make much sense to keep them separated. The second commit add checks to ensure the URL has the expected value depending if the search is displayed or not. r? `@notriddle`
2022-03-15Ensure that `let_else` does not interact with `let_chains`Caio-0/+173
2022-03-15Add URL GUI testsGuillaume Gomez-0/+6
2022-03-15Merge both "search-result-color" GUI testsGuillaume Gomez-19/+20
2022-03-15rustdoc-json: Lifetime testsNixon Enraght-Moony-0/+56
2022-03-15rustdoc-json: Add tests for generic fn args and returnsNixon Enraght-Moony-0/+68
2022-03-15rustdoc-json: Add test for supertraitsNixon Enraght-Moony-0/+26
2022-03-15Rollup merge of #94947 - Dylan-DPC:fix/typos, r=oli-obkMatthias Krüger-2/+2
fix typos Rework of #94603 which got closed as I was trying to unmerge and repush. This is a subset of changes from the original pr as I sed'd whatever typos I remembered from the original PR thanks to `@cuishuang` for the original PR
2022-03-15Rollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, ↵Matthias Krüger-0/+16
r=wesleywiser debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments. For types like `&dyn Future<Output=bool>` the compiler currently emits invalid types names in debuginfo. This PR fixes this. Before: ```txt // DWARF &dyn core::future::future::Future, Output=bool> // CodeView ref$<dyn$<core::future::future::Future,assoc$<Output,bool> > > > ``` After: ```txt // DWARF &dyn core::future::future::Future<Output=bool> // CodeView ref$<dyn$<core::future::future::Future<assoc$<Output,bool> > > > ``` These syntactically incorrect type names can cause downstream tools (e.g. debugger extensions) crash when trying to parse them. r? `@wesleywiser`
2022-03-15Auto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiserbors-31/+62
debuginfo: Refactor debuginfo generation for types This PR implements the refactoring of the `rustc_codegen_llvm::debuginfo::metadata` module as described in MCP https://github.com/rust-lang/compiler-team/issues/482. In particular it - changes names to use `di_node` instead of `metadata` - uniformly names all functions that build new debuginfo nodes `build_xyz_di_node` - renames `CrateDebugContext` to `CodegenUnitDebugContext` (which is more accurate) - removes outdated parts from `compiler/rustc_codegen_llvm/src/debuginfo/doc.md` - moves `TypeMap` and functions that work directly work with it to a new `type_map` module - moves enum related builder functions to a new `enums` module - splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate - uses `SmallVec` instead of `Vec` in many places - removes the old infrastructure for dealing with recursion cycles (`create_and_register_recursive_type_forward_declaration()`, `RecursiveTypeDescription`, `set_members_of_composite_type()`, `MemberDescription`, `MemberDescriptionFactory`, `prepare_xyz_metadata()`, etc) - adds `type_map::build_type_with_children()` as a replacement for dealing with recursion cycles - adds many (doc-)comments explaining what's going on - changes cpp-like naming for C-Style enums so they don't get a `enum$<...>` name (because the NatVis visualizer does not apply to them) - fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields - changes cpp-like naming for generator enums so that NatVis works for them - changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it The following could be done in subsequent PRs: - add caching for `closure_saved_names_of_captured_variables` - add caching for `generator_layout_and_saved_local_names` - fix inconsistent handling of what is considered a C-style enum wrt to debuginfo - rename `metadata` module to `types` - move common generator fields to front instead of appending them This PR is based on https://github.com/rust-lang/rust/pull/93644 which is not merged yet. Right now, the changes are all done in one big commit. They could be split into smaller commits but hopefully the list of changes above makes it tractable to review them as a single commit too. For now: r? `@ghost` (let's see if this affects compile times)
2022-03-15debuginfo: Refactor debuginfo generation for types -- Make generator-objects ↵Michael Woerister-8/+9
test case architecture independent.
2022-03-15Update stderrs referencing `IntoIterator`mbartlett21-4/+4
2022-03-15Update const-fn-error.stderrmbartlett21-2/+2
2022-03-15Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuberbors-15/+180
More robust fallback for `use` suggestion Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion. But this was fragile, as illustrated in issue #87613 This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion. Fix #87613
2022-03-15Auto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakisbors-11/+85
check ~Projection~ all supertrait bounds when confirming dyn candidate I'm pretty sure Projection is the only other PredicateKind that we care about enforcing here. Fixes #80800
2022-03-15fix typosDylan DPC-2/+2
2022-03-14check all dyn obligations, actuallyMichael Goulet-11/+35
2022-03-14check Projection supertrait bounds when confirming dyn candidateMichael Goulet-0/+50
2022-03-14Rollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, ↵Matthias Krüger-0/+77
r=flip1995,wesleywiser Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383) This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case. According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note. --- r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy :upside_down_face: rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html) tracking issue: https://github.com/rust-lang/rust/issues/85549 cc: `@flip1995` In case you're also interested in this :)
2022-03-14Rollup merge of #93977 - compiler-errors:sized-generic-metadata, r=wesleywiserMatthias Krüger-0/+91
Type params and assoc types have unit metadata if they are sized Extend the logic in `Pointee` projection to ensure that we can satisfy `<T as Pointee>::Metadata = ()` if `T: Sized`. cc: `@SimonSapin` and #93959
2022-03-14Rollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=AmanieuMatthias Krüger-3/+3
Stabilise `aarch64_target_feature` This PR stabilises `aarch64_target_feature` - see https://github.com/rust-lang/rust/issues/90620
2022-03-14debuginfo: change cpp-like naming for generator environments so that NatVis ↵Michael Woerister-2/+33
works for them
2022-03-14debuginfo: Refactor debuginfo generation for typesMichael Woerister-30/+29
This commit - changes names to use di_node instead of metadata - uniformly names all functions that build new debuginfo nodes build_xyz_di_node - renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate) - moves TypeMap and functions that work directly work with it to a new type_map module - moves and reimplements enum related builder functions to a new enums module - splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate - uses SmallVec instead of Vec in many places - removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc) - adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles - adds many (doc-)comments explaining what's going on - changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them) - fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields - changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it
2022-03-14Auto merge of #94915 - bjorn3:fix_test_box_def, r=tmiaskobors-2/+2
Fix definition of Box in ssa-analysis-regression-50041.rs The Box in liballoc always has a field for the allocator. It is quite hard to support both the old and new definition of Box in cg_clif so this change uses the new definition in this test too.
2022-03-14Stabilise `aarch64_target_feature`Adam Gemmell-2/+2
2022-03-14Tie `fp` and `neon`Adam Gemmell-1/+1