about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-12-07Add explanations to scrape-examples integration testWill Crichton-0/+6
2022-12-07Improve several aspects of the Rustdoc scrape-examples UI.Will Crichton-0/+34
* Examples take up less screen height. * Snippets from binary crates are prioritized. * toggle-all-docs does not expand "More examples" sections.
2022-12-07Auto merge of #104799 - pcc:linkage-fn, r=tmiaskobors-30/+15
Support Option and similar enums as type of static variable with linkage attribute Compiler MCP: rust-lang/compiler-team#565
2022-12-06Rollup merge of #105358 - TaKO8Ki:fix-104260, r=estebankMatthias Krüger-0/+14
Add a test for #104260 Fixes #104260
2022-12-06Auto merge of #105378 - matthiaskrgr:rollup-fjeorw5, r=matthiaskrgrbors-19/+127
Rollup of 9 pull requests Successful merges: - #104898 (Put all cached values into a central struct instead of just the stable hash) - #105004 (Fix `emit_unused_delims_expr` ICE) - #105174 (Suggest removing struct field from destructive binding only in shorthand scenario) - #105250 (Replace usage of `ResumeTy` in async lowering with `Context`) - #105286 (Add -Z maximal-hir-to-mir-coverage flag) - #105320 (rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles) - #105349 (Point at args in associated const fn pointers) - #105362 (Cleanup macro-expanded code in `rustc_type_ir`) - #105370 (Remove outdated syntax from trait alias pretty printing) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-06Rollup merge of #105349 - compiler-errors:point-at-assoc-ct-fn-ptr-arg, ↵Matthias Krüger-2/+4
r=cjgillot Point at args in associated const fn pointers Tiny follow-up to #105201, not so sure it's worth it but :shrug: The UI test example is a bit more compelling when it's `GlUniformScalar::FACTORY` r? `@cjgillot`
2022-12-06Rollup merge of #105320 - notriddle:notriddle/rustdoc-toggle-hideme-2, ↵Matthias Krüger-0/+10
r=GuillaumeGomez rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles This code uses a special `hideme` class anyway, so just style that.
2022-12-06Rollup merge of #105286 - willcrichton:maximal-hir-to-mir-coverage, r=cjgillotMatthias Krüger-0/+11
Add -Z maximal-hir-to-mir-coverage flag This PR adds a new unstable flag `-Z maximal-hir-to-mir-coverage` that changes the behavior of `maybe_lint_level_root_bounded`, pursuant to [a discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Mapping.20MIR.20to.20HIR). When enabled, this function will not search upwards for a lint root, but rather immediately return the provided HIR node ID. This change increases the granularity of the mapping between MIR locations and HIR nodes inside the `SourceScopeLocalData` data structures. This increase in granularity is useful for rustc consumers like [Flowistry](https://github.com/willcrichton/flowistry) that rely on getting source-mapping information about the MIR CFG that is as precise as possible. A test `maximal_mir_to_hir_coverage.rs` has been added to verify that this flag does not break anything. r? `@cjgillot` cc `@gavinleroy`
2022-12-06Rollup merge of #105250 - Swatinem:async-rm-resumety, r=oli-obkMatthias Krüger-16/+23
Replace usage of `ResumeTy` in async lowering with `Context` Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air. fixes https://github.com/rust-lang/rust/issues/104828 and https://github.com/rust-lang/rust/pull/104321#issuecomment-1336363077 r? `@oli-obk`
2022-12-06Rollup merge of #105174 - chenyukang:yukang/fix-105028-unused, r=eholkMatthias Krüger-1/+30
Suggest removing struct field from destructive binding only in shorthand scenario Fixes #105028
2022-12-06Rollup merge of #105004 - TaKO8Ki:fix-104897, r=wesleywiserMatthias Krüger-0/+49
Fix `emit_unused_delims_expr` ICE Fixes #104897 This is also related to #104433.
2022-12-06Auto merge of #105229 - saethlin:zst-writes-to-unions, r=oli-obkbors-34/+43
Re-enable removal of ZST writes to unions This was previously disabled because Miri was lazily allocating unsized locals. But we aren't doing that anymore since https://github.com/rust-lang/rust/pull/98831, so we can have this optimization back.
2022-12-06Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errorsMatthias Krüger-0/+130
Avoid ICE by accounting for missing type Fix #105330
2022-12-06Rollup merge of #105339 - BoxyUwU:wf_ct_kind_expr, r=TaKO8KiMatthias Krüger-0/+42
support `ConstKind::Expr` in `is_const_evaluatable` and `WfPredicates::compute` Fixes #105205 Currently we haven't implemented a way to evaluate `ConstKind::Expr(Expr::Binop(Add, 1, 2))` so I just left that with a `FIXME` and a `delay_span_bug` since I have no idea how to do that and it would make this a much larger (and more complicated) PR :P
2022-12-06Rollup merge of #105318 - compiler-errors:issue-105304, r=jackh726Matthias Krüger-0/+37
Make `get_impl_future_output_ty` work with AFIT Fixes #105304
2022-12-06Rollup merge of #105310 - compiler-errors:issue-105288, r=eholkMatthias Krüger-0/+13
Be more careful about unresolved exprs in suggestion Fixes #105288
2022-12-06Rollup merge of #105287 - compiler-errors:issue-105275, r=eholkMatthias Krüger-0/+22
Synthesize substitutions for bad auto traits in dyn types Auto traits are stored as just `DefId`s inside a `dyn Trait`'s existential predicates list. This is usually fine, since auto traits are forbidden to have generics -- but this becomes a problem for an ill-formed auto trait. But since this will always result in an error, just synthesize some dummy (error) substitutions which are used at least to keep trait selection code happy about the number of substs in a trait ref. Fixes #104808
2022-12-06Rollup merge of #105254 - cjgillot:issue-105251, r=oli-obkMatthias Krüger-0/+28
Recurse into nested impl-trait when computing variance. Fixes https://github.com/rust-lang/rust/issues/105251
2022-12-06Rollup merge of #105098 - lyming2007:issue-103869-fix, r=eholkMatthias Krüger-0/+31
propagate the error from parsing enum variant to the parser and emit out While parsing enum variant, the error message always disappear Because the error message that emit out is from main error of parser The information of enum variant disappears while parsing enum variant with error We only check the syntax of expecting token, i.e, in case https://github.com/rust-lang/rust/issues/103869 It will error it without telling the message that this error is from pasring enum variant. Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err Check the sub-error before emitting the main error of parser and attach it. Fix https://github.com/rust-lang/rust/issues/103869
2022-12-06Rollup merge of #105005 - estebank:where-clause-lts, r=compiler-errorsMatthias Krüger-0/+74
On E0195 point at where clause lifetime bounds Fix #104733
2022-12-06Replace usage of `ResumeTy` in async lowering with `Context`Arpad Borsos-16/+23
Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air.
2022-12-06add a test for #104260Takayuki Maeda-0/+14
2022-12-05review comment: add test caseEsteban Küber-1/+18
2022-12-05On E0195 point at where clause lifetime boundsEsteban Küber-0/+57
Fix #104733
2022-12-05Avoid ICE by accounting for missing typeEsteban Küber-0/+130
Fix #105330
2022-12-06Point at args in associated const fn pointersMichael Goulet-2/+4
2022-12-06Rollup merge of #105338 - estebank:other-impls, r=compiler-errorsYuki Okushi-393/+128
Tweak "the following other types implement trait" When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. r? `@compiler-errors`
2022-12-06Rollup merge of #105324 - compiler-errors:gat-where-clause-binding-obl, ↵Yuki Okushi-3/+35
r=jackh726 Point at GAT `where` clause when an obligation is unsatisfied Slightly helps with #105306
2022-12-06Rollup merge of #105315 - fmease:norm-subst-iat, r=compiler-errorsYuki Okushi-0/+44
Normalize inherent associated types after substitution Fixes #105314. r? ````@cjgillot```` (#105224) ````@rustbot```` label F-inherent_associated_types
2022-12-06Rollup merge of #105289 - Rageking8:fix-dupe-word-typos, r=cjgillotYuki Okushi-1/+1
Fix dupe word typos
2022-12-06Rollup merge of #105256 - GuillaumeGomez:comment-method-margins, r=notriddleYuki Okushi-0/+1
Add small comment explaining what `method-margins.goml` test is about r? `````@notriddle`````
2022-12-06Rollup merge of #104967 - willcrichton:fix-scrape-examples, r=notriddleYuki Okushi-0/+14
Fix UI issues with Rustdoc scrape-examples feature. A few regressions have been introduced into scrape-examples in the last few months. This commit fixes those regressions: * Help file was being loaded from the wrong place (introduced in f9e1f6ffdf03ec33cb29e20c88fc7bcc938c7f42). * CSS selector in JS has a typo (introduced in 14897180ae6a0506a5ad0a9f6a30ae1f75916179). * Line numbers in scraped example code snippets are overflowing (not sure if this was ever fixed). Changing from flexbox to grid display fixed this issue.
2022-12-06Auto merge of #105119 - JakobDegen:inline-experiments, r=cjgillotbors-93/+237
Disable top down MIR inlining The current MIR inliner has exponential behavior in some cases: <https://godbolt.org/z/7jnWah4fE>. The cause of this is top-down inlining, where we repeatedly do inlining like `call_a() => { call_b(); call_b(); }`. Each decision on its own seems to make sense, but the result is exponential. Disabling top-down inlining fundamentally prevents this. Each call site in the original, unoptimized source code is now considered for inlining exactly one time, which means that the total growth in MIR size is limited to number of call sites * inlining threshold. Top down inlining may be worth re-introducing at some point, but it needs to be accompanied with a principled way to prevent this kind of behavior.
2022-12-05support `Expr` in `is_const_evaluatable` and `compute`Boxy-0/+42
2022-12-05Support Option and similar enums as type of static variable with linkage ↵Peter Collingbourne-2/+3
attribute. Compiler MCP: https://github.com/rust-lang/compiler-team/issues/565
2022-12-05Move linkage type check to HIR analysis and fix semantics issues.Peter Collingbourne-28/+12
This ensures that the error is printed even for unused variables, as well as unifying the handling between the LLVM and GCC backends. This also fixes unusual behavior around exported Rust-defined variables with linkage attributes. With the previous behavior, it appears to be impossible to define such a variable such that it can actually be imported and used by another crate. This is because on the importing side, the variable is required to be a pointer, but on the exporting side, the type checker rejects static variables of pointer type because they do not implement `Sync`. Even if it were possible to import such a type, it appears that code generation on the importing side would add an unexpected additional level of pointer indirection, which would break type safety. This highlighted that the semantics of linkage on Rust-defined variables is different to linkage on foreign items. As such, we now model the difference with two different codegen attributes: linkage for Rust-defined variables, and import_linkage for foreign items. This change gives semantics to the test src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was previously expected to fail to compile. Therefore, convert it into a test that is expected to successfully compile. The update to the GCC backend is speculative and untested.
2022-12-05Tweak "the following other types implement trait"Esteban Küber-393/+128
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-12-05Restore missing newlineWill Crichton-1/+1
2022-12-05rustdoc: simplify CSS selectors on top-doc and non-exhaustive togglesMichael Howell-0/+10
This code uses a special `hideme` class anyway, so just style that.
2022-12-05Rollup merge of #105230 - cjgillot:issue-104312, r=petrochenkovMatthias Krüger-2/+17
Skip recording resolution for duplicated generic params. Turns out the fix was simpler than I thought. Fixes https://github.com/rust-lang/rust/issues/104312
2022-12-05Rollup merge of #105223 - lukas-code:(ExprWithBlock), r=petrochenkovMatthias Krüger-1/+66
suggest parenthesis around ExprWithBlock BinOp ExprWithBlock fix https://github.com/rust-lang/rust/issues/105179 fix https://github.com/rust-lang/rust/issues/102171
2022-12-05Rollup merge of #105180 - nbdd0121:async_track_caller, r=compiler-errorsMatthias Krüger-0/+25
Use proper HirId for async track_caller attribute check Fix #105134
2022-12-05Point at GAT where clause when unsatisfiedMichael Goulet-3/+35
2022-12-05Make get_impl_future_output_ty work with AFITMichael Goulet-0/+37
2022-12-05normalize inherent associated types after substitutionLeón Orell Valerian Liehr-0/+44
2022-12-05Be more careful about unresolved exprs in suggestionMichael Goulet-0/+13
2022-12-05fix dupe word typosRageking8-1/+1
2022-12-04Add -Z maximal-hir-to-mir-coverage flagWill Crichton-0/+11
2022-12-05Synthesize generics for bad auto traits in dyn typesMichael Goulet-0/+22
2022-12-05Auto merge of #104920 - compiler-errors:avoid-infcx-build, r=jackh726bors-4/+34
Avoid some `InferCtxt::build` calls Either because we're inside of an `InferCtxt` already, or because we're not in a place where we'd ever see inference vars. r? types