Auto merge of #154909 - JonathanBrouwer:rollup-44bqfTG, r=JonathanBrouwer

Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#154875 (Avoid duplicate diagnostic args in `RegionOriginNote::WithName`)
 - rust-lang/rust#154898 (Use debug! instead of info!)
This commit is contained in:
bors
2026-04-06 19:39:16 +00:00
4 changed files with 71 additions and 5 deletions
+4 -2
View File
@@ -6,7 +6,7 @@
use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute};
use rustc_span::{DesugaringKind, Span, Symbol, kw};
use thin_vec::ThinVec;
use tracing::{debug, info};
use tracing::debug;
use crate::attrs::PrintAttribute;
@@ -58,7 +58,9 @@ pub fn eval(
args: &FormatArgs,
) -> CustomDiagnostic {
let this = &args.this;
info!("eval({self:?}, this={this}, options={condition_options:?}, args ={args:?})");
debug!(
"Directive::eval({self:?}, this={this}, options={condition_options:?}, args ={args:?})"
);
let Some(condition_options) = condition_options else {
debug_assert!(
+5 -3
View File
@@ -442,9 +442,11 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
label_or_note(diag, span, msg);
}
RegionOriginNote::WithName { span, msg, name, continues } => {
diag.arg("name", name);
diag.arg("continues", continues);
label_or_note(diag, span, msg);
label_or_note(
diag,
span,
msg.arg("name", name).arg("continues", continues).format(),
);
}
RegionOriginNote::WithRequirement {
span,
@@ -0,0 +1,19 @@
// Regression test for https://github.com/rust-lang/rust/issues/152936
use std::collections::hash_map::{HashMap, Keys};
use std::marker::PhantomData;
trait MapAssertion<'a, K, V, R> {
fn key_set(&self) -> Subject<Keys<K, V>, (), R>;
}
struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>);
impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R> {
fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> {
//~^ ERROR cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements
//~| ERROR mismatched types
}
}
fn main() {}
@@ -0,0 +1,43 @@
error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5
|
LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:12:6
|
LL | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R> {
| ^^
note: ...so that the reference type `&Subject<'a, HashMap<K, V>, (), R>` does not outlive the data it points at
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5
|
LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds...
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:5
|
LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...that is required by this bound
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:10:29
|
LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/impl-trait-lifetime-conflict-hashmap-keys.rs:13:26
|
LL | fn key_set(&self) -> Subject<'static, Keys<K, V>, (), R> {
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Subject<'_, Keys<'_, K, V>, (), R>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
= note: expected struct `Subject<'static, std::collections::hash_map::Keys<'_, K, V>, (), R>`
found unit type `()`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0308, E0803.
For more information about an error, try `rustc --explain E0308`.