Skip to content

Commit

Permalink
Auto merge of rust-lang#125529 - cuviper:beta-next, r=cuviper
Browse files Browse the repository at this point in the history
[beta] backports

- Add `#[inline]` to float `Debug` fallback used by `cfg(no_fp_fmt_parse)` rust-lang#125252
- Add v0 symbol mangling for `f16` and `f128` rust-lang#123816
- Only make GAT ambiguous in `match_projection_projections` considering shallow resolvability rust-lang#125214
- Update to LLVM 18.1.6 rust-lang#125288

r? cuviper
  • Loading branch information
bors committed May 25, 2024
2 parents 66eb3e4 + 16f4a2b commit d9e85b5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/18.0-2024-02-13
branch = rustc/18.1-2024-05-19
shallow = true
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,10 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
ty::Uint(UintTy::U64) => "y",
ty::Uint(UintTy::U128) => "o",
ty::Uint(UintTy::Usize) => "j",
// FIXME(f16_f128): update these once `rustc-demangle` supports the new types
ty::Float(FloatTy::F16) => unimplemented!("f16_f128"),
ty::Float(FloatTy::F16) => "C3f16",
ty::Float(FloatTy::F32) => "f",
ty::Float(FloatTy::F64) => "d",
ty::Float(FloatTy::F128) => unimplemented!("f16_f128"),
ty::Float(FloatTy::F128) => "C4f128",
ty::Never => "z",

// Placeholders (should be demangled as `_`).
Expand Down
12 changes: 11 additions & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1777,9 +1777,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// If this type is a GAT, and of the GAT args resolve to something new,
// that means that we must have newly inferred something about the GAT.
// We should give up in that case.
// FIXME(generic-associated-types): This only detects one layer of inference,
// which is probably not what we actually want, but fixing it causes some ambiguity:
// <https://github.com/rust-lang/rust/issues/125196>.
if !generics.params.is_empty()
&& obligation.predicate.args[generics.parent_count..].iter().any(|&p| {
p.has_non_region_infer() && self.infcx.resolve_vars_if_possible(p) != p
p.has_non_region_infer()
&& match p.unpack() {
ty::GenericArgKind::Const(ct) => {
self.infcx.shallow_resolve_const(ct) != ct
}
ty::GenericArgKind::Type(ty) => self.infcx.shallow_resolve(ty) != ty,
ty::GenericArgKind::Lifetime(_) => false,
}
})
{
ProjectionMatchesProjection::Ambiguous
Expand Down
1 change: 1 addition & 0 deletions library/core/src/fmt/nofloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ macro_rules! floating {
($ty:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl Debug for $ty {
#[inline]
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result {
panic!("floating point support is turned off");
}
Expand Down
2 changes: 2 additions & 0 deletions src/doc/rustc/src/symbol-mangling/v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ The type encodings based on the initial tag character are:
* `z` — `!`
* `p` — [placeholder] `_`
Remaining primitives are encoded as a crate production, e.g. `C4f128`.
* `A` — An [array][reference-array] `[T; N]`.
> <span id="array-type">array-type</span> → `A` *[type]* *[const]*
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 159 files
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Fix for <https://github.com/rust-lang/rust/issues/125196>.
//@ check-pass

trait Tr {
type Gat<T>;
}

struct W<T>(T);

fn foo<T: Tr>() where for<'a> &'a T: Tr<Gat<W<i32>> = i32> {
let x: <&T as Tr>::Gat<W<_>> = 1i32;
// Previously, `match_projection_projections` only checked that
// `shallow_resolve(W<?0>) = W<?0>`. This won't prevent *all* inference guidance
// from projection predicates in the environment, just ones that guide the
// outermost type of each GAT constructor. This is definitely wrong, but there is
// code that relies on it in the wild :/
}

fn main() {}

0 comments on commit d9e85b5

Please sign in to comment.