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 489647f

Browse files
committedOct 21, 2023
Auto merge of rust-lang#117005 - cuviper:beta-next, r=cuviper
[beta] backports and stage0 bump - Bump stage0 to released stable compiler - Hide host effect params from docs rust-lang#116670 - Fix a performance regression in obligation deduplication. rust-lang#116826 - Make `#[repr(Rust)]` and `#[repr(C)]` incompatible with one another rust-lang#116829 - Update to LLVM 17.0.3 rust-lang#116840 - Disable effects in libcore again rust-lang#116856 - revert rust-lang#114586 rust-lang#116879 r? cuviper
2 parents ae8769d + eec25d6 commit 489647f

31 files changed

+602
-508
lines changed
 

‎compiler/rustc_borrowck/src/region_infer/opaque_types.rs

+13-20
Original file line numberDiff line numberDiff line change
@@ -328,26 +328,19 @@ fn check_opaque_type_well_formed<'tcx>(
328328

329329
// Require that the hidden type actually fulfills all the bounds of the opaque type, even without
330330
// the bounds that the function supplies.
331-
let mut obligations = vec![];
332-
infcx
333-
.insert_hidden_type(
334-
OpaqueTypeKey { def_id, args: identity_args },
335-
&ObligationCause::misc(definition_span, def_id),
336-
param_env,
337-
definition_ty,
338-
true,
339-
&mut obligations,
340-
)
341-
.unwrap();
342-
infcx.add_item_bounds_for_hidden_type(
343-
def_id.to_def_id(),
344-
identity_args,
345-
ObligationCause::misc(definition_span, def_id),
346-
param_env,
347-
definition_ty,
348-
&mut obligations,
349-
);
350-
ocx.register_obligations(obligations);
331+
let opaque_ty = Ty::new_opaque(tcx, def_id.to_def_id(), identity_args);
332+
ocx.eq(&ObligationCause::misc(definition_span, def_id), param_env, opaque_ty, definition_ty)
333+
.map_err(|err| {
334+
infcx
335+
.err_ctxt()
336+
.report_mismatched_types(
337+
&ObligationCause::misc(definition_span, def_id),
338+
opaque_ty,
339+
definition_ty,
340+
err,
341+
)
342+
.emit()
343+
})?;
351344

352345
// Require the hidden type to be well-formed with only the generics of the opaque type.
353346
// Defining use functions may have more bounds than the opaque type, which is ok, as long as the

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

+1-19
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,7 @@ impl<'tcx> InferCtxt<'tcx> {
145145
return None;
146146
}
147147
}
148-
DefiningAnchor::Bubble => {
149-
if let ty::Alias(ty::Opaque, _) = b.kind() {
150-
// In bubble mode we don't know which of the two opaque types is supposed to have the other
151-
// as a hidden type (both, none or either one of them could be in its defining scope).
152-
let predicate = ty::PredicateKind::AliasRelate(
153-
a.into(),
154-
b.into(),
155-
ty::AliasRelationDirection::Equate,
156-
);
157-
let obligation = traits::Obligation::new(
158-
self.tcx,
159-
cause.clone(),
160-
param_env,
161-
predicate,
162-
);
163-
let obligations = vec![obligation];
164-
return Some(Ok(InferOk { value: (), obligations }));
165-
}
166-
}
148+
DefiningAnchor::Bubble => {}
167149
DefiningAnchor::Error => return None,
168150
};
169151
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }) = *b.kind() {

‎compiler/rustc_passes/src/check_attr.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ impl CheckAttrVisitor<'_> {
17671767
.collect();
17681768

17691769
let mut int_reprs = 0;
1770+
let mut is_explicit_rust = false;
17701771
let mut is_c = false;
17711772
let mut is_simd = false;
17721773
let mut is_transparent = false;
@@ -1778,7 +1779,9 @@ impl CheckAttrVisitor<'_> {
17781779
}
17791780

17801781
match hint.name_or_empty() {
1781-
sym::Rust => {}
1782+
sym::Rust => {
1783+
is_explicit_rust = true;
1784+
}
17821785
sym::C => {
17831786
is_c = true;
17841787
match target {
@@ -1888,12 +1891,16 @@ impl CheckAttrVisitor<'_> {
18881891

18891892
// Error on repr(transparent, <anything else>).
18901893
if is_transparent && hints.len() > 1 {
1891-
let hint_spans: Vec<_> = hint_spans.clone().collect();
1894+
let hint_spans = hint_spans.clone().collect();
18921895
self.tcx.sess.emit_err(errors::TransparentIncompatible {
18931896
hint_spans,
18941897
target: target.to_string(),
18951898
});
18961899
}
1900+
if is_explicit_rust && (int_reprs > 0 || is_c || is_simd) {
1901+
let hint_spans = hint_spans.clone().collect();
1902+
self.tcx.sess.emit_err(errors::ReprConflicting { hint_spans });
1903+
}
18971904
// Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8)
18981905
if (int_reprs > 1)
18991906
|| (is_simd && is_c)
@@ -1910,7 +1917,7 @@ impl CheckAttrVisitor<'_> {
19101917
CONFLICTING_REPR_HINTS,
19111918
hir_id,
19121919
hint_spans.collect::<Vec<Span>>(),
1913-
errors::ReprConflicting,
1920+
errors::ReprConflictingLint,
19141921
);
19151922
}
19161923
}

‎compiler/rustc_passes/src/errors.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,16 @@ pub struct ReprIdent {
558558
pub span: Span,
559559
}
560560

561+
#[derive(Diagnostic)]
562+
#[diag(passes_repr_conflicting, code = "E0566")]
563+
pub struct ReprConflicting {
564+
#[primary_span]
565+
pub hint_spans: Vec<Span>,
566+
}
567+
561568
#[derive(LintDiagnostic)]
562569
#[diag(passes_repr_conflicting, code = "E0566")]
563-
pub struct ReprConflicting;
570+
pub struct ReprConflictingLint;
564571

565572
#[derive(Diagnostic)]
566573
#[diag(passes_used_static)]

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

+2-21
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_infer::infer::DefineOpaqueTypes;
66
use rustc_infer::traits::ProjectionCacheKey;
77
use rustc_infer::traits::{PolyTraitObligation, SelectionError, TraitEngine};
88
use rustc_middle::mir::interpret::ErrorHandled;
9-
use rustc_middle::traits::DefiningAnchor;
109
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
1110
use rustc_middle::ty::error::{ExpectedFound, TypeError};
1211
use rustc_middle::ty::GenericArgsRef;
@@ -626,27 +625,9 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
626625
}
627626
}
628627
ty::PredicateKind::Ambiguous => ProcessResult::Unchanged,
629-
ty::PredicateKind::AliasRelate(..)
630-
if matches!(self.selcx.infcx.defining_use_anchor, DefiningAnchor::Bubble) =>
631-
{
632-
ProcessResult::Unchanged
628+
ty::PredicateKind::AliasRelate(..) => {
629+
bug!("AliasRelate is only used for new solver")
633630
}
634-
ty::PredicateKind::AliasRelate(a, b, relate) => match relate {
635-
ty::AliasRelationDirection::Equate => match self
636-
.selcx
637-
.infcx
638-
.at(&obligation.cause, obligation.param_env)
639-
.eq(DefineOpaqueTypes::Yes, a, b)
640-
{
641-
Ok(inf_ok) => ProcessResult::Changed(mk_pending(inf_ok.into_obligations())),
642-
Err(_) => ProcessResult::Error(FulfillmentErrorCode::CodeSelectionError(
643-
SelectionError::Unimplemented,
644-
)),
645-
},
646-
ty::AliasRelationDirection::Subtype => {
647-
bug!("AliasRelate with subtyping is only used for new solver")
648-
}
649-
},
650631
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
651632
match self.selcx.infcx.at(&obligation.cause, obligation.param_env).eq(
652633
DefineOpaqueTypes::No,

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
12331233

12341234
let projected_term = selcx.infcx.resolve_vars_if_possible(projected_term);
12351235

1236-
let result = if projected_term.has_projections() {
1236+
let mut result = if projected_term.has_projections() {
12371237
let mut normalizer = AssocTypeNormalizer::new(
12381238
selcx,
12391239
param_env,
@@ -1243,14 +1243,14 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
12431243
);
12441244
let normalized_ty = normalizer.fold(projected_term);
12451245

1246-
let mut deduped = SsoHashSet::with_capacity(projected_obligations.len());
1247-
projected_obligations.retain(|obligation| deduped.insert(obligation.clone()));
1248-
12491246
Normalized { value: normalized_ty, obligations: projected_obligations }
12501247
} else {
12511248
Normalized { value: projected_term, obligations: projected_obligations }
12521249
};
12531250

1251+
let mut deduped = SsoHashSet::with_capacity(result.obligations.len());
1252+
result.obligations.retain(|obligation| deduped.insert(obligation.clone()));
1253+
12541254
if use_cache {
12551255
infcx.inner.borrow_mut().projection_cache().insert_term(cache_key, result.clone());
12561256
}

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

+2-21
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use rustc_infer::traits::TraitObligation;
3838
use rustc_middle::dep_graph::dep_kinds;
3939
use rustc_middle::dep_graph::DepNodeIndex;
4040
use rustc_middle::mir::interpret::ErrorHandled;
41-
use rustc_middle::traits::DefiningAnchor;
4241
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
4342
use rustc_middle::ty::fold::BottomUpFolder;
4443
use rustc_middle::ty::relate::TypeRelation;
@@ -1003,27 +1002,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10031002
}
10041003
}
10051004
}
1006-
ty::PredicateKind::AliasRelate(..)
1007-
if matches!(self.infcx.defining_use_anchor, DefiningAnchor::Bubble) =>
1008-
{
1009-
Ok(EvaluatedToAmbig)
1005+
ty::PredicateKind::AliasRelate(..) => {
1006+
bug!("AliasRelate is only used for new solver")
10101007
}
1011-
ty::PredicateKind::AliasRelate(a, b, relate) => match relate {
1012-
ty::AliasRelationDirection::Equate => match self
1013-
.infcx
1014-
.at(&obligation.cause, obligation.param_env)
1015-
.eq(DefineOpaqueTypes::Yes, a, b)
1016-
{
1017-
Ok(inf_ok) => self.evaluate_predicates_recursively(
1018-
previous_stack,
1019-
inf_ok.into_obligations(),
1020-
),
1021-
Err(_) => Ok(EvaluatedToErr),
1022-
},
1023-
ty::AliasRelationDirection::Subtype => {
1024-
bug!("AliasRelate subtyping is only used for new solver")
1025-
}
1026-
},
10271008
ty::PredicateKind::Ambiguous => Ok(EvaluatedToAmbig),
10281009
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
10291010
match self.infcx.at(&obligation.cause, obligation.param_env).eq(

‎library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@
196196
//
197197
// Language features:
198198
// tidy-alphabetical-start
199-
#![cfg_attr(not(bootstrap), feature(effects))]
200199
#![feature(abi_unadjusted)]
201200
#![feature(adt_const_params)]
202201
#![feature(allow_internal_unsafe)]

‎src/librustdoc/clean/mod.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ fn clean_generic_param_def<'tcx>(
542542
},
543543
)
544544
}
545-
ty::GenericParamDefKind::Const { has_default, .. } => (
545+
ty::GenericParamDefKind::Const { has_default, is_host_effect } => (
546546
def.name,
547547
GenericParamDefKind::Const {
548548
ty: Box::new(clean_middle_ty(
@@ -562,6 +562,7 @@ fn clean_generic_param_def<'tcx>(
562562
)),
563563
false => None,
564564
},
565+
is_host_effect,
565566
},
566567
),
567568
};
@@ -618,6 +619,7 @@ fn clean_generic_param<'tcx>(
618619
ty: Box::new(clean_ty(ty, cx)),
619620
default: default
620621
.map(|ct| Box::new(ty::Const::from_anon_const(cx.tcx, ct.def_id).to_string())),
622+
is_host_effect: cx.tcx.has_attr(param.def_id, sym::rustc_host),
621623
},
622624
),
623625
};
@@ -2540,14 +2542,22 @@ fn clean_generic_args<'tcx>(
25402542
let args = generic_args
25412543
.args
25422544
.iter()
2543-
.map(|arg| match arg {
2544-
hir::GenericArg::Lifetime(lt) if !lt.is_anonymous() => {
2545-
GenericArg::Lifetime(clean_lifetime(*lt, cx))
2546-
}
2547-
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
2548-
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
2549-
hir::GenericArg::Const(ct) => GenericArg::Const(Box::new(clean_const(ct, cx))),
2550-
hir::GenericArg::Infer(_inf) => GenericArg::Infer,
2545+
.filter_map(|arg| {
2546+
Some(match arg {
2547+
hir::GenericArg::Lifetime(lt) if !lt.is_anonymous() => {
2548+
GenericArg::Lifetime(clean_lifetime(*lt, cx))
2549+
}
2550+
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
2551+
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
2552+
// FIXME(effects): This will still emit `<true>` for non-const impls of const traits
2553+
hir::GenericArg::Const(ct)
2554+
if cx.tcx.has_attr(ct.value.def_id, sym::rustc_host) =>
2555+
{
2556+
return None;
2557+
}
2558+
hir::GenericArg::Const(ct) => GenericArg::Const(Box::new(clean_const(ct, cx))),
2559+
hir::GenericArg::Infer(_inf) => GenericArg::Infer,
2560+
})
25512561
})
25522562
.collect::<Vec<_>>()
25532563
.into();

‎src/librustdoc/clean/types.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ impl WherePredicate {
13151315
pub(crate) enum GenericParamDefKind {
13161316
Lifetime { outlives: Vec<Lifetime> },
13171317
Type { did: DefId, bounds: Vec<GenericBound>, default: Option<Box<Type>>, synthetic: bool },
1318-
Const { ty: Box<Type>, default: Option<Box<String>> },
1318+
Const { ty: Box<Type>, default: Option<Box<String>>, is_host_effect: bool },
13191319
}
13201320

13211321
impl GenericParamDefKind {
@@ -1335,9 +1335,10 @@ impl GenericParamDef {
13351335
Self { name, kind: GenericParamDefKind::Lifetime { outlives: Vec::new() } }
13361336
}
13371337

1338-
pub(crate) fn is_synthetic_type_param(&self) -> bool {
1338+
pub(crate) fn is_synthetic_param(&self) -> bool {
13391339
match self.kind {
1340-
GenericParamDefKind::Lifetime { .. } | GenericParamDefKind::Const { .. } => false,
1340+
GenericParamDefKind::Lifetime { .. } => false,
1341+
GenericParamDefKind::Const { is_host_effect, .. } => is_host_effect,
13411342
GenericParamDefKind::Type { synthetic, .. } => synthetic,
13421343
}
13431344
}

‎src/librustdoc/clean/utils.rs

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ pub(crate) fn ty_args_to_args<'tcx>(
104104
arg: index,
105105
}),
106106
))),
107+
// FIXME(effects): this relies on the host effect being called `host`, which users could also name
108+
// their const generics.
109+
// FIXME(effects): this causes `host = true` and `host = false` generics to also be emitted.
110+
GenericArgKind::Const(ct) if let ty::ConstKind::Param(p) = ct.kind() && p.name == sym::host => None,
107111
GenericArgKind::Const(ct) => {
108112
Some(GenericArg::Const(Box::new(clean_middle_const(kind.rebind(ct), cx))))
109113
}

‎src/librustdoc/html/format.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ impl clean::Generics {
250250
cx: &'a Context<'tcx>,
251251
) -> impl fmt::Display + 'a + Captures<'tcx> {
252252
display_fn(move |f| {
253-
let mut real_params =
254-
self.params.iter().filter(|p| !p.is_synthetic_type_param()).peekable();
253+
let mut real_params = self.params.iter().filter(|p| !p.is_synthetic_param()).peekable();
255254
if real_params.peek().is_none() {
256255
return Ok(());
257256
}

‎src/librustdoc/json/conversions.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
453453
default: default.map(|x| (*x).into_tcx(tcx)),
454454
synthetic,
455455
},
456-
Const { ty, default } => GenericParamDefKind::Const {
456+
Const { ty, default, is_host_effect: _ } => GenericParamDefKind::Const {
457457
type_: (*ty).into_tcx(tcx),
458458
default: default.map(|x| *x),
459459
},
@@ -491,12 +491,14 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
491491
default: default.map(|ty| (*ty).into_tcx(tcx)),
492492
synthetic,
493493
},
494-
clean::GenericParamDefKind::Const { ty, default } => {
495-
GenericParamDefKind::Const {
496-
type_: (*ty).into_tcx(tcx),
497-
default: default.map(|d| *d),
498-
}
499-
}
494+
clean::GenericParamDefKind::Const {
495+
ty,
496+
default,
497+
is_host_effect: _,
498+
} => GenericParamDefKind::Const {
499+
type_: (*ty).into_tcx(tcx),
500+
default: default.map(|d| *d),
501+
},
500502
};
501503
GenericParamDef { name, kind }
502504
})

‎src/librustdoc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![feature(array_methods)]
77
#![feature(assert_matches)]
88
#![feature(box_patterns)]
9+
#![feature(if_let_guard)]
910
#![feature(impl_trait_in_assoc_type)]
1011
#![feature(iter_intersperse)]
1112
#![feature(lazy_cell)]

‎src/llvm-project

Submodule llvm-project updated 60 files

‎src/stage0.json

+275-374
Large diffs are not rendered by default.

‎tests/rustdoc/const-effect-param.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![crate_name = "foo"]
2+
#![feature(effects, const_trait_impl)]
3+
4+
#[const_trait]
5+
pub trait Tr {
6+
fn f();
7+
}
8+
9+
// @has foo/fn.g.html
10+
// @has - '//pre[@class="rust item-decl"]' 'pub const fn g<T: Tr>()'
11+
/// foo
12+
pub const fn g<T: ~const Tr>() {}

‎tests/rustdoc/const-fn-effects.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![crate_name = "foo"]
2+
#![feature(effects)]
3+
4+
// @has foo/fn.bar.html
5+
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
6+
/// foo
7+
pub const fn bar() -> usize {
8+
2
9+
}
10+
11+
// @has foo/struct.Foo.html
12+
// @has - '//*[@class="method"]' 'const fn new()'
13+
pub struct Foo(usize);
14+
15+
impl Foo {
16+
pub const fn new() -> Foo {
17+
Foo(0)
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![feature(effects)]
2+
3+
pub const fn load() -> i32 {
4+
0
5+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Regression test for issue #116629.
2+
// Check that we render the correct generic params of const fn
3+
4+
// aux-crate:const_fn=const-fn.rs
5+
// edition: 2021
6+
#![crate_name = "user"]
7+
8+
// @has user/fn.load.html
9+
// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32"
10+
pub use const_fn::load;

‎tests/ui/consts/effect_param.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Ensure we don't allow accessing const effect parameters from stable Rust.
2+
3+
fn main() {
4+
i8::checked_sub::<true>(42, 43);
5+
//~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
6+
}
7+
8+
const FOO: () = {
9+
i8::checked_sub::<false>(42, 43);
10+
//~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
11+
};

‎tests/ui/consts/effect_param.stderr

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
2+
--> $DIR/effect_param.rs:9:9
3+
|
4+
LL | i8::checked_sub::<false>(42, 43);
5+
| ^^^^^^^^^^^--------- help: remove these generics
6+
| |
7+
| expected 0 generic arguments
8+
9+
error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
10+
--> $DIR/effect_param.rs:4:9
11+
|
12+
LL | i8::checked_sub::<true>(42, 43);
13+
| ^^^^^^^^^^^-------- help: remove these generics
14+
| |
15+
| expected 0 generic arguments
16+
17+
error: aborting due to 2 previous errors
18+
19+
For more information about this error, try `rustc --explain E0107`.

‎tests/ui/impl-trait/async_scope_creep.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![feature(type_alias_impl_trait)]
22
// edition:2021
3-
//[rpit] check-pass
4-
// revisions: tait rpit
3+
// check-pass
54

65
struct Pending {}
76

@@ -13,23 +12,15 @@ impl AsyncRead for i32 {}
1312

1413
type PendingReader<'a> = impl AsyncRead + 'a;
1514

16-
#[cfg(tait)]
17-
type OpeningReadFuture<'a> = impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
15+
type OpeningReadFuture<'a> =
16+
impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
1817

1918
impl Pending {
2019
async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
2120
Ok(42)
2221
}
2322

24-
#[cfg(tait)]
2523
fn read_fut(&mut self) -> OpeningReadFuture<'_> {
26-
self.read() //[tait]~ ERROR: cannot satisfy `impl AsyncRead + 'a == PendingReader<'a>`
27-
}
28-
29-
#[cfg(rpit)]
30-
fn read_fut(
31-
&mut self,
32-
) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
3324
self.read()
3425
}
3526
}

‎tests/ui/impl-trait/async_scope_creep.tait.stderr

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
2+
3+
error: internal compiler error: {OpaqueTypeKey { def_id: DefId(rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }) } }}
4+
|
5+
=
6+
7+
8+
error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(foo::{opaque#0}) }))), bound_vars: [] } } }
9+
--> $DIR/equality-in-canonical-query.rs:19:5
10+
|
11+
LL | same_output(foo, rpit);
12+
| ^^^^^^^^^^^^^^^^^^^^^^
13+
|
14+
15+
--> $DIR/equality-in-canonical-query.rs:19:5
16+
|
17+
LL | same_output(foo, rpit);
18+
| ^^^^^^^^^^^^^^^^^^^^^^
19+
20+
21+
22+
23+
24+
25+
26+
query stack during panic:
27+
end of query stack
28+
error: aborting due to 3 previous errors
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// issue: #116877
2+
// revisions: sized clone
3+
//[sized] check-pass
4+
5+
//[clone] known-bug: #108498
6+
//[clone] failure-status: 101
7+
//[clone] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
8+
//[clone] normalize-stderr-test: "(?m)note: .*$" -> ""
9+
//[clone] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
10+
//[clone] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
11+
12+
#[cfg(sized)] fn rpit() -> impl Sized {}
13+
#[cfg(clone)] fn rpit() -> impl Clone {}
14+
15+
fn same_output<Out>(_: impl Fn() -> Out, _: impl Fn() -> Out) {}
16+
17+
pub fn foo() -> impl Sized {
18+
same_output(rpit, foo);
19+
same_output(foo, rpit);
20+
rpit()
21+
}
22+
23+
fn main () {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#[repr(C, Rust)] //~ ERROR conflicting representation hints
2+
struct S {
3+
a: i32,
4+
}
5+
6+
7+
#[repr(Rust)] //~ ERROR conflicting representation hints
8+
#[repr(C)]
9+
struct T {
10+
a: i32,
11+
}
12+
13+
#[repr(Rust, u64)] //~ ERROR conflicting representation hints
14+
enum U {
15+
V,
16+
}
17+
18+
#[repr(Rust, simd)]
19+
//~^ ERROR conflicting representation hints
20+
//~| ERROR SIMD types are experimental and possibly buggy
21+
struct F32x4(f32, f32, f32, f32);
22+
23+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error[E0658]: SIMD types are experimental and possibly buggy
2+
--> $DIR/explicit-rust-repr-conflicts.rs:18:1
3+
|
4+
LL | #[repr(Rust, simd)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information
8+
= help: add `#![feature(repr_simd)]` to the crate attributes to enable
9+
10+
error[E0566]: conflicting representation hints
11+
--> $DIR/explicit-rust-repr-conflicts.rs:1:8
12+
|
13+
LL | #[repr(C, Rust)]
14+
| ^ ^^^^
15+
16+
error[E0566]: conflicting representation hints
17+
--> $DIR/explicit-rust-repr-conflicts.rs:7:8
18+
|
19+
LL | #[repr(Rust)]
20+
| ^^^^
21+
LL | #[repr(C)]
22+
| ^
23+
24+
error[E0566]: conflicting representation hints
25+
--> $DIR/explicit-rust-repr-conflicts.rs:13:8
26+
|
27+
LL | #[repr(Rust, u64)]
28+
| ^^^^ ^^^
29+
30+
error[E0566]: conflicting representation hints
31+
--> $DIR/explicit-rust-repr-conflicts.rs:18:8
32+
|
33+
LL | #[repr(Rust, simd)]
34+
| ^^^^ ^^^^
35+
36+
error: aborting due to 5 previous errors
37+
38+
Some errors have detailed explanations: E0566, E0658.
39+
For more information about an error, try `rustc --explain E0566`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
2+
3+
error: internal compiler error: {OpaqueTypeKey { def_id: DefId(get_rpit::{opaque#0}), args: [] }: OpaqueTypeDecl { hidden_type: OpaqueHiddenType { span: no-location (#0), ty: Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }) } }}
4+
|
5+
=
6+
7+
8+
error: internal compiler error: error performing ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: ProvePredicate { predicate: Binder { value: ProjectionPredicate(AliasTy { args: [FnDef(DefId(get_rpit), []), ()], def_id: DefId(ops::function::FnOnce::Output) }, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(Opaque::{opaque#0}) }))), bound_vars: [] } } }
9+
--> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
10+
|
11+
LL | query(get_rpit);
12+
| ^^^^^^^^^^^^^^^
13+
|
14+
15+
--> $DIR/rpit_tait_equality_in_canonical_query.rs:28:5
16+
|
17+
LL | query(get_rpit);
18+
| ^^^^^^^^^^^^^^^
19+
20+
21+
22+
23+
24+
25+
26+
query stack during panic:
27+
end of query stack
28+
error: aborting due to 3 previous errors
29+

‎tests/ui/type-alias-impl-trait/rpit_tait_equality_in_canonical_query.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
88
// revisions: current next
99
//[next] compile-flags: -Ztrait-solver=next
10-
// check-pass
10+
//[next] check-pass
11+
12+
//[current] known-bug: #108498
13+
//[current] failure-status: 101
14+
//[current] normalize-stderr-test: "DefId\(.*?\]::" -> "DefId("
15+
//[current] normalize-stderr-test: "(?m)note: .*$" -> ""
16+
//[current] normalize-stderr-test: "(?m)^ *\d+: .*\n" -> ""
17+
//[current] normalize-stderr-test: "(?m)^ *at .*\n" -> ""
1118

1219
#![feature(type_alias_impl_trait)]
1320

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// The canonical query `Projection(<get_rpit as FnOnce>::Output = Opaque)`
2+
// is the *only* site that defines `Opaque` in MIR typeck.
3+
//
4+
// check-pass
5+
6+
#![feature(type_alias_impl_trait)]
7+
8+
type Opaque = impl Sized;
9+
10+
fn get_rpit() -> impl Sized {}
11+
12+
fn query(_: impl FnOnce() -> Opaque) {}
13+
14+
fn test(_: Opaque) {
15+
query(get_rpit);
16+
}
17+
18+
fn main() {}

0 commit comments

Comments
 (0)
Please sign in to comment.