about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-12-23Introduce `DiagCtxt::treat_next_err_as_bug`.Nicholas Nethercote-7/+8
To fix a FIXME.
2023-12-23Remove unnecessary line breaks from two string literals.Nicholas Nethercote-4/+2
2023-12-23Tweak `flush_delayed`.Nicholas Nethercote-10/+11
- Take a `Vec` instead of an iterator, because that's all that is needed. - Do an early return for the "no bugs" case. - Use `enumerate` and an `i == 0` test to identify the first bug. Those changes mean the `no_bug` variable can be removed, which I found hard to read.
2023-12-23Give `DiagnosticBuilder` a default type.Nicholas Nethercote-454/+250
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
2023-12-23Use `IntoDiagnostic` default.Nicholas Nethercote-2/+2
`IntoDiagnostic` defaults to `G = ErrorGuaranteed`. Take advantage of this in one place that currently doesn't.
2023-12-23Fix a couple of left-over references to `Handler`.Nicholas Nethercote-2/+2
2023-12-23Improve `use` items in `compiler/rustc_errors/src/lib.rs`.Nicholas Nethercote-30/+27
There are a bunch of them about 400 lines down, which is weird and annoying. This commit moves them up and puts them in a more sensible order.
2023-12-23Streamline `struct_lint_level`.Nicholas Nethercote-104/+13
We can just get the error level in the `match` and then use `DiagnosticBuilder::new`. This then means a number of `DiagCtxt` functions are no longer needed, because this was the one place that used them. Note: the commit changes the treatment of spans for `Expect`, which was different to all the other cases, but this has no apparent effect.
2023-12-23Add comments to `Level`.Nicholas Nethercote-5/+59
There is room for improvement on some of these, but something is better than nothing.
2023-12-22Auto merge of #119227 - weihanglo:update-cargo, r=weihanglobors-0/+1
Update cargo 10 commits in 1a2666ddd14cf0a255d4ddb61c63531c259a7b39..363a2d11320faf531f6aacd1ea067c6bc08343b9 2023-12-17 17:53:53 +0000 to 2023-12-22 03:12:42 +0000 - refactor: centralize git checkouts and db paths (rust-lang/cargo#13187) - Bump to 0.78.0; update changelog (rust-lang/cargo#13192) - refactor: custom error types for `cargo-util-schemas` (rust-lang/cargo#13186) - chore(deps): update rust crate handlebars to `v4.5.0` (rust-lang/cargo#13168) - Hold the mutate exclusive lock when vendoring (rust-lang/cargo#12509) - refactor: clean up package metadata (rust-lang/cargo#13184) - ci: check SemVer for cargo-util-schemas on CI (rust-lang/cargo#13185) - refactor(schemas): Pull out as `cargo-util-schemas` (rust-lang/cargo#13178) - chore(rustfix): rename Readme.md to README.md (rust-lang/cargo#13181) - chore(rustfix): remove useless clippy rules and fix a typo (rust-lang/cargo#13182) r? ghost
2023-12-22bootstrap: build doc for `cargo-util-schemasWeihang Lo-0/+1
2023-12-22Update cargoWeihang Lo-0/+0
2023-12-22Auto merge of #118824 - aliemjay:perf-region-cons, r=compiler-errorsbors-31/+37
use Vec for region constraints instead of BTreeMap ~1% perf gain Diagnostic regressions need more investigation. r? `@ghost`
2023-12-22Auto merge of #119221 - matthiaskrgr:rollup-dh9exqf, r=matthiaskrgrbors-41/+326
Rollup of 5 pull requests Successful merges: - #117601 (Add support for hexagon-unknown-none-elf as target) - #119169 (Rid the AST & HIR pretty printer of cruft) - #119194 (Run fuchsia tests only on nightly) - #119201 (tests: fix overaligned-constant to not over-specify getelementptr instr) - #119215 (Emits error if has bound regions) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-22Rollup merge of #119215 - mu001999:fix/119209, r=NilstriebMatthias Krüger-1/+16
Emits error if has bound regions Fixes #119209
2023-12-22Rollup merge of #119201 - durin42:overaligned-constant, r=Mark-SimulacrumMatthias Krüger-1/+1
tests: fix overaligned-constant to not over-specify getelementptr instr On LLVM 18 we get slightly different arguments here, so it's easier to just regex those away. The important details are all still asserted as I understand things. Fixes #119193. `@rustbot` label: +llvm-main
2023-12-22Rollup merge of #119194 - pietroalbini:pa-disable-fuchsia-non-nightly, r=tmandryMatthias Krüger-1/+7
Run fuchsia tests only on nightly We discovered in https://github.com/rust-lang/rust/pull/119187 that the Fuchsia tests only work on nightly, and so we cannot have the `x86_64-gnu-integration` job run on beta and stable. This PR gates the job to only run in the nightly channel. r? `@tmandry`
2023-12-22Rollup merge of #119169 - fmease:pretty-yeet-syntactic-cruft, r=compiler-errorsMatthias Krüger-37/+4
Rid the AST & HIR pretty printer of cruft Found while working on #119163. For `trait Trait: ?Sized {}` (semantically malformed), we currently output `trait Trait for ? Sized {}` (sic!) / `trait Trait for ? Sized { }` (sic!) if `-Zunpretty=expanded` / `-Zunpretty=hir` is passed. `trait Tr for Sized? {}` (#15521) and later also `trait Tr for ?Sized {}` (I guess, #20194) is former Rust syntax. Hence I'm removing these outdated branches. ~~This will conflict with #119163, therefore marking this PR as blocked.~~ Rebased
2023-12-22Rollup merge of #117601 - androm3da:hexagon_unknown_none_elf, r=petrochenkovMatthias Krüger-1/+298
Add support for hexagon-unknown-none-elf as target Still TODO: document usage details for new target
2023-12-23Update testr0cky-18/+6
2023-12-22Emits error if has bound regionsr0cky-1/+28
2023-12-22Auto merge of #118847 - eholk:for-await, r=compiler-errorsbors-79/+367
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened #118898 as the feature tracking issue. r? `@compiler-errors`
2023-12-22Rid the AST & HIR pretty printers of syntactic cruftLeón Orell Valerian Liehr-37/+4
2023-12-22Auto merge of #116821 - Nadrieril:fix-opaque-ice, r=compiler-errorsbors-33/+284
Exhaustiveness: reveal opaque types properly Previously, exhaustiveness had no clear policy around opaque types. In this PR I propose the following policy: within the body of an item that defines the hidden type of some opaque type, exhaustiveness checking on a value of that opaque type is performed using the concrete hidden type inferred in this body. I'm not sure how consistent this is with other operations allowed on opaque types; I believe this will require FCP. From what I can tell, this doesn't change anything for non-empty types. The observable changes are: - when the real type is uninhabited, matches within the defining scopes can now rely on that for exhaustiveness, e.g.: ```rust #[derive(Copy, Clone)] enum Void {} fn return_never_rpit(x: Void) -> impl Copy { if false { match return_never_rpit(x) {} } x } ``` - this properly fixes ICEs like https://github.com/rust-lang/rust/issues/117100 that occurred because a same match could have some patterns where the type is revealed and some where it is not. Bonus subtle point: if `x` is opaque, a match like `match x { ("", "") => {} ... }` will constrain its type ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=901d715330eac40339b4016ac566d6c3)). This is not the case for `match x {}`: this will not constain the type, and will only compile if something else constrains the type to be empty. Fixes https://github.com/rust-lang/rust/issues/117100 r? `@oli-obk` Edited for precision of the wording [Included](https://github.com/rust-lang/rust/pull/116821#issuecomment-1813171764) in the FCP on this PR is this rule: > Within the body of an item that defines the hidden type of some opaque type, exhaustiveness checking on a value of that opaque type is performed using the concrete hidden type inferred in this body.
2023-12-22Auto merge of #119173 - compiler-errors:direct-coro-kind, r=TaKO8Kibors-4/+19
Encode `CoroutineKind` directly Probably a quick optimization? r? `@ghost`
2023-12-22Auto merge of #119163 - fmease:refactor-ast-trait-bound-modifiers, ↵bors-200/+194
r=compiler-errors Refactor AST trait bound modifiers Instead of having two types to represent trait bound modifiers in the parser / the AST (`parser::ty::BoundModifiers` & `ast::TraitBoundModifier`), only to map one to the other later, just use `parser::ty::BoundModifiers` (moved & renamed to `ast::TraitBoundModifiers`). The struct type is more extensible and easier to deal with (see [here](https://github.com/rust-lang/rust/pull/119099/files#r1430749981) and [here](https://github.com/rust-lang/rust/pull/119099/files#r1430752116) for context) since it more closely models what it represents: A compound of two kinds of modifiers, constness and polarity. Modeling this as an enum (the now removed `ast::TraitBoundModifier`) meant one had to add a new variant per *combination* of modifier kind, which simply isn't scalable and which lead to a lot of explicit non-DRY matches. NB: `hir::TraitBoundModifier` being an enum is fine since HIR doesn't need to worry representing invalid modifier kind combinations as those get rejected during AST validation thereby immensely cutting down the number of possibilities.
2023-12-22Auto merge of #119097 - nnethercote:fix-EmissionGuarantee, r=compiler-errorsbors-701/+605
Fix `EmissionGuarantee` There are some problems with the `DiagCtxt` API related to `EmissionGuarantee`. This PR fixes them. r? `@compiler-errors`
2023-12-21tests: fix overaligned-constant to not over-specify getelementptr instrAugie Fackler-1/+1
On LLVM 18 we get slightly different arguments here, so it's easier to just regex those away. The important details are all still asserted as I understand things. Fixes #119193. @rustbot label: +llvm-main
2023-12-21Auto merge of #119190 - matthiaskrgr:rollup-jvl8vkj, r=matthiaskrgrbors-53/+252
Rollup of 5 pull requests Successful merges: - #118729 (Add release notes for 1.75.0) - #119124 (don't build `rust-analyzer-proc-macro-srv` on def config ) - #119154 (Simple modification of `non_lifetime_binders`'s diagnostic information to adapt to type binders) - #119176 (Fix name error in aarch64_apple_watchos tier 3 target) - #119182 (Update sysinfo version to 0.30.0) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-21Add support for hexagon-unknown-none-elf as targetBrian Cain-1/+298
Signed-off-by: Brian Cain <bcain@quicinc.com>
2023-12-21run fuchsia tests only on nightlyPietro Albini-1/+7
2023-12-21Rollup merge of #119182 - GuillaumeGomez:update-sysinfo, r=onur-ozkanMatthias Krüger-7/+7
Update sysinfo version to 0.30.0 Following last `sysinfo` update. Nothing much needs to be changed here apparently. r? `@onur-ozkan`
2023-12-21Rollup merge of #119176 - leohowell:fix-apple-watchos-target-name-error, r=lqdMatthias Krüger-1/+1
Fix name error in aarch64_apple_watchos tier 3 target fix llvm_target wrong name `aarch-apple-watchos` to `aarch64-apple-watchos`, sorry for my mistake. previous pr: https://github.com/rust-lang/rust/pull/119074 r? compiler-team
2023-12-21Rollup merge of #119154 - surechen:fix_119067, r=fmeaseMatthias Krüger-40/+91
Simple modification of `non_lifetime_binders`'s diagnostic information to adapt to type binders fixes #119067 Replace diagnostic information "lifetime bounds cannot be used in this context" to "bounds cannot be used in this context". ```rust #![allow(incomplete_features)] #![feature(non_lifetime_binders)] trait Trait {} trait Trait2 where for <T: Trait> ():{} //~^ ERROR bounds cannot be used in this context ```
2023-12-21Rollup merge of #119124 - onur-ozkan:help-118861, r=Mark-SimulacrumMatthias Krüger-5/+28
don't build `rust-analyzer-proc-macro-srv` on def config Should be very easy to understand when reviewing commit-by-commit. Blocker for #118861
2023-12-21Rollup merge of #118729 - cuviper:relnotes-1.75.0, r=pietroalbiniMatthias Krüger-0/+125
Add release notes for 1.75.0 cc `@rust-lang/release` r? `@Mark-Simulacrum`
2023-12-21add a new change in change-trackeronur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-21apply last suggestions from code reviewPietro Albini-1/+1
2023-12-21Update sysinfo version to 0.30.0Guillaume Gomez-7/+7
2023-12-21Auto merge of #119181 - pietroalbini:pa-1.77, r=pietroalbinibors-1/+1
Bump version number to 1.77.0
2023-12-21bump version number to 1.77.0Pietro Albini-1/+1
2023-12-21Fix name error in aarch64_apple_watchos tier 3 targetLeo Howell-1/+1
2023-12-21Auto merge of #119056 - cjgillot:codegen-overalign, r=wesleywiserbors-1/+37
Tolerate overaligned MIR constants for codegen. Fixes https://github.com/rust-lang/rust/issues/117761 cc `@saethlin`
2023-12-21Simple modification of diagnostic informationsurechen-40/+91
fixes #119067
2023-12-21Encode CoroutineKind directlyMichael Goulet-4/+19
2023-12-21Auto merge of #119170 - matthiaskrgr:rollup-nllgdf2, r=matthiaskrgrbors-45/+182
Rollup of 5 pull requests Successful merges: - #119135 (Fix crash due to `CrateItem::kind()` not handling constructors) - #119141 (Add method to get instance instantiation arguments) - #119145 (Give `VariantData::Struct` named fields, to clairfy `recovered`.) - #119167 (E0761: module directory has .rs suffix) - #119168 (resolve: Stop feeding visibilities for import list stems) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-20Rollup merge of #119168 - petrochenkov:feedvis4, r=compiler-errorsMatthias Krüger-2/+21
resolve: Stop feeding visibilities for import list stems Fixes https://github.com/rust-lang/rust/issues/119126
2023-12-20Rollup merge of #119167 - alef:patch-1, r=compiler-errorsMatthias Krüger-1/+1
E0761: module directory has .rs suffix `rustc --explain E0761` example seems wrong.
2023-12-20Rollup merge of #119145 - aDotInTheVoid:variantdata-struct-struct, ↵Matthias Krüger-40/+51
r=compiler-errors Give `VariantData::Struct` named fields, to clairfy `recovered`. Implements https://github.com/rust-lang/rust/pull/119121#discussion_r1431467066. Supersedes #119121 This way, it's clear what the bool fields means, instead of having to find where it's generated. Changes both ast and hir. r? `@compiler-errors`
2023-12-20Rollup merge of #119141 - celinval:smir-instance-args, r=compiler-errorsMatthias Krüger-0/+15
Add method to get instance instantiation arguments Add a method to get the instance instantiation arguments, and include that information in the instance debug.