Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0f1e965

Browse files
committedJan 6, 2025
Auto merge of #135172 - matthiaskrgr:rollup-8fe3fxi, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`) - #134771 (Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill) - #134951 (Suppress host effect predicates if underlying trait doesn't hold) - #135097 (bootstrap: Consolidate coverage test suite steps into a single step) - #135146 (Don't enable anyhow's `backtrace` feature in opt-dist) - #135153 (chore: remove redundant words in comment) - #135157 (Move the has_errors check in rustdoc back to after TyCtxt is created) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 243d2ca + 873ae7a commit 0f1e965

File tree

20 files changed

+269
-163
lines changed

20 files changed

+269
-163
lines changed
 

‎Cargo.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ name = "anyhow"
185185
version = "1.0.95"
186186
source = "registry+https://github.com/rust-lang/crates.io-index"
187187
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
188-
dependencies = [
189-
"backtrace",
190-
]
191188

192189
[[package]]
193190
name = "ar_archive_writer"

‎compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,13 +1845,18 @@ pub(super) fn check_coroutine_obligations(
18451845

18461846
debug!(?typeck_results.coroutine_stalled_predicates);
18471847

1848+
let mode = if tcx.next_trait_solver_globally() {
1849+
TypingMode::post_borrowck_analysis(tcx, def_id)
1850+
} else {
1851+
TypingMode::analysis_in_body(tcx, def_id)
1852+
};
1853+
18481854
let infcx = tcx
18491855
.infer_ctxt()
18501856
// typeck writeback gives us predicates with their regions erased.
18511857
// As borrowck already has checked lifetimes, we do not need to do it again.
18521858
.ignoring_regions()
1853-
// FIXME(#132279): This should eventually use the already defined hidden types.
1854-
.build(TypingMode::analysis_in_body(tcx, def_id));
1859+
.build(mode);
18551860

18561861
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
18571862
for (predicate, cause) in &typeck_results.coroutine_stalled_predicates {
@@ -1864,12 +1869,14 @@ pub(super) fn check_coroutine_obligations(
18641869
return Err(infcx.err_ctxt().report_fulfillment_errors(errors));
18651870
}
18661871

1867-
// Check that any hidden types found when checking these stalled coroutine obligations
1868-
// are valid.
1869-
for (key, ty) in infcx.take_opaque_types() {
1870-
let hidden_type = infcx.resolve_vars_if_possible(ty.hidden_type);
1871-
let key = infcx.resolve_vars_if_possible(key);
1872-
sanity_check_found_hidden_type(tcx, key, hidden_type)?;
1872+
if !tcx.next_trait_solver_globally() {
1873+
// Check that any hidden types found when checking these stalled coroutine obligations
1874+
// are valid.
1875+
for (key, ty) in infcx.take_opaque_types() {
1876+
let hidden_type = infcx.resolve_vars_if_possible(ty.hidden_type);
1877+
let key = infcx.resolve_vars_if_possible(key);
1878+
sanity_check_found_hidden_type(tcx, key, hidden_type)?;
1879+
}
18731880
}
18741881

18751882
Ok(())

‎compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
114114
//
115115
// We rely on a few heuristics to identify cases where this root
116116
// obligation is more important than the leaf obligation:
117-
let (main_trait_predicate, o) = if let ty::PredicateKind::Clause(
117+
let (main_trait_predicate, main_obligation) = if let ty::PredicateKind::Clause(
118118
ty::ClauseKind::Trait(root_pred)
119119
) = root_obligation.predicate.kind().skip_binder()
120120
&& !leaf_trait_predicate.self_ty().skip_binder().has_escaping_bound_vars()
@@ -199,7 +199,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
199199
notes,
200200
parent_label,
201201
append_const_msg,
202-
} = self.on_unimplemented_note(main_trait_predicate, o, &mut long_ty_file);
202+
} = self.on_unimplemented_note(main_trait_predicate, main_obligation, &mut long_ty_file);
203203

204204
let have_alt_message = message.is_some() || label.is_some();
205205
let is_try_conversion = self.is_try_conversion(span, main_trait_ref.def_id());
@@ -538,23 +538,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
538538
}
539539

540540
ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
541-
// FIXME(const_trait_impl): We should recompute the predicate with `~const`
542-
// if it's `const`, and if it holds, explain that this bound only
543-
// *conditionally* holds. If that fails, we should also do selection
544-
// to drill this down to an impl or built-in source, so we can
545-
// point at it and explain that while the trait *is* implemented,
546-
// that implementation is not const.
547-
let err_msg = self.get_standard_error_message(
548-
bound_predicate.rebind(ty::TraitPredicate {
549-
trait_ref: predicate.trait_ref,
550-
polarity: ty::PredicatePolarity::Positive,
551-
}),
552-
None,
553-
Some(predicate.constness),
554-
None,
555-
String::new(),
556-
);
557-
struct_span_code_err!(self.dcx(), span, E0277, "{}", err_msg)
541+
self.report_host_effect_error(bound_predicate.rebind(predicate), obligation.param_env, span)
558542
}
559543

560544
ty::PredicateKind::Subtype(predicate) => {
@@ -763,6 +747,41 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
763747
applied_do_not_recommend
764748
}
765749

750+
fn report_host_effect_error(
751+
&self,
752+
predicate: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>,
753+
param_env: ty::ParamEnv<'tcx>,
754+
span: Span,
755+
) -> Diag<'a> {
756+
// FIXME(const_trait_impl): We should recompute the predicate with `~const`
757+
// if it's `const`, and if it holds, explain that this bound only
758+
// *conditionally* holds. If that fails, we should also do selection
759+
// to drill this down to an impl or built-in source, so we can
760+
// point at it and explain that while the trait *is* implemented,
761+
// that implementation is not const.
762+
let trait_ref = predicate.map_bound(|predicate| ty::TraitPredicate {
763+
trait_ref: predicate.trait_ref,
764+
polarity: ty::PredicatePolarity::Positive,
765+
});
766+
let err_msg = self.get_standard_error_message(
767+
trait_ref,
768+
None,
769+
Some(predicate.constness()),
770+
None,
771+
String::new(),
772+
);
773+
let mut diag = struct_span_code_err!(self.dcx(), span, E0277, "{}", err_msg);
774+
if !self.predicate_may_hold(&Obligation::new(
775+
self.tcx,
776+
ObligationCause::dummy(),
777+
param_env,
778+
trait_ref,
779+
)) {
780+
diag.downgrade_to_delayed_bug();
781+
}
782+
diag
783+
}
784+
766785
fn emit_specialized_closure_kind_error(
767786
&self,
768787
obligation: &PredicateObligation<'tcx>,

‎compiler/rustc_trait_selection/src/solve/fulfill.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use rustc_infer::traits::{
1010
self, FromSolverError, MismatchedProjectionTypes, Obligation, ObligationCause,
1111
ObligationCauseCode, PredicateObligation, PredicateObligations, SelectionError, TraitEngine,
1212
};
13-
use rustc_middle::bug;
1413
use rustc_middle::ty::error::{ExpectedFound, TypeError};
1514
use rustc_middle::ty::{self, TyCtxt};
15+
use rustc_middle::{bug, span_bug};
1616
use rustc_next_trait_solver::solve::{GenerateProofTree, HasChanged, SolverDelegateEvalExt as _};
1717
use tracing::{instrument, trace};
1818

@@ -258,6 +258,23 @@ fn fulfillment_error_for_no_solution<'tcx>(
258258
MismatchedProjectionTypes { err: TypeError::Mismatch },
259259
)
260260
}
261+
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, expected_ty)) => {
262+
let ct_ty = match ct.kind() {
263+
ty::ConstKind::Unevaluated(uv) => {
264+
infcx.tcx.type_of(uv.def).instantiate(infcx.tcx, uv.args)
265+
}
266+
ty::ConstKind::Param(param_ct) => param_ct.find_ty_from_env(obligation.param_env),
267+
_ => span_bug!(
268+
obligation.cause.span,
269+
"ConstArgHasWrongType failed but we don't know how to compute type"
270+
),
271+
};
272+
FulfillmentErrorCode::Select(SelectionError::ConstArgHasWrongType {
273+
ct,
274+
ct_ty,
275+
expected_ty,
276+
})
277+
}
261278
ty::PredicateKind::NormalizesTo(..) => {
262279
FulfillmentErrorCode::Project(MismatchedProjectionTypes { err: TypeError::Mismatch })
263280
}

‎library/std/src/ffi/os_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl OsString {
550550
OsStr::from_inner_mut(self.inner.leak())
551551
}
552552

553-
/// Truncate the the `OsString` to the specified length.
553+
/// Truncate the `OsString` to the specified length.
554554
///
555555
/// # Panics
556556
/// Panics if `len` does not lie on a valid `OsStr` boundary

‎library/std/src/pipe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl PipeReader {
9797
/// let mut jobs = vec![];
9898
/// let (reader, mut writer) = std::pipe::pipe()?;
9999
///
100-
/// // Write NUM_SLOT characters the the pipe.
100+
/// // Write NUM_SLOT characters the pipe.
101101
/// writer.write_all(&[b'|'; NUM_SLOT as usize])?;
102102
///
103103
/// // Spawn several processes that read a character from the pipe, do some work, then

‎library/std/src/sync/poison/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl<T: ?Sized> Mutex<T> {
534534
/// # Errors
535535
///
536536
/// If another user of this mutex panicked while holding the mutex, then
537-
/// this call will return an error containing the the underlying data
537+
/// this call will return an error containing the underlying data
538538
/// instead.
539539
///
540540
/// # Examples

‎src/bootstrap/src/core/build_steps/test.rs

Lines changed: 68 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::utils::helpers::{
2727
linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date,
2828
};
2929
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
30-
use crate::{CLang, DocTests, GitRepo, Mode, envify};
30+
use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify};
3131

3232
const ADB_TEST_DIR: &str = "/data/local/tmp/work";
3333

@@ -1185,53 +1185,6 @@ macro_rules! test {
11851185
};
11861186
}
11871187

1188-
/// Declares an alias for running the [`Coverage`] tests in only one mode.
1189-
/// Adapted from [`test`].
1190-
macro_rules! coverage_test_alias {
1191-
(
1192-
$( #[$attr:meta] )* // allow docstrings and attributes
1193-
$name:ident {
1194-
alias_and_mode: $alias_and_mode:expr, // &'static str
1195-
default: $default:expr, // bool
1196-
only_hosts: $only_hosts:expr // bool
1197-
$( , )? // optional trailing comma
1198-
}
1199-
) => {
1200-
$( #[$attr] )*
1201-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1202-
pub struct $name {
1203-
pub compiler: Compiler,
1204-
pub target: TargetSelection,
1205-
}
1206-
1207-
impl $name {
1208-
const MODE: &'static str = $alias_and_mode;
1209-
}
1210-
1211-
impl Step for $name {
1212-
type Output = ();
1213-
const DEFAULT: bool = $default;
1214-
const ONLY_HOSTS: bool = $only_hosts;
1215-
1216-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1217-
// Register the mode name as a command-line alias.
1218-
// This allows `x test coverage-map` and `x test coverage-run`.
1219-
run.alias($alias_and_mode)
1220-
}
1221-
1222-
fn make_run(run: RunConfig<'_>) {
1223-
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
1224-
1225-
run.builder.ensure($name { compiler, target: run.target });
1226-
}
1227-
1228-
fn run(self, builder: &Builder<'_>) {
1229-
Coverage::run_coverage_tests(builder, self.compiler, self.target, Self::MODE);
1230-
}
1231-
}
1232-
};
1233-
}
1234-
12351188
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
12361189
pub struct RunMakeSupport {
12371190
pub compiler: Compiler,
@@ -1473,99 +1426,96 @@ impl Step for RunMake {
14731426

14741427
test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly", default: true });
14751428

1476-
/// Coverage tests are a bit more complicated than other test suites, because
1477-
/// we want to run the same set of test files in multiple different modes,
1478-
/// in a way that's convenient and flexible when invoked manually.
1479-
///
1480-
/// This combined step runs the specified tests (or all of `tests/coverage`)
1481-
/// in both "coverage-map" and "coverage-run" modes.
1482-
///
1483-
/// Used by:
1484-
/// - `x test coverage`
1485-
/// - `x test tests/coverage`
1486-
/// - `x test tests/coverage/trivial.rs` (etc)
1487-
///
1488-
/// (Each individual mode also has its own step that will run the tests in
1489-
/// just that mode.)
1490-
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1429+
/// Runs the coverage test suite at `tests/coverage` in some or all of the
1430+
/// coverage test modes.
1431+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
14911432
pub struct Coverage {
14921433
pub compiler: Compiler,
14931434
pub target: TargetSelection,
1435+
pub mode: &'static str,
14941436
}
14951437

14961438
impl Coverage {
14971439
const PATH: &'static str = "tests/coverage";
14981440
const SUITE: &'static str = "coverage";
1499-
1500-
/// Runs the coverage test suite (or a user-specified subset) in one mode.
1501-
///
1502-
/// This same function is used by the multi-mode step ([`Coverage`]) and by
1503-
/// the single-mode steps ([`CoverageMap`] and [`CoverageRun`]), to help
1504-
/// ensure that they all behave consistently with each other, regardless of
1505-
/// how the coverage tests have been invoked.
1506-
fn run_coverage_tests(
1507-
builder: &Builder<'_>,
1508-
compiler: Compiler,
1509-
target: TargetSelection,
1510-
mode: &'static str,
1511-
) {
1512-
// Like many other test steps, we delegate to a `Compiletest` step to
1513-
// actually run the tests. (See `test_definitions!`.)
1514-
builder.ensure(Compiletest {
1515-
compiler,
1516-
target,
1517-
mode,
1518-
suite: Self::SUITE,
1519-
path: Self::PATH,
1520-
compare_mode: None,
1521-
});
1522-
}
1441+
const ALL_MODES: &[&str] = &["coverage-map", "coverage-run"];
15231442
}
15241443

15251444
impl Step for Coverage {
15261445
type Output = ();
1527-
/// We rely on the individual CoverageMap/CoverageRun steps to run themselves.
1528-
const DEFAULT: bool = false;
1529-
/// When manually invoked, try to run as much as possible.
1446+
const DEFAULT: bool = true;
15301447
/// Compiletest will automatically skip the "coverage-run" tests if necessary.
15311448
const ONLY_HOSTS: bool = false;
15321449

1533-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1534-
// Take responsibility for command-line paths within `tests/coverage`.
1535-
run.suite_path(Self::PATH)
1450+
fn should_run(mut run: ShouldRun<'_>) -> ShouldRun<'_> {
1451+
// Support various invocation styles, including:
1452+
// - `./x test coverage`
1453+
// - `./x test tests/coverage/trivial.rs`
1454+
// - `./x test coverage-map`
1455+
// - `./x test coverage-run -- tests/coverage/trivial.rs`
1456+
run = run.suite_path(Self::PATH);
1457+
for mode in Self::ALL_MODES {
1458+
run = run.alias(mode);
1459+
}
1460+
run
15361461
}
15371462

15381463
fn make_run(run: RunConfig<'_>) {
15391464
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
1465+
let target = run.target;
1466+
1467+
// List of (coverage) test modes that the coverage test suite will be
1468+
// run in. It's OK for this to contain duplicates, because the call to
1469+
// `Builder::ensure` below will take care of deduplication.
1470+
let mut modes = vec![];
1471+
1472+
// From the pathsets that were selected on the command-line (or by default),
1473+
// determine which modes to run in.
1474+
for path in &run.paths {
1475+
match path {
1476+
PathSet::Set(_) => {
1477+
for mode in Self::ALL_MODES {
1478+
if path.assert_single_path().path == Path::new(mode) {
1479+
modes.push(mode);
1480+
break;
1481+
}
1482+
}
1483+
}
1484+
PathSet::Suite(_) => {
1485+
modes.extend(Self::ALL_MODES);
1486+
break;
1487+
}
1488+
}
1489+
}
1490+
1491+
// Skip any modes that were explicitly skipped/excluded on the command-line.
1492+
// FIXME(Zalathar): Integrate this into central skip handling somehow?
1493+
modes.retain(|mode| !run.builder.config.skip.iter().any(|skip| skip == Path::new(mode)));
1494+
1495+
// FIXME(Zalathar): Make these commands skip all coverage tests, as expected:
1496+
// - `./x test --skip=tests`
1497+
// - `./x test --skip=tests/coverage`
1498+
// - `./x test --skip=coverage`
1499+
// Skip handling currently doesn't have a way to know that skipping the coverage
1500+
// suite should also skip the `coverage-map` and `coverage-run` aliases.
15401501

1541-
run.builder.ensure(Coverage { compiler, target: run.target });
1502+
for mode in modes {
1503+
run.builder.ensure(Coverage { compiler, target, mode });
1504+
}
15421505
}
15431506

15441507
fn run(self, builder: &Builder<'_>) {
1545-
// Run the specified coverage tests (possibly all of them) in both modes.
1546-
Self::run_coverage_tests(builder, self.compiler, self.target, CoverageMap::MODE);
1547-
Self::run_coverage_tests(builder, self.compiler, self.target, CoverageRun::MODE);
1548-
}
1549-
}
1550-
1551-
coverage_test_alias! {
1552-
/// Runs the `tests/coverage` test suite in "coverage-map" mode only.
1553-
/// Used by `x test` and `x test coverage-map`.
1554-
CoverageMap {
1555-
alias_and_mode: "coverage-map",
1556-
default: true,
1557-
only_hosts: false,
1558-
}
1559-
}
1560-
coverage_test_alias! {
1561-
/// Runs the `tests/coverage` test suite in "coverage-run" mode only.
1562-
/// Used by `x test` and `x test coverage-run`.
1563-
CoverageRun {
1564-
alias_and_mode: "coverage-run",
1565-
default: true,
1566-
// Compiletest knows how to automatically skip these tests when cross-compiling,
1567-
// but skipping the whole step here makes it clearer that they haven't run at all.
1568-
only_hosts: true,
1508+
let Self { compiler, target, mode } = self;
1509+
// Like other compiletest suite test steps, delegate to an internal
1510+
// compiletest task to actually run the tests.
1511+
builder.ensure(Compiletest {
1512+
compiler,
1513+
target,
1514+
mode,
1515+
suite: Self::SUITE,
1516+
path: Self::PATH,
1517+
compare_mode: None,
1518+
});
15691519
}
15701520
}
15711521

‎src/bootstrap/src/core/builder/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,6 @@ impl<'a> Builder<'a> {
944944
test::Ui,
945945
test::Crashes,
946946
test::Coverage,
947-
test::CoverageMap,
948-
test::CoverageRun,
949947
test::MirOpt,
950948
test::Codegen,
951949
test::CodegenUnits,

‎src/bootstrap/src/core/builder/tests.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,3 +828,36 @@ fn test_test_compiler() {
828828

829829
assert_eq!((compiler, cranelift, gcc), (true, false, false));
830830
}
831+
832+
#[test]
833+
fn test_test_coverage() {
834+
struct Case {
835+
cmd: &'static [&'static str],
836+
expected: &'static [&'static str],
837+
}
838+
let cases = &[
839+
Case { cmd: &["test"], expected: &["coverage-map", "coverage-run"] },
840+
Case { cmd: &["test", "coverage"], expected: &["coverage-map", "coverage-run"] },
841+
Case { cmd: &["test", "coverage-map"], expected: &["coverage-map"] },
842+
Case { cmd: &["test", "coverage-run"], expected: &["coverage-run"] },
843+
Case { cmd: &["test", "coverage", "--skip=coverage"], expected: &[] },
844+
Case { cmd: &["test", "coverage", "--skip=tests/coverage"], expected: &[] },
845+
Case { cmd: &["test", "coverage", "--skip=coverage-map"], expected: &["coverage-run"] },
846+
Case { cmd: &["test", "coverage", "--skip=coverage-run"], expected: &["coverage-map"] },
847+
Case { cmd: &["test", "--skip=coverage-map", "--skip=coverage-run"], expected: &[] },
848+
Case { cmd: &["test", "coverage", "--skip=tests"], expected: &[] },
849+
];
850+
851+
for &Case { cmd, expected } in cases {
852+
// Print each test case so that if one fails, the most recently printed
853+
// case is the one that failed.
854+
println!("Testing case: {cmd:?}");
855+
let cmd = cmd.iter().copied().map(str::to_owned).collect::<Vec<_>>();
856+
let config = configure_with_args(&cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
857+
let mut cache = run_build(&config.paths.clone(), config);
858+
859+
let modes =
860+
cache.all::<test::Coverage>().iter().map(|(step, ())| step.mode).collect::<Vec<_>>();
861+
assert_eq!(modes, expected);
862+
}
863+
}

‎src/ci/docker/host-x86_64/dist-riscv64-linux/patches/gcc/8.5.0/0002-hidden-jump-target.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=28509
1010
And this is the first version of the proposed binutils patch,
1111
https://sourceware.org/pipermail/binutils/2021-November/118398.html
1212

13-
After applying the binutils patch, I get the the unexpected error when
13+
After applying the binutils patch, I get the unexpected error when
1414
building libgcc,
1515

1616
/scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42:

‎src/librustdoc/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,11 +865,11 @@ fn main_args(
865865
}
866866

867867
let krate = rustc_interface::passes::parse(sess);
868-
if sess.dcx().has_errors().is_some() {
869-
sess.dcx().fatal("Compilation failed, aborting rustdoc");
870-
}
871-
872868
rustc_interface::create_and_enter_global_ctxt(compiler, krate, |tcx| {
869+
if sess.dcx().has_errors().is_some() {
870+
sess.dcx().fatal("Compilation failed, aborting rustdoc");
871+
}
872+
873873
let (krate, render_opts, mut cache) = sess.time("run_global_ctxt", || {
874874
core::run_global_ctxt(tcx, show_coverage, render_options, output_format)
875875
});

‎src/tools/opt-dist/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
build_helper = { path = "../../build_helper" }
88
env_logger = "0.11"
99
log = "0.4"
10-
anyhow = { version = "1", features = ["backtrace"] }
10+
anyhow = "1"
1111
humantime = "2"
1212
humansize = "2"
1313
sysinfo = { version = "0.31.2", default-features = false, features = ["disk"] }

‎tests/ui/coroutine/issue-52304.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//@ check-pass
2+
//@ revisions: current next
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
24

35
#![feature(coroutines, coroutine_trait)]
46

‎tests/ui/duplicate/multiple-types-with-same-name-and-derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Here, there are two types with the same name. One of these has a `derive` annotation, but in the
2-
// expansion these `impl`s are associated to the the *other* type. There is a suggestion to remove
2+
// expansion these `impl`s are associated to the *other* type. There is a suggestion to remove
33
// unneeded type parameters, but because we're now point at a type with no type parameters, the
44
// suggestion would suggest removing code from an empty span, which would ICE in nightly.
55
//
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Make sure we don't issue *two* error messages for the trait predicate *and* host predicate.
2+
3+
#![feature(const_trait_impl)]
4+
5+
#[const_trait]
6+
trait Trait {
7+
type Out;
8+
}
9+
10+
const fn needs_const<T: ~const Trait>(_: &T) {}
11+
12+
const IN_CONST: () = {
13+
needs_const(&());
14+
//~^ ERROR the trait bound `(): Trait` is not satisfied
15+
};
16+
17+
const fn conditionally_const() {
18+
needs_const(&());
19+
//~^ ERROR the trait bound `(): Trait` is not satisfied
20+
}
21+
22+
fn main() {}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
error[E0277]: the trait bound `(): Trait` is not satisfied
2+
--> $DIR/double-error-for-unimplemented-trait.rs:13:15
3+
|
4+
LL | needs_const(&());
5+
| ----------- ^^^ the trait `Trait` is not implemented for `()`
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
help: this trait has no implementations, consider adding one
10+
--> $DIR/double-error-for-unimplemented-trait.rs:6:1
11+
|
12+
LL | trait Trait {
13+
| ^^^^^^^^^^^
14+
note: required by a bound in `needs_const`
15+
--> $DIR/double-error-for-unimplemented-trait.rs:10:25
16+
|
17+
LL | const fn needs_const<T: ~const Trait>(_: &T) {}
18+
| ^^^^^^^^^^^^ required by this bound in `needs_const`
19+
20+
error[E0277]: the trait bound `(): Trait` is not satisfied
21+
--> $DIR/double-error-for-unimplemented-trait.rs:18:15
22+
|
23+
LL | needs_const(&());
24+
| ----------- ^^^ the trait `Trait` is not implemented for `()`
25+
| |
26+
| required by a bound introduced by this call
27+
|
28+
help: this trait has no implementations, consider adding one
29+
--> $DIR/double-error-for-unimplemented-trait.rs:6:1
30+
|
31+
LL | trait Trait {
32+
| ^^^^^^^^^^^
33+
note: required by a bound in `needs_const`
34+
--> $DIR/double-error-for-unimplemented-trait.rs:10:25
35+
|
36+
LL | const fn needs_const<T: ~const Trait>(_: &T) {}
37+
| ^^^^^^^^^^^^ required by this bound in `needs_const`
38+
39+
error: aborting due to 2 previous errors
40+
41+
For more information about this error, try `rustc --explain E0277`.

‎tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr renamed to ‎tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.current.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0308]: mismatched types
2-
--> $DIR/const-in-impl-fn-return-type.rs:15:39
2+
--> $DIR/const-in-impl-fn-return-type.rs:20:39
33
|
44
LL | fn func<const N: u32>() -> [(); { () }] {
55
| ^^ expected `usize`, found `()`
66

77
error: the constant `N` is not of type `usize`
8-
--> $DIR/const-in-impl-fn-return-type.rs:7:32
8+
--> $DIR/const-in-impl-fn-return-type.rs:12:32
99
|
1010
LL | fn func<const N: u32>() -> [(); N];
1111
| ^^^^^^^ expected `usize`, found `u32`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/const-in-impl-fn-return-type.rs:20:39
3+
|
4+
LL | fn func<const N: u32>() -> [(); { () }] {
5+
| ^^ expected `usize`, found `()`
6+
7+
error: the constant `N` is not of type `usize`
8+
--> $DIR/const-in-impl-fn-return-type.rs:12:32
9+
|
10+
LL | fn func<const N: u32>() -> [(); N];
11+
| ^^^^^^^ expected `usize`, found `u32`
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0308`.

‎tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
//@ revisions: current next
2+
//@[next] compile-flags: -Znext-solver
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
4+
15
// Regression test for #114918
6+
27
// Test that a const generic enclosed in a block within the return type
38
// of an impl fn produces a type mismatch error instead of triggering
49
// a const eval cycle

0 commit comments

Comments
 (0)
Please sign in to comment.