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 e9a16fd

Browse files
committedFeb 13, 2024
Auto merge of #121054 - matthiaskrgr:rollup-k3fuez5, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #118882 (Check normalized call signature for WF in mir typeck) - #120999 (rustdoc: replace `clean::InstantiationParam` with `clean::GenericArg`) - #121002 (remove unnecessary calls to `commit_if_ok`) - #121005 (Remove jsha from the rustdoc review rotation) - #121043 (add lcnr to the compiler-team assignment group) - #121045 (Fix two UI tests with incorrect directive / invalid revision) - #121046 (Fix incorrect use of `compile_fail`) - #121047 (Do not assemble candidates for default impls) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a84bb95 + d879ba1 commit e9a16fd

26 files changed

+281
-209
lines changed
 

‎compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14321432
return;
14331433
}
14341434
};
1435-
let (sig, map) = tcx.instantiate_bound_regions(sig, |br| {
1435+
let (unnormalized_sig, map) = tcx.instantiate_bound_regions(sig, |br| {
14361436
use crate::renumber::RegionCtxt;
14371437

14381438
let region_ctxt_fn = || {
@@ -1454,7 +1454,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14541454
region_ctxt_fn,
14551455
)
14561456
});
1457-
debug!(?sig);
1457+
debug!(?unnormalized_sig);
14581458
// IMPORTANT: We have to prove well formed for the function signature before
14591459
// we normalize it, as otherwise types like `<&'a &'b () as Trait>::Assoc`
14601460
// get normalized away, causing us to ignore the `'b: 'a` bound used by the function.
@@ -1464,15 +1464,31 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14641464
//
14651465
// See #91068 for an example.
14661466
self.prove_predicates(
1467-
sig.inputs_and_output.iter().map(|ty| {
1467+
unnormalized_sig.inputs_and_output.iter().map(|ty| {
14681468
ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(
14691469
ty.into(),
14701470
)))
14711471
}),
14721472
term_location.to_locations(),
14731473
ConstraintCategory::Boring,
14741474
);
1475-
let sig = self.normalize(sig, term_location);
1475+
1476+
let sig = self.normalize(unnormalized_sig, term_location);
1477+
// HACK(#114936): `WF(sig)` does not imply `WF(normalized(sig))`
1478+
// with built-in `Fn` implementations, since the impl may not be
1479+
// well-formed itself.
1480+
if sig != unnormalized_sig {
1481+
self.prove_predicates(
1482+
sig.inputs_and_output.iter().map(|ty| {
1483+
ty::Binder::dummy(ty::PredicateKind::Clause(
1484+
ty::ClauseKind::WellFormed(ty.into()),
1485+
))
1486+
}),
1487+
term_location.to_locations(),
1488+
ConstraintCategory::Boring,
1489+
);
1490+
}
1491+
14761492
self.check_call_dest(body, term, &sig, *destination, *target, term_location);
14771493

14781494
// The ordinary liveness rules will ensure that all

‎compiler/rustc_infer/src/infer/at.rs

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,11 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
285285
T: Relate<'tcx>,
286286
{
287287
let Trace { at, trace, a_is_expected } = self;
288-
at.infcx.commit_if_ok(|_| {
289-
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
290-
fields
291-
.sub(a_is_expected)
292-
.relate(a, b)
293-
.map(move |_| InferOk { value: (), obligations: fields.obligations })
294-
})
288+
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
289+
fields
290+
.sub(a_is_expected)
291+
.relate(a, b)
292+
.map(move |_| InferOk { value: (), obligations: fields.obligations })
295293
}
296294

297295
/// Makes `a == b`; the expectation is set by the call to
@@ -302,13 +300,11 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
302300
T: Relate<'tcx>,
303301
{
304302
let Trace { at, trace, a_is_expected } = self;
305-
at.infcx.commit_if_ok(|_| {
306-
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
307-
fields
308-
.equate(a_is_expected)
309-
.relate(a, b)
310-
.map(move |_| InferOk { value: (), obligations: fields.obligations })
311-
})
303+
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
304+
fields
305+
.equate(a_is_expected)
306+
.relate(a, b)
307+
.map(move |_| InferOk { value: (), obligations: fields.obligations })
312308
}
313309

314310
#[instrument(skip(self), level = "debug")]
@@ -317,13 +313,11 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
317313
T: Relate<'tcx>,
318314
{
319315
let Trace { at, trace, a_is_expected } = self;
320-
at.infcx.commit_if_ok(|_| {
321-
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
322-
fields
323-
.lub(a_is_expected)
324-
.relate(a, b)
325-
.map(move |t| InferOk { value: t, obligations: fields.obligations })
326-
})
316+
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
317+
fields
318+
.lub(a_is_expected)
319+
.relate(a, b)
320+
.map(move |t| InferOk { value: t, obligations: fields.obligations })
327321
}
328322

329323
#[instrument(skip(self), level = "debug")]
@@ -332,13 +326,11 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
332326
T: Relate<'tcx>,
333327
{
334328
let Trace { at, trace, a_is_expected } = self;
335-
at.infcx.commit_if_ok(|_| {
336-
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
337-
fields
338-
.glb(a_is_expected)
339-
.relate(a, b)
340-
.map(move |t| InferOk { value: t, obligations: fields.obligations })
341-
})
329+
let mut fields = at.infcx.combine_fields(trace, at.param_env, define_opaque_types);
330+
fields
331+
.glb(a_is_expected)
332+
.relate(a, b)
333+
.map(move |t| InferOk { value: t, obligations: fields.obligations })
342334
}
343335
}
344336

‎compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -620,42 +620,40 @@ impl<'tcx> InferCtxt<'tcx> {
620620
variables1: &OriginalQueryValues<'tcx>,
621621
variables2: impl Fn(BoundVar) -> GenericArg<'tcx>,
622622
) -> InferResult<'tcx, ()> {
623-
self.commit_if_ok(|_| {
624-
let mut obligations = vec![];
625-
for (index, value1) in variables1.var_values.iter().enumerate() {
626-
let value2 = variables2(BoundVar::new(index));
627-
628-
match (value1.unpack(), value2.unpack()) {
629-
(GenericArgKind::Type(v1), GenericArgKind::Type(v2)) => {
630-
obligations.extend(
631-
self.at(cause, param_env)
632-
.eq(DefineOpaqueTypes::Yes, v1, v2)?
633-
.into_obligations(),
634-
);
635-
}
636-
(GenericArgKind::Lifetime(re1), GenericArgKind::Lifetime(re2))
637-
if re1.is_erased() && re2.is_erased() =>
638-
{
639-
// no action needed
640-
}
641-
(GenericArgKind::Lifetime(v1), GenericArgKind::Lifetime(v2)) => {
642-
obligations.extend(
643-
self.at(cause, param_env)
644-
.eq(DefineOpaqueTypes::Yes, v1, v2)?
645-
.into_obligations(),
646-
);
647-
}
648-
(GenericArgKind::Const(v1), GenericArgKind::Const(v2)) => {
649-
let ok = self.at(cause, param_env).eq(DefineOpaqueTypes::Yes, v1, v2)?;
650-
obligations.extend(ok.into_obligations());
651-
}
652-
_ => {
653-
bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,);
654-
}
623+
let mut obligations = vec![];
624+
for (index, value1) in variables1.var_values.iter().enumerate() {
625+
let value2 = variables2(BoundVar::new(index));
626+
627+
match (value1.unpack(), value2.unpack()) {
628+
(GenericArgKind::Type(v1), GenericArgKind::Type(v2)) => {
629+
obligations.extend(
630+
self.at(cause, param_env)
631+
.eq(DefineOpaqueTypes::Yes, v1, v2)?
632+
.into_obligations(),
633+
);
634+
}
635+
(GenericArgKind::Lifetime(re1), GenericArgKind::Lifetime(re2))
636+
if re1.is_erased() && re2.is_erased() =>
637+
{
638+
// no action needed
639+
}
640+
(GenericArgKind::Lifetime(v1), GenericArgKind::Lifetime(v2)) => {
641+
obligations.extend(
642+
self.at(cause, param_env)
643+
.eq(DefineOpaqueTypes::Yes, v1, v2)?
644+
.into_obligations(),
645+
);
646+
}
647+
(GenericArgKind::Const(v1), GenericArgKind::Const(v2)) => {
648+
let ok = self.at(cause, param_env).eq(DefineOpaqueTypes::Yes, v1, v2)?;
649+
obligations.extend(ok.into_obligations());
650+
}
651+
_ => {
652+
bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,);
655653
}
656654
}
657-
Ok(InferOk { value: (), obligations })
658-
})
655+
}
656+
Ok(InferOk { value: (), obligations })
659657
}
660658
}
661659

‎compiler/rustc_trait_selection/src/solve/assembly/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,13 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
337337
let mut consider_impls_for_simplified_type = |simp| {
338338
if let Some(impls_for_type) = trait_impls.non_blanket_impls().get(&simp) {
339339
for &impl_def_id in impls_for_type {
340+
// For every `default impl`, there's always a non-default `impl`
341+
// that will *also* apply. There's no reason to register a candidate
342+
// for this impl, since it is *not* proof that the trait goal holds.
343+
if tcx.defaultness(impl_def_id).is_default() {
344+
return;
345+
}
346+
340347
match G::consider_impl_candidate(self, goal, impl_def_id) {
341348
Ok(candidate) => candidates.push(candidate),
342349
Err(NoSolution) => (),
@@ -440,6 +447,13 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
440447
let tcx = self.tcx();
441448
let trait_impls = tcx.trait_impls_of(goal.predicate.trait_def_id(tcx));
442449
for &impl_def_id in trait_impls.blanket_impls() {
450+
// For every `default impl`, there's always a non-default `impl`
451+
// that will *also* apply. There's no reason to register a candidate
452+
// for this impl, since it is *not* proof that the trait goal holds.
453+
if tcx.defaultness(impl_def_id).is_default() {
454+
return;
455+
}
456+
443457
match G::consider_impl_candidate(self, goal, impl_def_id) {
444458
Ok(candidate) => candidates.push(candidate),
445459
Err(NoSolution) => (),

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
566566
{
567567
return;
568568
}
569+
570+
// For every `default impl`, there's always a non-default `impl`
571+
// that will *also* apply. There's no reason to register a candidate
572+
// for this impl, since it is *not* proof that the trait goal holds.
573+
if self.tcx().defaultness(impl_def_id).is_default() {
574+
return;
575+
}
576+
569577
if self.reject_fn_ptr_impls(
570578
impl_def_id,
571579
obligation,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
192192
&mut obligations,
193193
);
194194

195-
obligations.extend(self.infcx.commit_if_ok(|_| {
195+
obligations.extend(
196196
self.infcx
197197
.at(&obligation.cause, obligation.param_env)
198198
.sup(DefineOpaqueTypes::No, placeholder_trait_predicate, candidate)
199199
.map(|InferOk { obligations, .. }| obligations)
200-
.map_err(|_| Unimplemented)
201-
})?);
200+
.map_err(|_| Unimplemented)?,
201+
);
202202

203203
// FIXME(compiler-errors): I don't think this is needed.
204204
if let ty::Alias(ty::Projection, alias_ty) = placeholder_self_ty.kind() {
@@ -532,13 +532,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
532532
&mut nested,
533533
);
534534

535-
nested.extend(self.infcx.commit_if_ok(|_| {
535+
nested.extend(
536536
self.infcx
537537
.at(&obligation.cause, obligation.param_env)
538538
.sup(DefineOpaqueTypes::No, obligation_trait_ref, upcast_trait_ref)
539539
.map(|InferOk { obligations, .. }| obligations)
540-
.map_err(|_| Unimplemented)
541-
})?);
540+
.map_err(|_| Unimplemented)?,
541+
);
542542

543543
// Check supertraits hold. This is so that their associated type bounds
544544
// will be checked in the code below.

‎library/std/src/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub struct Child {
171171
/// The handle for writing to the child's standard input (stdin), if it
172172
/// has been captured. You might find it helpful to do
173173
///
174-
/// ```compile_fail,E0425
174+
/// ```ignore (incomplete)
175175
/// let stdin = child.stdin.take().unwrap();
176176
/// ```
177177
///
@@ -183,7 +183,7 @@ pub struct Child {
183183
/// The handle for reading from the child's standard output (stdout), if it
184184
/// has been captured. You might find it helpful to do
185185
///
186-
/// ```compile_fail,E0425
186+
/// ```ignore (incomplete)
187187
/// let stdout = child.stdout.take().unwrap();
188188
/// ```
189189
///
@@ -195,7 +195,7 @@ pub struct Child {
195195
/// The handle for reading from the child's standard error (stderr), if it
196196
/// has been captured. You might find it helpful to do
197197
///
198-
/// ```compile_fail,E0425
198+
/// ```ignore (incomplete)
199199
/// let stderr = child.stderr.take().unwrap();
200200
/// ```
201201
///

‎src/librustdoc/clean/mod.rs

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,14 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
254254
}
255255

256256
fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) -> Lifetime {
257-
let def = cx.tcx.named_bound_var(lifetime.hir_id);
258257
if let Some(
259-
rbv::ResolvedArg::EarlyBound(node_id)
260-
| rbv::ResolvedArg::LateBound(_, _, node_id)
261-
| rbv::ResolvedArg::Free(_, node_id),
262-
) = def
258+
rbv::ResolvedArg::EarlyBound(did)
259+
| rbv::ResolvedArg::LateBound(_, _, did)
260+
| rbv::ResolvedArg::Free(_, did),
261+
) = cx.tcx.named_bound_var(lifetime.hir_id)
262+
&& let Some(lt) = cx.args.get(&did).and_then(|arg| arg.as_lt())
263263
{
264-
if let Some(lt) = cx.args.get(&node_id).and_then(|p| p.as_lt()).cloned() {
265-
return lt;
266-
}
264+
return lt.clone();
267265
}
268266
Lifetime(lifetime.ident.name)
269267
}
@@ -1791,12 +1789,12 @@ fn maybe_expand_private_type_alias<'tcx>(
17911789
_ => None,
17921790
});
17931791
if let Some(lt) = lifetime {
1794-
let cleaned = if !lt.is_anonymous() {
1792+
let lt = if !lt.is_anonymous() {
17951793
clean_lifetime(lt, cx)
17961794
} else {
17971795
Lifetime::elided()
17981796
};
1799-
args.insert(param.def_id.to_def_id(), InstantiationParam::Lifetime(cleaned));
1797+
args.insert(param.def_id.to_def_id(), GenericArg::Lifetime(lt));
18001798
}
18011799
indices.lifetimes += 1;
18021800
}
@@ -1805,44 +1803,20 @@ fn maybe_expand_private_type_alias<'tcx>(
18051803
let type_ = generic_args.args.iter().find_map(|arg| match arg {
18061804
hir::GenericArg::Type(ty) => {
18071805
if indices.types == j {
1808-
return Some(ty);
1806+
return Some(*ty);
18091807
}
18101808
j += 1;
18111809
None
18121810
}
18131811
_ => None,
18141812
});
1815-
if let Some(ty) = type_ {
1816-
args.insert(
1817-
param.def_id.to_def_id(),
1818-
InstantiationParam::Type(clean_ty(ty, cx)),
1819-
);
1820-
} else if let Some(default) = *default {
1821-
args.insert(
1822-
param.def_id.to_def_id(),
1823-
InstantiationParam::Type(clean_ty(default, cx)),
1824-
);
1813+
if let Some(ty) = type_.or(*default) {
1814+
args.insert(param.def_id.to_def_id(), GenericArg::Type(clean_ty(ty, cx)));
18251815
}
18261816
indices.types += 1;
18271817
}
1828-
hir::GenericParamKind::Const { .. } => {
1829-
let mut j = 0;
1830-
let const_ = generic_args.args.iter().find_map(|arg| match arg {
1831-
hir::GenericArg::Const(ct) => {
1832-
if indices.consts == j {
1833-
return Some(ct);
1834-
}
1835-
j += 1;
1836-
None
1837-
}
1838-
_ => None,
1839-
});
1840-
if let Some(_) = const_ {
1841-
args.insert(param.def_id.to_def_id(), InstantiationParam::Constant);
1842-
}
1843-
// FIXME(const_generics_defaults)
1844-
indices.consts += 1;
1845-
}
1818+
// FIXME(#82852): Instantiate const parameters.
1819+
hir::GenericParamKind::Const { .. } => {}
18461820
}
18471821
}
18481822

‎src/librustdoc/clean/types.rs

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,16 @@ pub(crate) enum GenericArg {
22282228
Infer,
22292229
}
22302230

2231+
impl GenericArg {
2232+
pub(crate) fn as_lt(&self) -> Option<&Lifetime> {
2233+
if let Self::Lifetime(lt) = self { Some(lt) } else { None }
2234+
}
2235+
2236+
pub(crate) fn as_ty(&self) -> Option<&Type> {
2237+
if let Self::Type(ty) = self { Some(ty) } else { None }
2238+
}
2239+
}
2240+
22312241
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
22322242
pub(crate) enum GenericArgs {
22332243
AngleBracketed { args: Box<[GenericArg]>, bindings: ThinVec<TypeBinding> },
@@ -2530,35 +2540,6 @@ pub(crate) enum TypeBindingKind {
25302540
Constraint { bounds: Vec<GenericBound> },
25312541
}
25322542

2533-
/// The type, lifetime, or constant that a private type alias's parameter should be
2534-
/// replaced with when expanding a use of that type alias.
2535-
///
2536-
/// For example:
2537-
///
2538-
/// ```
2539-
/// type PrivAlias<T> = Vec<T>;
2540-
///
2541-
/// pub fn public_fn() -> PrivAlias<i32> { vec![] }
2542-
/// ```
2543-
///
2544-
/// `public_fn`'s docs will show it as returning `Vec<i32>`, since `PrivAlias` is private.
2545-
/// [`InstantiationParam`] is used to record that `T` should be mapped to `i32`.
2546-
pub(crate) enum InstantiationParam {
2547-
Type(Type),
2548-
Lifetime(Lifetime),
2549-
Constant,
2550-
}
2551-
2552-
impl InstantiationParam {
2553-
pub(crate) fn as_ty(&self) -> Option<&Type> {
2554-
if let Self::Type(ty) = self { Some(ty) } else { None }
2555-
}
2556-
2557-
pub(crate) fn as_lt(&self) -> Option<&Lifetime> {
2558-
if let Self::Lifetime(lt) = self { Some(lt) } else { None }
2559-
}
2560-
}
2561-
25622543
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
25632544
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
25642545
mod size_asserts {

‎src/librustdoc/core.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ pub(crate) struct DocContext<'tcx> {
4444
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
4545
/// the same time.
4646
pub(crate) active_extern_traits: DefIdSet,
47-
// The current set of parameter instantiations,
48-
// for expanding type aliases at the HIR level:
49-
/// Table `DefId` of type, lifetime, or const parameter -> instantiated type, lifetime, or const
50-
pub(crate) args: DefIdMap<clean::InstantiationParam>,
47+
/// The current set of parameter instantiations for expanding type aliases at the HIR level.
48+
///
49+
/// Maps from the `DefId` of a lifetime or type parameter to the
50+
/// generic argument it's currently instantiated to in this context.
51+
// FIXME(#82852): We don't record const params since we don't visit const exprs at all and
52+
// therefore wouldn't use the corresp. generic arg anyway. Add support for them.
53+
pub(crate) args: DefIdMap<clean::GenericArg>,
5154
pub(crate) current_type_aliases: DefIdMap<usize>,
5255
/// Table synthetic type parameter for `impl Trait` in argument position -> bounds
5356
pub(crate) impl_trait_bounds: FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>,
@@ -87,7 +90,7 @@ impl<'tcx> DocContext<'tcx> {
8790
/// the generic parameters for a type alias' RHS.
8891
pub(crate) fn enter_alias<F, R>(
8992
&mut self,
90-
args: DefIdMap<clean::InstantiationParam>,
93+
args: DefIdMap<clean::GenericArg>,
9194
def_id: DefId,
9295
f: F,
9396
) -> R

‎tests/ui/asm/inline-syntax.arm.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | .intel_syntax noprefix
1313
| ^
1414

1515
error: unknown directive
16-
--> $DIR/inline-syntax.rs:38:15
16+
--> $DIR/inline-syntax.rs:35:15
1717
|
1818
LL | asm!(".intel_syntax noprefix", "nop");
1919
| ^
@@ -25,7 +25,7 @@ LL | .intel_syntax noprefix
2525
| ^
2626

2727
error: unknown directive
28-
--> $DIR/inline-syntax.rs:42:15
28+
--> $DIR/inline-syntax.rs:39:15
2929
|
3030
LL | asm!(".intel_syntax aaa noprefix", "nop");
3131
| ^
@@ -37,7 +37,7 @@ LL | .intel_syntax aaa noprefix
3737
| ^
3838

3939
error: unknown directive
40-
--> $DIR/inline-syntax.rs:46:15
40+
--> $DIR/inline-syntax.rs:43:15
4141
|
4242
LL | asm!(".att_syntax noprefix", "nop");
4343
| ^
@@ -49,7 +49,7 @@ LL | .att_syntax noprefix
4949
| ^
5050

5151
error: unknown directive
52-
--> $DIR/inline-syntax.rs:50:15
52+
--> $DIR/inline-syntax.rs:47:15
5353
|
5454
LL | asm!(".att_syntax bbb noprefix", "nop");
5555
| ^
@@ -61,7 +61,7 @@ LL | .att_syntax bbb noprefix
6161
| ^
6262

6363
error: unknown directive
64-
--> $DIR/inline-syntax.rs:54:15
64+
--> $DIR/inline-syntax.rs:51:15
6565
|
6666
LL | asm!(".intel_syntax noprefix; nop");
6767
| ^
@@ -73,7 +73,7 @@ LL | .intel_syntax noprefix; nop
7373
| ^
7474

7575
error: unknown directive
76-
--> $DIR/inline-syntax.rs:61:13
76+
--> $DIR/inline-syntax.rs:58:13
7777
|
7878
LL | .intel_syntax noprefix
7979
| ^

‎tests/ui/asm/inline-syntax.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
33
//[x86_64] check-pass
44
//[x86_64] needs-llvm-components: x86
5-
//[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu
6-
//[x86_64_allowed] check-pass
7-
//[x86_64_allowed] needs-llvm-components: x86
85
//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
96
//[arm] build-fail
107
//[arm] needs-llvm-components: arm
118
//[arm] ignore-llvm-version: 18 - 99
12-
// Newer LLVM produces extra error notes.
9+
//Newer LLVM produces extra error notes.
1310
//[arm_llvm_18] compile-flags: --target armv7-unknown-linux-gnueabihf
1411
//[arm_llvm_18] build-fail
1512
//[arm_llvm_18] needs-llvm-components: arm

‎tests/ui/asm/inline-syntax.x86_64.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
warning: avoid using `.intel_syntax`, Intel syntax is the default
2-
--> $DIR/inline-syntax.rs:70:14
2+
--> $DIR/inline-syntax.rs:67:14
33
|
44
LL | global_asm!(".intel_syntax noprefix", "nop");
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(bad_asm_style)]` on by default
88

99
warning: avoid using `.intel_syntax`, Intel syntax is the default
10-
--> $DIR/inline-syntax.rs:38:15
10+
--> $DIR/inline-syntax.rs:35:15
1111
|
1212
LL | asm!(".intel_syntax noprefix", "nop");
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

1515
warning: avoid using `.intel_syntax`, Intel syntax is the default
16-
--> $DIR/inline-syntax.rs:42:15
16+
--> $DIR/inline-syntax.rs:39:15
1717
|
1818
LL | asm!(".intel_syntax aaa noprefix", "nop");
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

2121
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
22-
--> $DIR/inline-syntax.rs:46:15
22+
--> $DIR/inline-syntax.rs:43:15
2323
|
2424
LL | asm!(".att_syntax noprefix", "nop");
2525
| ^^^^^^^^^^^^^^^^^^^^
2626

2727
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
28-
--> $DIR/inline-syntax.rs:50:15
28+
--> $DIR/inline-syntax.rs:47:15
2929
|
3030
LL | asm!(".att_syntax bbb noprefix", "nop");
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^
3232

3333
warning: avoid using `.intel_syntax`, Intel syntax is the default
34-
--> $DIR/inline-syntax.rs:54:15
34+
--> $DIR/inline-syntax.rs:51:15
3535
|
3636
LL | asm!(".intel_syntax noprefix; nop");
3737
| ^^^^^^^^^^^^^^^^^^^^^^
3838

3939
warning: avoid using `.intel_syntax`, Intel syntax is the default
40-
--> $DIR/inline-syntax.rs:61:13
40+
--> $DIR/inline-syntax.rs:58:13
4141
|
4242
LL | .intel_syntax noprefix
4343
| ^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run-rustfix
2+
pub struct DataStruct();
3+
4+
pub struct HelperStruct<'n> {
5+
pub helpers: [Vec<&'n i64>; 2],
6+
pub is_empty: bool,
7+
}
8+
9+
impl DataStruct {
10+
pub fn f(&self) -> HelperStruct {
11+
let helpers = [vec![], vec![]];
12+
13+
HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() }
14+
//~^ ERROR borrow of moved value
15+
}
16+
}
17+
18+
fn main() {}

‎tests/ui/borrowck/copy-suggestion-region-vid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@run-rustfix
1+
// run-rustfix
22
pub struct DataStruct();
33

44
pub struct HelperStruct<'n> {

‎tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | |
99
LL | | });
1010
| |______^ expected due to this
1111
|
12-
= note: expected closure signature `fn(_, _) -> _`
13-
found closure signature `fn(u32, i32) -> _`
12+
= note: expected closure signature `fn(_, u32) -> _`
13+
found closure signature `fn(_, i32) -> _`
1414
note: required by a bound in `with_closure`
1515
--> $DIR/expect-infer-var-appearing-twice.rs:2:14
1616
|
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// <https://github.com/rust-lang/rust/issues/114936>
2+
fn whoops(
3+
s: String,
4+
f: impl for<'s> FnOnce(&'s str) -> (&'static str, [&'static &'s (); 0]),
5+
) -> &'static str
6+
{
7+
f(&s).0
8+
//~^ ERROR `s` does not live long enough
9+
}
10+
11+
// <https://github.com/rust-lang/rust/issues/118876>
12+
fn extend<T>(input: &T) -> &'static T {
13+
struct Bounded<'a, 'b: 'static, T>(&'a T, [&'b (); 0]);
14+
let n: Box<dyn FnOnce(&T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, []));
15+
n(input).0
16+
//~^ ERROR borrowed data escapes outside of function
17+
}
18+
19+
// <https://github.com/rust-lang/rust/issues/118876>
20+
fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T {
21+
struct Bounded<'a, 'b: 'static, T>(&'a mut T, [&'b (); 0]);
22+
let mut n: Box<dyn FnMut(&mut T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, []));
23+
n(input).0
24+
//~^ ERROR borrowed data escapes outside of function
25+
}
26+
27+
fn main() {}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
error[E0597]: `s` does not live long enough
2+
--> $DIR/check-normalized-sig-for-wf.rs:7:7
3+
|
4+
LL | s: String,
5+
| - binding `s` declared here
6+
...
7+
LL | f(&s).0
8+
| --^^-
9+
| | |
10+
| | borrowed value does not live long enough
11+
| argument requires that `s` is borrowed for `'static`
12+
LL |
13+
LL | }
14+
| - `s` dropped here while still borrowed
15+
16+
error[E0521]: borrowed data escapes outside of function
17+
--> $DIR/check-normalized-sig-for-wf.rs:15:5
18+
|
19+
LL | fn extend<T>(input: &T) -> &'static T {
20+
| ----- - let's call the lifetime of this reference `'1`
21+
| |
22+
| `input` is a reference that is only valid in the function body
23+
...
24+
LL | n(input).0
25+
| ^^^^^^^^
26+
| |
27+
| `input` escapes the function body here
28+
| argument requires that `'1` must outlive `'static`
29+
30+
error[E0521]: borrowed data escapes outside of function
31+
--> $DIR/check-normalized-sig-for-wf.rs:23:5
32+
|
33+
LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T {
34+
| -- ----- `input` is a reference that is only valid in the function body
35+
| |
36+
| lifetime `'a` defined here
37+
...
38+
LL | n(input).0
39+
| ^^^^^^^^
40+
| |
41+
| `input` escapes the function body here
42+
| argument requires that `'a` must outlive `'static`
43+
44+
error: aborting due to 3 previous errors
45+
46+
Some errors have detailed explanations: E0521, E0597.
47+
For more information about an error, try `rustc --explain E0521`.

‎tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ default impl<T> Foo for T {
2020

2121
fn main() {
2222
println!("{}", MyStruct.foo_one());
23-
//~^ ERROR the method
23+
//~^ ERROR no method named `foo_one` found for struct `MyStruct` in the current scope
2424
}

‎tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@ LL | #![feature(specialization)]
88
= help: consider using `min_specialization` instead, which is more stable and complete
99
= note: `#[warn(incomplete_features)]` on by default
1010

11-
error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait bounds were not satisfied
11+
error[E0599]: no method named `foo_one` found for struct `MyStruct` in the current scope
1212
--> $DIR/specialization-trait-not-implemented.rs:22:29
1313
|
1414
LL | struct MyStruct;
15-
| --------------- method `foo_one` not found for this struct because it doesn't satisfy `MyStruct: Foo`
15+
| --------------- method `foo_one` not found for this struct
1616
...
1717
LL | println!("{}", MyStruct.foo_one());
18-
| ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds
18+
| ^^^^^^^ method not found in `MyStruct`
1919
|
20-
note: trait bound `MyStruct: Foo` was not satisfied
21-
--> $DIR/specialization-trait-not-implemented.rs:14:1
22-
|
23-
LL | default impl<T> Foo for T {
24-
| ^^^^^^^^^^^^^^^^---^^^^^-
25-
| |
26-
| unsatisfied trait bound introduced here
27-
note: the trait `Foo` must be implemented
28-
--> $DIR/specialization-trait-not-implemented.rs:7:1
29-
|
30-
LL | trait Foo {
31-
| ^^^^^^^^^
3220
= help: items from traits can only be used if the trait is implemented and in scope
3321
note: `Foo` defines an item `foo_one`, perhaps you need to implement it
3422
--> $DIR/specialization-trait-not-implemented.rs:7:1

‎tests/ui/specialization/defaultimpl/validation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct Z;
77
default impl S {} //~ ERROR inherent impls cannot be `default`
88

99
default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default
10+
//~^ ERROR `S` cannot be sent between threads safely
1011
default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default
1112
//~^ ERROR negative impls cannot be default impls
1213

‎tests/ui/specialization/defaultimpl/validation.stderr

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,38 @@ LL | default unsafe impl Send for S {}
2626
| |
2727
| default because of this
2828

29+
error[E0277]: `S` cannot be sent between threads safely
30+
--> $DIR/validation.rs:9:1
31+
|
32+
LL | default unsafe impl Send for S {}
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `S` cannot be sent between threads safely
34+
|
35+
= help: the trait `Send` is not implemented for `S`
36+
= help: the trait `Send` is implemented for `S`
37+
= help: see issue #48214
38+
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
39+
2940
error: impls of auto traits cannot be default
30-
--> $DIR/validation.rs:10:15
41+
--> $DIR/validation.rs:11:15
3142
|
3243
LL | default impl !Send for Z {}
3344
| ------- ^^^^ auto trait
3445
| |
3546
| default because of this
3647

3748
error[E0750]: negative impls cannot be default impls
38-
--> $DIR/validation.rs:10:1
49+
--> $DIR/validation.rs:11:1
3950
|
4051
LL | default impl !Send for Z {}
4152
| ^^^^^^^ ^
4253

4354
error[E0750]: negative impls cannot be default impls
44-
--> $DIR/validation.rs:14:1
55+
--> $DIR/validation.rs:15:1
4556
|
4657
LL | default impl !Tr for S {}
4758
| ^^^^^^^ ^
4859

49-
error: aborting due to 5 previous errors; 1 warning emitted
60+
error: aborting due to 6 previous errors; 1 warning emitted
5061

51-
For more information about this error, try `rustc --explain E0750`.
62+
Some errors have detailed explanations: E0277, E0750.
63+
For more information about an error, try `rustc --explain E0277`.
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
error[E0275]: overflow evaluating the requirement `T: Trait<_>`
2-
|
3-
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`)
4-
note: required for `T` to implement `Trait<_>`
5-
--> $DIR/issue-45814.rs:9:20
1+
error[E0119]: conflicting implementations of trait `Trait<_>`
2+
--> $DIR/issue-45814.rs:10:1
63
|
74
LL | default impl<T, U> Trait<T> for U {}
8-
| ^^^^^^^^ ^
9-
= note: 128 redundant requirements hidden
10-
= note: required for `T` to implement `Trait<_>`
5+
| --------------------------------- first implementation here
6+
LL |
7+
LL | impl<T> Trait<<T as Iterator>::Item> for T {}
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
119

1210
error: aborting due to 1 previous error
1311

14-
For more information about this error, try `rustc --explain E0275`.
12+
For more information about this error, try `rustc --explain E0119`.
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
error[E0275]: overflow evaluating the requirement `T: Trait<_>`
2-
|
3-
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`)
4-
note: required for `T` to implement `Trait<_>`
5-
--> $DIR/issue-45814.rs:9:20
1+
error[E0119]: conflicting implementations of trait `Trait<_>`
2+
--> $DIR/issue-45814.rs:10:1
63
|
74
LL | default impl<T, U> Trait<T> for U {}
8-
| ^^^^^^^^ ^
9-
= note: 128 redundant requirements hidden
10-
= note: required for `T` to implement `Trait<_>`
5+
| --------------------------------- first implementation here
6+
LL |
7+
LL | impl<T> Trait<<T as Iterator>::Item> for T {}
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
119

1210
error: aborting due to 1 previous error
1311

14-
For more information about this error, try `rustc --explain E0275`.
12+
For more information about this error, try `rustc --explain E0119`.

‎tests/ui/specialization/issue-45814.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//~ ERROR overflow evaluating the requirement `T: Trait<_>`
21
// revisions: current negative
32
#![feature(specialization)]
43
#![cfg_attr(negative, feature(with_negative_coherence))]
@@ -9,5 +8,6 @@ pub trait Trait<T> {}
98
default impl<T, U> Trait<T> for U {}
109

1110
impl<T> Trait<<T as Iterator>::Item> for T {}
11+
//~^ ERROR conflicting implementations of trait `Trait<_>`
1212

1313
fn main() {}

‎triagebot.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ compiler-team = [
651651
"@petrochenkov",
652652
"@davidtwco",
653653
"@estebank",
654+
"@lcnr",
654655
"@oli-obk",
655656
"@pnkfelix",
656657
"@wesleywiser",
@@ -680,7 +681,6 @@ infra-ci = [
680681
"@Kobzol",
681682
]
682683
rustdoc = [
683-
"@jsha",
684684
"@GuillaumeGomez",
685685
"@notriddle",
686686
"@fmease",

0 commit comments

Comments
 (0)
Please sign in to comment.