summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-07-11Add regression test for #112308Guillaume Gomez-26/+31
2023-07-08Downgrade addr2lineMark Rousskov-2/+2
This prevents #113238 from hitting stable while we sort out options for avoiding it. The downgrade is expected to not affect any users on stable, since it primarily affects tier 3 targets.
2023-07-08Fix linker failures when #[global_allocator] is used in a dependencybjorn3-0/+22
2023-07-08Fix dropping_copy_types lint from linting in match-arm with side-effectsUrgau-0/+38
2023-07-08Revert the lexing of c_str_literalsLeón Orell Valerian Liehr-16/+96
2023-07-08Add regression testLeón Orell Valerian Liehr-0/+24
2023-06-24Add test case for unsizing with nicheWesley Wiser-0/+30
2023-06-24Make struct layout not depend on unsizeable tailLukas Markeffsky-0/+25
2023-06-24Fix type-inference regression in #112225Arpad Borsos-0/+55
The type inference of argument-position closures and async blocks regressed in 1.70 as the evaluation order of async blocks changed, as they are not implicitly wrapped in an identity-function anymore. Fixes #112225 by making sure the evaluation order stays the same as it used to.
2023-06-24Disable alignment checks on i686-pc-windows-msvcBen Kimock-0/+22
2023-06-03add testslcnr-0/+78
2023-05-29Add a test for misaligned pointer derefs inside addr_of!Ben Kimock-0/+15
2023-05-27Rollup merge of #111181 - bvanjoi:fix-issue-111148, r=davidtwcoMatthias Krüger-0/+10
fix(parse): return unpected when current token is EOF close https://github.com/rust-lang/rust/issues/111148 #111148 panic occurred because [FatalError.raise()](https://github.com/bvanjoi/rust/blob/master/compiler/rustc_parse/src/parser/mod.rs#LL540C3-L540C3) was encountered which caused by `Eof` and `Pound`(the last token) had same span, when parsing `#` in `fn a<<i<Y<w<>#`. <img width="825" alt="image" src="https://user-images.githubusercontent.com/30187863/236612589-9e2c6a0b-18cd-408c-b636-c12a51cbcf1c.png"> There are a few ways to solve this problem: - Change the action assign for [self.last_unexpected_token_span](https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/diagnostics.rs#L592), for example, if current token is `Eof`, then return Error directly. - Avoid triggering the `FatalError` when the current token is `Eof`. I have chosen the second option because executing `expected_one_of_not_found` when the token is `Eof` but not in `ediable` seems reasonable.
2023-05-27Auto merge of #110975 - Amanieu:panic_count, r=joshtriplettbors-1/+29
Rework handling of recursive panics This PR makes 2 changes to how recursive panics works (a panic while handling a panic). 1. The panic count is no longer used to determine whether to force an immediate abort. This allows code like the following to work without aborting the process immediately: ```rust struct Double; impl Drop for Double { fn drop(&mut self) { // 2 panics are active at once, but this is fine since it is caught. std::panic::catch_unwind(|| panic!("twice")); } } let _d = Double; panic!("once"); ``` Rustc already generates appropriate code so that any exceptions escaping out of a `Drop` called in the unwind path will immediately abort the process. 2. Any panics while the panic hook is executing will force an immediate abort. This is necessary to avoid potential deadlocks like #110771 where a panic happens while holding the backtrace lock. We don't even try to print the panic message in this case since the panic may have been caused by `Display` impls. Fixes #110771
2023-05-27Rework handling of recursive panicsAmanieu d'Antras-1/+29
2023-05-27Rollup merge of #112014 - notriddle:notriddle/intra-doc-weird-syntax, ↵Guillaume Gomez-3/+416
r=GuillaumeGomez,fmease rustdoc: get unnormalized link destination for suggestions Fixes #110111 This bug, and the workaround in this PR, is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of link components. In particular, pulldown-cmark doesn't provide the offsets of the contents of a link. To work around this, rustdoc parser parts of a link definition itself. [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-27Rollup merge of #111997 - GuillaumeGomez:re-export-doc-hidden-macros, ↵Guillaume Gomez-3/+44
r=notriddle Fix re-export of doc hidden macro not showing up It's part of the follow-up of https://github.com/rust-lang/rust/pull/109697. Re-exports of doc hidden macros should be visible. It was the only kind of re-export of doc hidden item that didn't show up. r? `@notriddle`
2023-05-27Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkinGuillaume Gomez-17/+11
Remove DesugaringKind::Replace. A simple boolean flag is enough.
2023-05-27Auto merge of #111928 - c410-f3r:dqewdas, r=eholkbors-80/+17
[RFC-2011] Expand more expressions cc #44838 Expands `if`, `let`, `match` and also makes `generic_assert_internals` an allowed feature when using `assert!`. `#![feature(generic_assert)]` is still needed to activate everything. ```rust #![feature(generic_assert)] fn fun(a: Option<i32>, b: Option<i32>, c: Option<i32>) { assert!( if a.is_some() { 1 } else { 2 } == 3 && if let Some(elem) = b { elem == 4 } else { false } && match c { Some(_) => true, None => false } ); } fn main() { fun(Some(1), None, Some(2)); } // Assertion failed: assert!( // if a.is_some() { 1 } else { 2 } == 3 // && if let Some(elem) = b { elem == 4 } else { false } // && match c { Some(_) => true, None => false } // ); // // With captures: // a = Some(1) // b = None // c = Some(2) ```
2023-05-27Auto merge of #111348 - ozkanonur:remove-hardcoded-rustdoc-flags, ↵bors-4/+7
r=albertlarsan68,oli-obk new tool `rustdoc-gui-test` Implements new tool `rustdoc-gui-test` that allows using compiletest headers for `rustdoc-gui` tests.
2023-05-26rustdoc: get unnormalized link destination for suggestionsMichael Howell-3/+416
Fixes #110111 This bug, and the workaround in this commit, is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of link components. In particular, pulldown-cmark doesn't provide the offsets of the contents of a link. To work around this, rustdoc parser parts of a link definition itself. [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-27Auto merge of #111245 - fee1-dead-contrib:temp-fix-tuple-struct-field, r=lcnrbors-0/+109
fix for `Self` not respecting tuple Ctor privacy This PR fixes #111220 by checking the privacy of tuple constructors using `Self`, so the following code now errors ```rust mod my { pub struct Foo(&'static str); } impl AsRef<str> for my::Foo { fn as_ref(&self) -> &str { let Self(s) = self; // previously compiled, now errors correctly s } } ```
2023-05-27Correctly handle multiple re-exports of bang macros at the same levelGuillaume Gomez-1/+43
2023-05-27Rollup merge of #111991 - BoxyUwU:change_error_term_display, r=compiler-errorsMatthias Krüger-7/+7
Change ty and const error's pretty printing to be in braces `[const error]` and `[type error]` are slightly confusing since they look like either a slice with an error type for the element ty or a slice with a const argument as the type ???. This PR changes them to display as `{const error}` and `{type error}` similar to `{integer}`. This does not update the `Debug` impls for them which is done in #111988. I updated some error logic to avoid printing the substs of trait refs when unable to resolve an assoc item for them, this avoids emitting errors with `{type error}` in them. The substs are not relevant for these errors since we don't take into account the substs when resolving the assoc item. r? ``@compiler-errors``
2023-05-27Rollup merge of #111954 - asquared31415:unknown_ptr_type_error, ↵Matthias Krüger-2/+57
r=compiler-errors improve error message for calling a method on a raw pointer with an unknown pointee The old error message had very confusing wording. Also added some more test cases besides the single edition test. r? `@compiler-errors`
2023-05-27Rollup merge of #111714 - cjgillot:lint-expect-confusion, r=wesleywiserMatthias Krüger-0/+7
Stop confusing specification levels when computing expectations. Fixes https://github.com/rust-lang/rust/issues/111682
2023-05-26Auto merge of #103291 - ink-feather-org:typeid_no_struct_match, r=dtolnaybors-7/+17
Remove structural match from `TypeId` As per https://github.com/rust-lang/rust/pull/99189#issuecomment-1203720442. > Removing the structural equality might make sense, but is a breaking change that'd require a libs-api FCP. https://github.com/rust-lang/rust/pull/99189#issuecomment-1197545482 > Landing this PR now (well, mainly the "remove structural equality" part) would unblock `const fn` `TypeId::of`, since we only postponed that because we were guaranteeing too much. See also #99189, #101698
2023-05-26improve error message for calling a method on a raw pointer with an unknown ↵asquared31415-2/+57
pointee, and add some tests
2023-05-26Update tests for re-exports of doc hidden macrosGuillaume Gomez-3/+2
2023-05-26print const and type errors in braces not square bracketsBoxy-7/+7
2023-05-26Blesses UI tests, add known bug to typeid-equality-by-subtypingonestacked-7/+17
2023-05-26Rollup merge of #111951 - cjgillot:uninh-comment, r=NadrierilMatthias Krüger-76/+177
Correct comment on privately uninhabited pattern. Follow-up to https://github.com/rust-lang/rust/pull/111624#discussion_r1204767933 r? `@Nadrieril`
2023-05-26Rollup merge of #111947 - obeis:issue-111943, r=compiler-errorsMatthias Krüger-0/+38
Add test for RPIT defined with different hidden types with different substs Close #111943
2023-05-26fix for `Self` not respecting tuple Ctor privacyDeadbeef-0/+109
This fixes #111220 by checking the privacy of tuple constructors using `Self`, so the following code now errors ```rust mod my { pub struct Foo(&'static str); } impl AsRef<str> for my::Foo { fn as_ref(&self) -> &str { let Self(s) = self; // previously compiled, now errors correctly s } } ```
2023-05-26Add test for RPIT defined with different hidden types with different substsObei Sideg-0/+38
2023-05-25Rollup merge of #111945 - GuillaumeGomez:migrate-gui-test-color-7, r=notriddleMichael Goulet-42/+42
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? ``@notriddle``
2023-05-25Rollup merge of #111929 - compiler-errors:no-newline-apit, r=wesleywiserMichael Goulet-0/+44
Don't print newlines in APITs This is kind of a hack, but it gets the job done because the only "special" formatting that (afaict) `rustc_ast_pretty` does is break with newlines sometimes. Fixes rust-lang/measureme#207
2023-05-25Rollup merge of #111831 - clubby789:capture-slice-pat, r=cjgillotMichael Goulet-85/+196
Always capture slice when pattern requires checking the length Fixes #111751 cc ``@zirconium-n,`` I see you were assigned to this but I've fixed some similar issues in the past and had an idea on how to investigate this.
2023-05-25Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholkMichael Goulet-39/+131
Consider lint check attributes on match arms Currently, lint check attributes on match arms have no effect for some lints. This PR makes some lint passes to take those attributes into account. - `LateContextAndPass` for late lint doesn't update `last_node_with_lint_attrs` when it visits match arms. This leads to lint check attributes on match arms taking no effects on late lints that operate on the arms' pattern: ```rust match value { #[deny(non_snake_case)] PAT => {} // `non_snake_case` only warned due to default lint level } ``` To be honest, I'm not sure whether this is intentional or just an oversight. I've dug the implementation history and searched up issues/PRs but couldn't find any discussion on this. - `MatchVisitor` doesn't update its lint level when it visits match arms. This leads to check lint attributes on match arms taking no effect on some lints handled by this visitor, namely: `bindings_with_variant_name` and `irrefutable_let_patterns`. This seems to be a fallout from #108504. Before 05082f57afbf5d2e8fd7fb67719336d78b58e759, when the visitor operated on HIR rather than THIR, check lint attributes for the said lints were effective. [This playground][play] compiles successfully on current stable (1.69) but fails on current beta and nightly. I wasn't sure where best to place the test for this. Let me know if there's a better place. [play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=38432b79e535cb175f8f7d6d236d29c3 [play-match]: https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=629aa71b7c84b269beadeba664e2221d
2023-05-25Rollup merge of #111152 - lukas-code:markdown-parsers-are-hard, r=GuillaumeGomezMichael Goulet-10/+35
update `pulldown-cmark` to `0.9.3` This PR updates `pulldown-cmark` to version `0.9.3`, which does two main things: * Pulls in https://github.com/raphlinus/pulldown-cmark/pull/643 to fix https://github.com/rust-lang/rust/issues/111117 * Allows parsing strikethrough with single tildes, e.g. `~foo~` -> ~foo~. This matches the [GFM spec](https://github.github.com/gfm/#strikethrough-extension-). Full changelog: https://github.com/raphlinus/pulldown-cmark/pull/646
2023-05-25Add NOTE annotations.Camille GILLOT-75/+141
2023-05-25Remove DesugaringKind::Replace.Camille GILLOT-17/+11
2023-05-25Always capture slice when pattern requires checking the lengthclubby789-85/+196
2023-05-25Add inter-crate test.Camille GILLOT-40/+75
2023-05-25Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelixbors-4/+72
Support #[global_allocator] without the allocator shim This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim. Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist. To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors. (Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
2023-05-25rustdoc: add test for strikethrough with single tildesLukas Markeffsky-9/+10
Also merge the two almost identical strikethrough tests together and document what the test tests.
2023-05-25Migrate GUI colors test to original CSS color formatGuillaume Gomez-42/+42
2023-05-25Auto merge of #111473 - compiler-errors:opaques, r=lcnrbors-27/+69
Handle opaques in the new solver (take 2?) Implement a new strategy for handling opaques in the new solver. First, queries now carry both their defining anchor and the opaques that were defined in the inference context at the time of canonicalization. These are both used to pre-populate the inference context used by the canonical query. Second, use the normalizes-to goal to handle opaque types in the new solver. This means that opaques are handled like projection aliases, but with their own rules: * Can only define opaques if they're "defining uses" (i.e. have unique params in all their substs). * Can only define opaques that are from the anchor. * Opaque type definitions are modulo regions. So that means `Opaque<'?0r> = HiddenTy1` and `Opaque<?'1r> = HiddenTy2` equate `HiddenTy1` and `HiddenTy2` instead of defining them as different opaque type keys.
2023-05-25Rollup merge of #111624 - cjgillot:private-uninhabited-pattern, r=petrochenkovMatthias Krüger-1/+11
Emit diagnostic for privately uninhabited uncovered witnesses. Fixes https://github.com/rust-lang/rust/issues/104034 cc `@Nadrieril`
2023-05-25Strongly prefer alias and param-env boundsMichael Goulet-27/+69