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 cb70c56

Browse files
committedApr 1, 2025
Auto merge of #139216 - matthiaskrgr:rollup-sjrt0fl, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #110406 (rustdoc-json: Add test for #[automatically_derived] attribute) - #138790 (Note potential but private items in show_candidates) - #138950 (replace extra_filename with strict version hash in metrics file names) - #139002 (Add release notes for 1.86.0) - #139022 (increment depth of nested obligations) - #139129 (Add tests for slice bounds check optimization) - #139188 (PassWrapper: adapt for llvm/llvm-project@94122d58fc77079a291a3d008914…) - #139193 (Feed HIR for by-move coroutine body def, since the inliner tries to read its attrs) - #139202 (Improve docs of ValTreeKind) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0b4a81a + dba6300 commit cb70c56

38 files changed

+425
-113
lines changed
 

‎RELEASES.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,126 @@
1+
Version 1.86.0 (2025-04-03)
2+
==========================
3+
4+
<a id="1.86.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Stabilize upcasting trait objects to supertraits.](https://github.com/rust-lang/rust/pull/134367)
9+
- [Allow safe functions to be marked with the `#[target_feature]` attribute.](https://github.com/rust-lang/rust/pull/134090)
10+
- [The `missing_abi` lint now warns-by-default.](https://github.com/rust-lang/rust/pull/132397)
11+
- Rust now lints about double negations, to catch cases that might have intended to be a prefix decrement operator (`--x`) as written in other languages. This was previously a clippy lint, `clippy::double_neg`, and is [now available directly in Rust as `double_negations`.](https://github.com/rust-lang/rust/pull/126604)
12+
- [More pointers are now detected as definitely not-null based on their alignment in const eval.](https://github.com/rust-lang/rust/pull/133700)
13+
- [Empty `repr()` attribute applied to invalid items are now correctly rejected.](https://github.com/rust-lang/rust/pull/133925)
14+
- [Inner attributes `#![test]` and `#![rustfmt::skip]` are no longer accepted in more places than intended.](https://github.com/rust-lang/rust/pull/134276)
15+
16+
<a id="1.86.0-Compiler"></a>
17+
18+
Compiler
19+
--------
20+
- [Debug-assert that raw pointers are non-null on access.](https://github.com/rust-lang/rust/pull/134424)
21+
- [Change `-O` to mean `-C opt-level=3` instead of `-C opt-level=2` to match Cargo's defaults.](https://github.com/rust-lang/rust/pull/135439)
22+
- [Fix emission of `overflowing_literals` under certain macro environments.](https://github.com/rust-lang/rust/pull/136393)
23+
24+
<a id="1.86.0-Platform-Support"></a>
25+
26+
Platform Support
27+
----------------
28+
- [Replace `i686-unknown-redox` target with `i586-unknown-redox`.](https://github.com/rust-lang/rust/pull/136698)
29+
- [Increase baseline CPU of `i686-unknown-hurd-gnu` to Pentium 4.](https://github.com/rust-lang/rust/pull/136700)
30+
- New tier 3 targets:
31+
- [`{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock`](https://github.com/rust-lang/rust/pull/133631).
32+
For supporting Neutrino QNX 7.1 with `io-socket` network stack.
33+
- [`{aarch64-unknown,x86_64-pc}-nto-qnx800`](https://github.com/rust-lang/rust/pull/133631).
34+
For supporting Neutrino QNX 8.0 (`no_std`-only).
35+
- [`{x86_64,i686}-win7-windows-gnu`](https://github.com/rust-lang/rust/pull/134609).
36+
Intended for backwards compatibility with Windows 7. `{x86_64,i686}-win7-windows-msvc` are the Windows MSVC counterparts that already exist as Tier 3 targets.
37+
- [`amdgcn-amd-amdhsa`](https://github.com/rust-lang/rust/pull/134740).
38+
- [`x86_64-pc-cygwin`](https://github.com/rust-lang/rust/pull/134999).
39+
- [`{mips,mipsel}-mti-none-elf`](https://github.com/rust-lang/rust/pull/135074).
40+
Initial bare-metal support.
41+
- [`m68k-unknown-none-elf`](https://github.com/rust-lang/rust/pull/135085).
42+
- [`armv7a-nuttx-{eabi,eabihf}`, `aarch64-unknown-nuttx`, and `thumbv7a-nuttx-{eabi,eabihf}`](https://github.com/rust-lang/rust/pull/135757).
43+
44+
Refer to Rust's [platform support page][platform-support-doc]
45+
for more information on Rust's tiered platform support.
46+
47+
<a id="1.86.0-Libraries"></a>
48+
49+
Libraries
50+
---------
51+
- The type of `FromBytesWithNulError` in `CStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>` was [changed from an opaque struct to an enum](https://github.com/rust-lang/rust/pull/134143), allowing users to examine why the conversion failed.
52+
- [Remove `RustcDecodable` and `RustcEncodable`.](https://github.com/rust-lang/rust/pull/134272)
53+
- [Deprecate libtest's `--logfile` option.](https://github.com/rust-lang/rust/pull/134283)
54+
- [On recent versions of Windows, `std::fs::remove_file` will now remove read-only files.](https://github.com/rust-lang/rust/pull/134679)
55+
56+
<a id="1.86.0-Stabilized-APIs"></a>
57+
58+
Stabilized APIs
59+
---------------
60+
61+
- [`{float}::next_down`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_down)
62+
- [`{float}::next_up`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_up)
63+
- [`<[_]>::get_disjoint_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_mut)
64+
- [`<[_]>::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_unchecked_mut)
65+
- [`slice::GetDisjointMutError`](https://doc.rust-lang.org/stable/std/slice/enum.GetDisjointMutError.html)
66+
- [`HashMap::get_disjoint_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_mut)
67+
- [`HashMap::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_unchecked_mut)
68+
- [`NonZero::count_ones`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.count_ones)
69+
- [`Vec::pop_if`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pop_if)
70+
- [`sync::Once::wait`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait)
71+
- [`sync::Once::wait_force`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait_force)
72+
- [`sync::OnceLock::wait`](https://doc.rust-lang.org/stable/std/sync/struct.OnceLock.html#method.wait)
73+
74+
These APIs are now stable in const contexts:
75+
76+
- [`hint::black_box`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html)
77+
- [`io::Cursor::get_mut`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_mut)
78+
- [`io::Cursor::set_position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.set_position)
79+
- [`str::is_char_boundary`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.is_char_boundary)
80+
- [`str::split_at`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at)
81+
- [`str::split_at_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_checked)
82+
- [`str::split_at_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut)
83+
- [`str::split_at_mut_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut_checked)
84+
85+
<a id="1.86.0-Cargo"></a>
86+
87+
Cargo
88+
-----
89+
- [When merging, replace rather than combine configuration keys that refer to a program path and its arguments.](https://github.com/rust-lang/cargo/pull/15066/)
90+
- [Error if both `--package` and `--workspace` are passed but the requested package is missing.](https://github.com/rust-lang/cargo/pull/15071/) This was previously silently ignored, which was considered a bug since missing packages should be reported.
91+
- [Deprecate the token argument in `cargo login` to avoid shell history leaks.](https://github.com/rust-lang/cargo/pull/15057/)
92+
- [Simplify the implementation of `SourceID` comparisons.](https://github.com/rust-lang/cargo/pull/14980/) This may potentially change behavior if the canonicalized URL compares differently in alternative registries.
93+
94+
<a id="1.86.0-Rustdoc"></a>
95+
96+
Rustdoc
97+
-----
98+
- [Add a sans-serif font setting.](https://github.com/rust-lang/rust/pull/133636)
99+
100+
<a id="1.86.0-Compatibility-Notes"></a>
101+
102+
Compatibility Notes
103+
-------------------
104+
- [The `wasm_c_abi` future compatibility warning is now a hard error.](https://github.com/rust-lang/rust/pull/133951)
105+
Users of `wasm-bindgen` should upgrade to at least version 0.2.89, otherwise compilation will fail.
106+
- [Remove long-deprecated no-op attributes `#![no_start]` and `#![crate_id]`.](https://github.com/rust-lang/rust/pull/134300)
107+
- [The future incompatibility lint `cenum_impl_drop_cast` has been made into a hard error.](https://github.com/rust-lang/rust/pull/135964) This means it is now an error to cast a field-less enum to an integer if the enum implements `Drop`.
108+
- [SSE2 is now required for "i686" 32-bit x86 hard-float targets; disabling it causes a warning that will become a hard error eventually.](https://github.com/rust-lang/rust/pull/137037)
109+
To compile for pre-SSE2 32-bit x86, use a "i586" target instead.
110+
111+
<a id="1.86.0-Internal-Changes"></a>
112+
113+
Internal Changes
114+
----------------
115+
116+
These changes do not affect any public interfaces of Rust, but they represent
117+
significant improvements to the performance or internals of rustc and related
118+
tools.
119+
120+
- [Build the rustc on AArch64 Linux with ThinLTO + PGO.](https://github.com/rust-lang/rust/pull/133807)
121+
The ARM 64-bit compiler (AArch64) on Linux is now optimized with ThinLTO and PGO, similar to the optimizations we have already performed for the x86-64 compiler on Linux. This should make it up to 30% faster.
122+
123+
1124
Version 1.85.1 (2025-03-18)
2125
==========================
3126

‎compiler/rustc_driver_impl/src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use rustc_session::lint::{Lint, LintId};
6464
use rustc_session::output::{CRATE_TYPES, collect_crate_types, invalid_output_for_target};
6565
use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6666
use rustc_span::FileName;
67+
use rustc_span::def_id::LOCAL_CRATE;
6768
use rustc_target::json::ToJson;
6869
use rustc_target::spec::{Target, TargetTuple};
6970
use time::OffsetDateTime;
@@ -392,14 +393,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
392393
}
393394

394395
fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
395-
let output_filenames = tcxt.output_filenames(());
396-
let mut metrics_file_name = std::ffi::OsString::from("unstable_feature_usage_metrics-");
397-
let mut metrics_path = output_filenames.with_directory_and_extension(metrics_dir, "json");
398-
let metrics_file_stem =
399-
metrics_path.file_name().expect("there should be a valid default output filename");
400-
metrics_file_name.push(metrics_file_stem);
401-
metrics_path.pop();
402-
metrics_path.push(metrics_file_name);
396+
let hash = tcxt.crate_hash(LOCAL_CRATE);
397+
let crate_name = tcxt.crate_name(LOCAL_CRATE);
398+
let metrics_file_name = format!("unstable_feature_usage_metrics-{crate_name}-{hash}.json");
399+
let metrics_path = metrics_dir.join(metrics_file_name);
403400
if let Err(error) = tcxt.features().dump_feature_usage_metrics(metrics_path) {
404401
// FIXME(yaahc): once metrics can be enabled by default we will want "failure to emit
405402
// default metrics" to only produce a warning when metrics are enabled by default and emit

‎compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,15 @@ extern "C" LLVMRustResult LLVMRustOptimize(
855855
}
856856

857857
if (LintIR) {
858-
PipelineStartEPCallbacks.push_back(
859-
[](ModulePassManager &MPM, OptimizationLevel Level) {
860-
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
861-
});
858+
PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM,
859+
OptimizationLevel Level) {
860+
#if LLVM_VERSION_GE(21, 0)
861+
MPM.addPass(
862+
createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true)));
863+
#else
864+
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
865+
#endif
866+
});
862867
}
863868

864869
if (InstrumentCoverage) {

‎compiler/rustc_middle/src/ty/consts/valtree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum ValTreeKind<'tcx> {
3333
/// The fields of any kind of aggregate. Structs, tuples and arrays are represented by
3434
/// listing their fields' values in order.
3535
///
36-
/// Enums are represented by storing their discriminant as a field, followed by all
36+
/// Enums are represented by storing their variant index as a u32 field, followed by all
3737
/// the fields of the variant.
3838
///
3939
/// ZST types are represented as an empty slice.

‎compiler/rustc_mir_transform/src/coroutine/by_move_body.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
219219
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
220220
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));
221221

222+
// Feed HIR because we try to access this body's attrs in the inliner.
223+
body_def.feed_hir();
222224
// Inherited from the by-ref coroutine.
223225
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
224226
body_def.coverage_attr_on(tcx.coverage_attr_on(coroutine_def_id));

‎compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,11 +1325,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
13251325
})
13261326
}
13271327

1328-
// If only some candidates are accessible, take just them
1329-
if !candidates.iter().all(|v: &ImportSuggestion| !v.accessible) {
1330-
candidates.retain(|x| x.accessible)
1331-
}
1332-
13331328
candidates
13341329
}
13351330

@@ -1793,7 +1788,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17931788
&import_suggestions,
17941789
Instead::Yes,
17951790
FoundUse::Yes,
1796-
DiagMode::Import { append: single_nested },
1791+
DiagMode::Import { append: single_nested, unresolved_import: false },
17971792
vec![],
17981793
"",
17991794
);
@@ -2750,6 +2745,8 @@ pub(crate) enum DiagMode {
27502745
Pattern,
27512746
/// The binding is part of a use statement
27522747
Import {
2748+
/// `true` means diagnostics is for unresolved import
2749+
unresolved_import: bool,
27532750
/// `true` mean add the tips afterward for case `use a::{b,c}`,
27542751
/// rather than replacing within.
27552752
append: bool,
@@ -2800,6 +2797,7 @@ fn show_candidates(
28002797
return false;
28012798
}
28022799

2800+
let mut showed = false;
28032801
let mut accessible_path_strings: Vec<PathString<'_>> = Vec::new();
28042802
let mut inaccessible_path_strings: Vec<PathString<'_>> = Vec::new();
28052803

@@ -2958,8 +2956,11 @@ fn show_candidates(
29582956
append_candidates(&mut msg, accessible_path_strings);
29592957
err.help(msg);
29602958
}
2961-
true
2962-
} else if !(inaccessible_path_strings.is_empty() || matches!(mode, DiagMode::Import { .. })) {
2959+
showed = true;
2960+
}
2961+
if !inaccessible_path_strings.is_empty()
2962+
&& (!matches!(mode, DiagMode::Import { unresolved_import: false, .. }))
2963+
{
29632964
let prefix =
29642965
if let DiagMode::Pattern = mode { "you might have meant to match on " } else { "" };
29652966
if let [(name, descr, source_span, note, _)] = &inaccessible_path_strings[..] {
@@ -3022,10 +3023,9 @@ fn show_candidates(
30223023

30233024
err.span_note(multi_span, msg);
30243025
}
3025-
true
3026-
} else {
3027-
false
3026+
showed = true;
30283027
}
3028+
showed
30293029
}
30303030

30313031
#[derive(Debug)]

‎compiler/rustc_resolve/src/imports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
734734
&mut diag,
735735
Some(err.span),
736736
candidates,
737-
DiagMode::Import { append: false },
737+
DiagMode::Import { append: false, unresolved_import: true },
738738
(source != target)
739739
.then(|| format!(" as {target}"))
740740
.as_deref()

‎compiler/rustc_trait_selection/src/traits/effects.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ fn match_candidate<'tcx>(
106106

107107
more_nested(selcx, &mut nested);
108108

109-
for nested in &mut nested {
110-
nested.set_depth_from_parent(obligation.recursion_depth);
111-
}
112-
113109
Ok(nested)
114110
}
115111

@@ -378,10 +374,6 @@ fn evaluate_host_effect_from_selection_candiate<'tcx>(
378374
}),
379375
);
380376

381-
for nested in &mut nested {
382-
nested.set_depth_from_parent(obligation.recursion_depth);
383-
}
384-
385377
Ok(nested)
386378
}
387379
_ => Err(EvaluationFailure::NoSolution),

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

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,15 @@ struct FulfillProcessor<'a, 'tcx> {
225225
selcx: SelectionContext<'a, 'tcx>,
226226
}
227227

228-
fn mk_pending<'tcx>(os: PredicateObligations<'tcx>) -> PendingPredicateObligations<'tcx> {
228+
fn mk_pending<'tcx>(
229+
parent: &PredicateObligation<'tcx>,
230+
os: PredicateObligations<'tcx>,
231+
) -> PendingPredicateObligations<'tcx> {
229232
os.into_iter()
230-
.map(|o| PendingPredicateObligation { obligation: o, stalled_on: vec![] })
233+
.map(|mut o| {
234+
o.set_depth_from_parent(parent.recursion_depth);
235+
PendingPredicateObligation { obligation: o, stalled_on: vec![] }
236+
})
231237
.collect()
232238
}
233239

@@ -341,7 +347,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
341347
);
342348
if predicate != obligation.predicate {
343349
obligations.push(obligation.with(infcx.tcx, predicate));
344-
return ProcessResult::Changed(mk_pending(obligations));
350+
return ProcessResult::Changed(mk_pending(obligation, obligations));
345351
}
346352
}
347353
let binder = obligation.predicate.kind();
@@ -385,7 +391,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
385391
let mut obligations = PredicateObligations::with_capacity(1);
386392
obligations.push(obligation.with(infcx.tcx, pred));
387393

388-
ProcessResult::Changed(mk_pending(obligations))
394+
ProcessResult::Changed(mk_pending(obligation, obligations))
389395
}
390396
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
391397
ty::PredicateKind::NormalizesTo(..) => {
@@ -410,6 +416,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
410416
let host_obligation = obligation.with(infcx.tcx, data);
411417

412418
self.process_host_obligation(
419+
obligation,
413420
host_obligation,
414421
&mut pending_obligation.stalled_on,
415422
)
@@ -486,7 +493,10 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
486493
// `<lhs_ty as Add<rhs_ty>>::Output` when this is an `Expr` representing
487494
// `lhs + rhs`.
488495
ty::ConstKind::Expr(_) => {
489-
return ProcessResult::Changed(mk_pending(PredicateObligations::new()));
496+
return ProcessResult::Changed(mk_pending(
497+
obligation,
498+
PredicateObligations::new(),
499+
));
490500
}
491501
ty::ConstKind::Placeholder(_) => {
492502
bug!("placeholder const {:?} in old solver", ct)
@@ -503,7 +513,10 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
503513
ct_ty,
504514
ty,
505515
) {
506-
Ok(inf_ok) => ProcessResult::Changed(mk_pending(inf_ok.into_obligations())),
516+
Ok(inf_ok) => ProcessResult::Changed(mk_pending(
517+
obligation,
518+
inf_ok.into_obligations(),
519+
)),
507520
Err(_) => ProcessResult::Error(FulfillmentErrorCode::Select(
508521
SelectionError::ConstArgHasWrongType { ct, ct_ty, expected_ty: ty },
509522
)),
@@ -537,7 +550,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
537550
vec![TyOrConstInferVar::maybe_from_generic_arg(arg).unwrap()];
538551
ProcessResult::Unchanged
539552
}
540-
Some(os) => ProcessResult::Changed(mk_pending(os)),
553+
Some(os) => ProcessResult::Changed(mk_pending(obligation, os)),
541554
}
542555
}
543556

@@ -553,11 +566,8 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
553566
vec![TyOrConstInferVar::Ty(a), TyOrConstInferVar::Ty(b)];
554567
ProcessResult::Unchanged
555568
}
556-
Ok(Ok(mut ok)) => {
557-
for subobligation in &mut ok.obligations {
558-
subobligation.set_depth_from_parent(obligation.recursion_depth);
559-
}
560-
ProcessResult::Changed(mk_pending(ok.obligations))
569+
Ok(Ok(ok)) => {
570+
ProcessResult::Changed(mk_pending(obligation, ok.obligations))
561571
}
562572
Ok(Err(err)) => {
563573
let expected_found = if subtype.a_is_expected {
@@ -582,7 +592,9 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
582592
vec![TyOrConstInferVar::Ty(a), TyOrConstInferVar::Ty(b)];
583593
ProcessResult::Unchanged
584594
}
585-
Ok(Ok(ok)) => ProcessResult::Changed(mk_pending(ok.obligations)),
595+
Ok(Ok(ok)) => {
596+
ProcessResult::Changed(mk_pending(obligation, ok.obligations))
597+
}
586598
Ok(Err(err)) => {
587599
let expected_found = ExpectedFound::new(coerce.b, coerce.a);
588600
ProcessResult::Error(FulfillmentErrorCode::Subtype(expected_found, err))
@@ -645,6 +657,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
645657
)
646658
{
647659
return ProcessResult::Changed(mk_pending(
660+
obligation,
648661
new_obligations.into_obligations(),
649662
));
650663
}
@@ -659,6 +672,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
659672
.eq(DefineOpaqueTypes::Yes, c1, c2)
660673
{
661674
return ProcessResult::Changed(mk_pending(
675+
obligation,
662676
new_obligations.into_obligations(),
663677
));
664678
}
@@ -704,9 +718,10 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
704718
c1,
705719
c2,
706720
) {
707-
Ok(inf_ok) => {
708-
ProcessResult::Changed(mk_pending(inf_ok.into_obligations()))
709-
}
721+
Ok(inf_ok) => ProcessResult::Changed(mk_pending(
722+
obligation,
723+
inf_ok.into_obligations(),
724+
)),
710725
Err(err) => {
711726
ProcessResult::Error(FulfillmentErrorCode::ConstEquate(
712727
ExpectedFound::new(c1, c2),
@@ -790,7 +805,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
790805
match self.selcx.poly_select(&trait_obligation) {
791806
Ok(Some(impl_source)) => {
792807
debug!("selecting trait at depth {} yielded Ok(Some)", obligation.recursion_depth);
793-
ProcessResult::Changed(mk_pending(impl_source.nested_obligations()))
808+
ProcessResult::Changed(mk_pending(obligation, impl_source.nested_obligations()))
794809
}
795810
Ok(None) => {
796811
debug!("selecting trait at depth {} yielded Ok(None)", obligation.recursion_depth);
@@ -854,7 +869,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
854869
}
855870

856871
match project::poly_project_and_unify_term(&mut self.selcx, &project_obligation) {
857-
ProjectAndUnifyResult::Holds(os) => ProcessResult::Changed(mk_pending(os)),
872+
ProjectAndUnifyResult::Holds(os) => ProcessResult::Changed(mk_pending(obligation, os)),
858873
ProjectAndUnifyResult::FailedNormalization => {
859874
stalled_on.clear();
860875
stalled_on.extend(args_infer_vars(
@@ -868,7 +883,7 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
868883
let mut obligations = PredicateObligations::with_capacity(1);
869884
obligations.push(project_obligation.with(tcx, project_obligation.predicate));
870885

871-
ProcessResult::Changed(mk_pending(obligations))
886+
ProcessResult::Changed(mk_pending(obligation, obligations))
872887
}
873888
ProjectAndUnifyResult::MismatchedProjectionTypes(e) => {
874889
ProcessResult::Error(FulfillmentErrorCode::Project(e))
@@ -878,11 +893,12 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
878893

879894
fn process_host_obligation(
880895
&mut self,
896+
obligation: &PredicateObligation<'tcx>,
881897
host_obligation: HostEffectObligation<'tcx>,
882898
stalled_on: &mut Vec<TyOrConstInferVar>,
883899
) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
884900
match effects::evaluate_host_effect_obligation(&mut self.selcx, &host_obligation) {
885-
Ok(nested) => ProcessResult::Changed(mk_pending(nested)),
901+
Ok(nested) => ProcessResult::Changed(mk_pending(obligation, nested)),
886902
Err(effects::EvaluationFailure::Ambiguous) => {
887903
stalled_on.clear();
888904
stalled_on.extend(args_infer_vars(

‎compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
3939
obligation: &PolyTraitObligation<'tcx>,
4040
candidate: SelectionCandidate<'tcx>,
4141
) -> Result<Selection<'tcx>, SelectionError<'tcx>> {
42-
let mut impl_src = match candidate {
42+
Ok(match candidate {
4343
SizedCandidate { has_nested } => {
4444
let data = self.confirm_builtin_candidate(obligation, has_nested);
4545
ImplSource::Builtin(BuiltinImplSource::Misc, data)
@@ -139,15 +139,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
139139
BikeshedGuaranteedNoDropCandidate => {
140140
self.confirm_bikeshed_guaranteed_no_drop_candidate(obligation)
141141
}
142-
};
143-
144-
// The obligations returned by confirmation are recursively evaluated
145-
// so we need to make sure they have the correct depth.
146-
for subobligation in impl_src.borrow_nested_obligations_mut() {
147-
subobligation.set_depth_from_parent(obligation.recursion_depth);
148-
}
149-
150-
Ok(impl_src)
142+
})
151143
}
152144

153145
fn confirm_projection_candidate(

‎tests/codegen/cast-target-abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ add-core-stubs
33
//@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64
44
//@ min-llvm-version: 19
5-
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
5+
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir
66

77
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
88
//@[aarch64] needs-llvm-components: arm

‎tests/codegen/cffi/ffi-out-of-bounds-loads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ add-core-stubs
22
//@ revisions: linux apple
33
//@ min-llvm-version: 19
4-
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
4+
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir
55

66
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
77
//@[linux] needs-llvm-components: x86
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//@ compile-flags: -Copt-level=3
2+
//@ only-x86_64
3+
//@ min-llvm-version: 20
4+
#![crate_type = "lib"]
5+
6+
// This test verifies that LLVM 20 properly optimizes the bounds check
7+
// when accessing the last few elements of a slice with proper conditions.
8+
// Previously, this would generate an unreachable branch to
9+
// slice_start_index_len_fail even when the bounds check was provably safe.
10+
11+
// CHECK-LABEL: @last_four_initial(
12+
#[no_mangle]
13+
pub fn last_four_initial(s: &[u8]) -> &[u8] {
14+
// Previously this would generate a branch to slice_start_index_len_fail
15+
// that is unreachable. The LLVM 20 fix should eliminate this branch.
16+
// CHECK-NOT: slice_start_index_len_fail
17+
// CHECK-NOT: unreachable
18+
let start = if s.len() <= 4 { 0 } else { s.len() - 4 };
19+
&s[start..]
20+
}
21+
22+
// CHECK-LABEL: @last_four_optimized(
23+
#[no_mangle]
24+
pub fn last_four_optimized(s: &[u8]) -> &[u8] {
25+
// This version was already correctly optimized before the fix in LLVM 20.
26+
// CHECK-NOT: slice_start_index_len_fail
27+
// CHECK-NOT: unreachable
28+
if s.len() <= 4 { &s[0..] } else { &s[s.len() - 4..] }
29+
}
30+
31+
// Just to verify we're correctly checking for the right thing
32+
// CHECK-LABEL: @test_bounds_check_happens(
33+
#[no_mangle]
34+
pub fn test_bounds_check_happens(s: &[u8], i: usize) -> &[u8] {
35+
// CHECK: slice_start_index_len_fail
36+
&s[i..]
37+
}

‎tests/crashes/134335.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#[derive(Default)]
2+
pub struct Derive;
3+
4+
pub struct Manual;
5+
6+
impl Default for Manual {
7+
fn default() -> Self {
8+
Self
9+
}
10+
}
11+
12+
//@ is '$.index[?(@.inner.impl.for.resolved_path.path == "Derive" && @.inner.impl.trait.path == "Default")].attrs' '["#[automatically_derived]"]'
13+
//@ is '$.index[?(@.inner.impl.for.resolved_path.path == "Manual" && @.inner.impl.trait.path == "Default")].attrs' '[]'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ check-pass
2+
//@ compile-flags: -Zinline-mir -Zvalidate-mir
3+
//@ edition: 2024
4+
5+
// See comment below.
6+
7+
use std::future::Future;
8+
use std::pin::pin;
9+
use std::task::{Context, Waker};
10+
11+
fn call_once<T>(f: impl FnOnce() -> T) -> T { f() }
12+
13+
fn main() {
14+
let x = async || {};
15+
// We first inline `call_once<{async closure}>`.
16+
//
17+
// This gives us a future whose type is the "FnOnce" flavor of the async closure's
18+
// child coroutine. The body of this coroutine is synthetic, which we synthesize in
19+
// the by-move body query.
20+
let fut = pin!(call_once(x));
21+
// We then try to inline that body in this poll call.
22+
//
23+
// The inliner does some inlinability checks; one of these checks involves checking
24+
// the body for the `#[rustc_no_mir_inline]` attribute. Since the synthetic body had
25+
// no HIR synthesized, but it's still a local def id, we end up ICEing in the
26+
// `local_def_id_to_hir_id` call when trying to read its attrs.
27+
fut.poll(&mut Context::from_waker(Waker::noop()));
28+
}

‎tests/ui/imports/glob-resolve1.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ error[E0425]: cannot find function `import` in this scope
5858
LL | import();
5959
| ^^^^^^ not found in this scope
6060
|
61+
note: function `bar::import` exists but is inaccessible
62+
--> $DIR/glob-resolve1.rs:7:5
63+
|
64+
LL | fn fpriv() {}
65+
| ^^^^^^^^^^ not accessible
6166
help: consider importing this function
6267
|
6368
LL + use other::import;

‎tests/ui/imports/issue-4366-2.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ error[E0423]: expected function, found module `foo`
1616
LL | foo();
1717
| ^^^ not a function
1818
|
19+
note: function `m1::foo` exists but is inaccessible
20+
--> $DIR/issue-4366-2.rs:21:5
21+
|
22+
LL | fn foo() {}
23+
| ^^^^^^^^ not accessible
1924
help: consider importing this function instead
2025
|
2126
LL + use foo::foo;

‎tests/ui/imports/issue-4366.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ error[E0425]: cannot find function `foo` in this scope
44
LL | fn sub() -> isize { foo(); 1 }
55
| ^^^ not found in this scope
66
|
7+
note: function `m1::foo` exists but is inaccessible
8+
--> $DIR/issue-4366.rs:23:5
9+
|
10+
LL | fn foo() {}
11+
| ^^^^^^^^ not accessible
712
help: consider importing this function
813
|
914
LL + use foo::foo;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pub mod one {
2+
mod foo {
3+
pub struct Foo;
4+
}
5+
6+
pub use self::foo::Foo;
7+
}
8+
9+
pub mod two {
10+
mod foo {
11+
mod bar {
12+
pub struct Foo;
13+
}
14+
}
15+
16+
pub use crate::two::foo::Foo; //~ ERROR unresolved import `crate::two::foo::Foo` [E0432]
17+
}
18+
19+
fn main() {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0432]: unresolved import `crate::two::foo::Foo`
2+
--> $DIR/show-private-items-issue-138626.rs:16:13
3+
|
4+
LL | pub use crate::two::foo::Foo;
5+
| ^^^^^^^^^^^^^^^^^^^^ no `Foo` in `two::foo`
6+
|
7+
note: struct `two::foo::bar::Foo` exists but is inaccessible
8+
--> $DIR/show-private-items-issue-138626.rs:12:13
9+
|
10+
LL | pub struct Foo;
11+
| ^^^^^^^^^^^^^^^ not accessible
12+
help: consider importing this struct through its public re-export instead
13+
|
14+
LL - pub use crate::two::foo::Foo;
15+
LL + pub use one::Foo;
16+
|
17+
18+
error: aborting due to 1 previous error
19+
20+
For more information about this error, try `rustc --explain E0432`.

‎tests/ui/infinite/infinite-autoderef.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0275]: overflow assigning `Box<_>` to `_`
2-
--> $DIR/infinite-autoderef.rs:16:13
2+
--> $DIR/infinite-autoderef.rs:16:22
33
|
44
LL | x = Box::new(x);
5-
| ^^^^^^^^^^^
5+
| ^
66

77
error: aborting due to 1 previous error
88

‎tests/ui/occurs-check-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ fn main() {
44
let g;
55

66
g = f;
7-
f = Box::new(g);
87
//~^ ERROR overflow assigning `Box<_>` to `_`
8+
f = Box::new(g);
99
}

‎tests/ui/occurs-check-2.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0275]: overflow assigning `Box<_>` to `_`
2-
--> $DIR/occurs-check-2.rs:7:9
2+
--> $DIR/occurs-check-2.rs:6:9
33
|
4-
LL | f = Box::new(g);
5-
| ^^^^^^^^^^^
4+
LL | g = f;
5+
| ^
66

77
error: aborting due to 1 previous error
88

‎tests/ui/occurs-check-3.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0275]: overflow assigning `Clam<_>` to `_`
2-
--> $DIR/occurs-check-3.rs:6:9
2+
--> $DIR/occurs-check-3.rs:6:17
33
|
44
LL | c = Clam::A(c);
5-
| ^^^^^^^^^^
5+
| ^
66

77
error: aborting due to 1 previous error
88

‎tests/ui/occurs-check.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0275]: overflow assigning `Box<_>` to `_`
2-
--> $DIR/occurs-check.rs:3:9
2+
--> $DIR/occurs-check.rs:3:18
33
|
44
LL | f = Box::new(f);
5-
| ^^^^^^^^^^^
5+
| ^
66

77
error: aborting due to 1 previous error
88

‎tests/ui/privacy/privacy-ns1.stderr

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ LL | pub struct Baz;
77
LL | Bar();
88
| ^^^
99
|
10+
note: these functions exist but are inaccessible
11+
--> $DIR/privacy-ns1.rs:14:5
12+
|
13+
LL | fn Bar() { }
14+
| ^^^^^^^^ `foo1::Bar`: not accessible
15+
...
16+
LL | fn Bar() { }
17+
| ^^^^^^^^ `foo3::Bar`: not accessible
1018
help: a unit struct with a similar name exists
1119
|
1220
LL - Bar();
@@ -26,6 +34,14 @@ LL | pub struct Baz;
2634
LL | Bar();
2735
| ^^^
2836
|
37+
note: these functions exist but are inaccessible
38+
--> $DIR/privacy-ns1.rs:14:5
39+
|
40+
LL | fn Bar() { }
41+
| ^^^^^^^^ `foo1::Bar`: not accessible
42+
...
43+
LL | fn Bar() { }
44+
| ^^^^^^^^ `foo3::Bar`: not accessible
2945
help: a unit struct with a similar name exists
3046
|
3147
LL - Bar();
@@ -45,6 +61,14 @@ LL | pub struct Baz;
4561
LL | let _x: Box<Bar>;
4662
| ^^^
4763
|
64+
note: these traits exist but are inaccessible
65+
--> $DIR/privacy-ns1.rs:25:5
66+
|
67+
LL | trait Bar {
68+
| ^^^^^^^^^ `foo2::Bar`: not accessible
69+
...
70+
LL | trait Bar {
71+
| ^^^^^^^^^ `foo3::Bar`: not accessible
4872
help: a struct with a similar name exists
4973
|
5074
LL - let _x: Box<Bar>;

‎tests/ui/privacy/privacy-ns2.stderr

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar
44
LL | Bar();
55
| ^^^ not a function, tuple struct or tuple variant
66
|
7+
note: these functions exist but are inaccessible
8+
--> $DIR/privacy-ns2.rs:14:5
9+
|
10+
LL | fn Bar() { }
11+
| ^^^^^^^^ `foo1::Bar`: not accessible
12+
...
13+
LL | fn Bar() { }
14+
| ^^^^^^^^ `foo3::Bar`: not accessible
715
help: consider importing this function instead
816
|
917
LL + use foo2::Bar;
@@ -18,6 +26,14 @@ LL | pub struct Baz;
1826
LL | Bar();
1927
| ^^^
2028
|
29+
note: these functions exist but are inaccessible
30+
--> $DIR/privacy-ns2.rs:14:5
31+
|
32+
LL | fn Bar() { }
33+
| ^^^^^^^^ `foo1::Bar`: not accessible
34+
...
35+
LL | fn Bar() { }
36+
| ^^^^^^^^ `foo3::Bar`: not accessible
2137
help: a unit struct with a similar name exists
2238
|
2339
LL - Bar();
@@ -34,6 +50,14 @@ error[E0573]: expected type, found function `Bar`
3450
LL | let _x : Bar();
3551
| ^^^^^ not a type
3652
|
53+
note: these traits exist but are inaccessible
54+
--> $DIR/privacy-ns2.rs:31:5
55+
|
56+
LL | trait Bar {
57+
| ^^^^^^^^^ `foo2::Bar`: not accessible
58+
...
59+
LL | trait Bar {
60+
| ^^^^^^^^^ `foo3::Bar`: not accessible
3761
help: use `=` if you meant to assign
3862
|
3963
LL - let _x : Bar();

‎tests/ui/resolve/issue-21221-1.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ error[E0412]: cannot find type `Mul` in this scope
1919
LL | fn getMul() -> Mul {
2020
| ^^^ not found in this scope
2121
|
22+
note: these items exist but are inaccessible
23+
--> $DIR/issue-21221-1.rs:10:5
24+
|
25+
LL | enum Mul {
26+
| ^^^^^^^^ `mul3::Mul`: not accessible
27+
...
28+
LL | type Mul = String;
29+
| ^^^^^^^^^^^^^^^^^^ `mul4::Mul`: not accessible
30+
...
31+
LL | struct Mul{
32+
| ^^^^^^^^^^ `mul5::Mul`: not accessible
2233
help: consider importing one of these traits
2334
|
2435
LL + use std::ops::Mul;

‎tests/ui/traits/mutual-recursion-issue-75860.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0275]: overflow assigning `_` to `Option<_>`
22
--> $DIR/mutual-recursion-issue-75860.rs:9:33
33
|
44
LL | let left = |o_a: Option<_>| o_a.unwrap();
5-
| ^^^
5+
| ^^^^^^^^^^^^
66

77
error: aborting due to 1 previous error
88

‎tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#![feature(type_alias_impl_trait)]
2-
//@ known-bug: #109268
32

43
type Foo = impl Fn() -> Foo;
54

5+
#[define_opaque(Foo)]
66
fn crash(x: Foo) -> Foo {
7+
//~^ ERROR overflow evaluating the requirement `<Foo as FnOnce<()>>::Output == Foo`
78
x
89
}
910

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
error: unconstrained opaque type
2-
--> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:4:12
1+
error[E0275]: overflow evaluating the requirement `<Foo as FnOnce<()>>::Output == Foo`
2+
--> $DIR/type-alias-impl-trait-with-cycle-error-1.rs:6:21
33
|
4-
LL | type Foo = impl Fn() -> Foo;
5-
| ^^^^^^^^^^^^^^^^
6-
|
7-
= note: `Foo` must be used in combination with a concrete type within the same crate
4+
LL | fn crash(x: Foo) -> Foo {
5+
| ^^^
86

97
error: aborting due to 1 previous error
108

9+
For more information about this error, try `rustc --explain E0275`.

‎tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#![feature(type_alias_impl_trait)]
2-
//@ known-bug: #109268
32

43
pub trait Bar<T> {
54
type Item;
65
}
76

87
type Foo = impl Bar<Foo, Item = Foo>;
9-
8+
#[define_opaque(Foo)]
109
fn crash(x: Foo) -> Foo {
10+
//~^ ERROR overflow evaluating the requirement `<Foo as Bar<Foo>>::Item == Foo`
1111
x
1212
}
1313

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
error: unconstrained opaque type
2-
--> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:8:12
1+
error[E0275]: overflow evaluating the requirement `<Foo as Bar<Foo>>::Item == Foo`
2+
--> $DIR/type-alias-impl-trait-with-cycle-error-2.rs:9:21
33
|
4-
LL | type Foo = impl Bar<Foo, Item = Foo>;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `Foo` must be used in combination with a concrete type within the same crate
4+
LL | fn crash(x: Foo) -> Foo {
5+
| ^^^
86

97
error: aborting due to 1 previous error
108

9+
For more information about this error, try `rustc --explain E0275`.

‎tests/ui/type-alias-impl-trait/type-alias-impl-trait-with-cycle-error-3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![feature(type_alias_impl_trait)]
2-
//@ known-bug: #109268
32

43
type Foo<'a> = impl Fn() -> Foo<'a>;
5-
4+
#[define_opaque(Foo)]
65
fn crash<'a>(_: &'a (), x: Foo<'a>) -> Foo<'a> {
6+
//~^ ERROR overflow evaluating the requirement `<Foo<'_> as FnOnce<()>>::Output == Foo<'a>`
77
x
88
}
99

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
error: unconstrained opaque type
2-
--> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:4:16
1+
error[E0275]: overflow evaluating the requirement `<Foo<'_> as FnOnce<()>>::Output == Foo<'a>`
2+
--> $DIR/type-alias-impl-trait-with-cycle-error-3.rs:5:40
33
|
4-
LL | type Foo<'a> = impl Fn() -> Foo<'a>;
5-
| ^^^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: `Foo` must be used in combination with a concrete type within the same crate
4+
LL | fn crash<'a>(_: &'a (), x: Foo<'a>) -> Foo<'a> {
5+
| ^^^^^^^
86

97
error: aborting due to 1 previous error
108

9+
For more information about this error, try `rustc --explain E0275`.

‎tests/ui/unresolved/unresolved-import.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ mod food {
3131

3232
mod zug {
3333
pub mod baz {
34+
//~^ NOTE module `food::zug::baz` exists but is inaccessible
35+
//~| NOTE not accessible
3436
pub struct Foobar;
3537
}
3638
}

‎tests/ui/unresolved/unresolved-import.stderr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ LL | use food::baz;
2626
| | |
2727
| | help: a similar name exists in the module: `bag`
2828
| no `baz` in `food`
29+
|
30+
note: module `food::zug::baz` exists but is inaccessible
31+
--> $DIR/unresolved-import.rs:33:9
32+
|
33+
LL | pub mod baz {
34+
| ^^^^^^^^^^^ not accessible
2935

3036
error[E0432]: unresolved import `food::beens`
3137
--> $DIR/unresolved-import.rs:19:12
@@ -37,13 +43,13 @@ LL | use food::{beens as Foo};
3743
| help: a similar name exists in the module: `beans`
3844

3945
error[E0432]: unresolved import `MyEnum`
40-
--> $DIR/unresolved-import.rs:44:9
46+
--> $DIR/unresolved-import.rs:46:9
4147
|
4248
LL | use MyEnum::*;
4349
| ^^^^^^ help: a similar path exists: `self::MyEnum`
4450

4551
error[E0432]: unresolved import `Enum`
46-
--> $DIR/unresolved-import.rs:55:9
52+
--> $DIR/unresolved-import.rs:57:9
4753
|
4854
LL | use Enum::*;
4955
| ^^^^ help: a similar path exists: `self::Enum`

0 commit comments

Comments
 (0)
Please sign in to comment.