Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subtree-push nightly-2024-12-02 #6412

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

ytmimi
Copy link
Contributor

@ytmimi ytmimi commented Dec 2, 2024

Bumping the toolchain version as part of a git subtree push

current toolchain (nightly-2024-09-10):

  • 1.83.0-nightly (c2f74c3f9 2024-09-09)

latest toolchain (nightly-2024-12-02):

  • 1.85.0-nightly (5e1440ae5 2024-12-01)

r? @calebcartwright

Here's the link to the Diff Check Job

Edit: Job Failed, but those failures were expected. See details about the failures below.

ytmimi and others added 26 commits September 19, 2024 21:46
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
- fix for divergence
- fix error message
- fix another cranelift test
- fix some cranelift things
- don't set the NORETURN option for naked asm
- fix use of naked_asm! in doc comment
- fix use of naked_asm! in run-make test
- use `span_bug` in unreachable branch
…emlnner, r=nnethercote

Rename `NestedMetaItem` to `MetaItemInner`

Fixes #131087

r? `@nnethercote`
Avoid `&Lrc<T>` in various places

Seeing `&Lrc<T>` is a bit suspicious, and `&T` or `Lrc<T>` is often better.

r? `@oli-obk`
Rollup of 4 pull requests

Successful merges:

 - #131331 (Revert "warn_old_master_branch" check)
 - #131344 (Avoid `&Lrc<T>` in various places)
 - #131346 (Restrict `ignore-mode-*` directives)
 - #131353 (Add documentation for `runtest::check_rustdoc_test_option` method)

r? `@ghost`
`@rustbot` modify labels: rollup
…eywiser

Retire the `unnamed_fields` feature for now

`#![feature(unnamed_fields)]` was implemented in part in #115131 and #115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature.

However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly.

Fixes #117942
Fixes #121161
Fixes #121263
Fixes #121299
Fixes #121722
Fixes #121799
Fixes #126969
Fixes #131041

Tracking:
* rust-lang/rust#49804

[^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields
[^2]: rust-lang/rust#49804 (comment)
Add `&pin (mut|const) T` type position sugar

This adds parser support for `&pin mut T` and `&pin const T` references. These are desugared to `Pin<&mut T>` and `Pin<&T>` in the AST lowering phases.

This PR currently includes #130526 since that one is in the commit queue. Only the most recent commits (bd450027eb4a94b814a7dd9c0fa29102e6361149 and following) are new.

Tracking:

- #130494

r? `@compiler-errors`
Rollup of 9 pull requests

Successful merges:

 - #122670 (Fix bug where `option_env!` would return `None` when env var is present but not valid Unicode)
 - #131095 (Use environment variables instead of command line arguments for merged doctests)
 - #131339 (Expand set_ptr_value / with_metadata_of docs)
 - #131652 (Move polarity into `PolyTraitRef` rather than storing it on the side)
 - #131675 (Update lint message for ABI not supported)
 - #131681 (Fix up-to-date checking for run-make tests)
 - #131702 (Suppress import errors for traits that couldve applied for method lookup error)
 - #131703 (Resolved python deprecation warning in publish_toolstate.py)
 - #131710 (Remove `'apostrophes'` from `rustc_parse_format`)

r? `@ghost`
`@rustbot` modify labels: rollup
It's not used meaningfully yet, but will be needed to get rid of
interpolated tokens.
@ytmimi
Copy link
Contributor Author

ytmimi commented Dec 2, 2024

There were formatting difference in the diff-check related to nightly formatting implemented in the compiler.

  • #![feature(pin_ergonomics)] 44788b8
  • #![feature(generic_const_items)] d03d338:
  • #![feature(unsafe_fields)] b116480

#![feature(pin_ergonomics)] 44788b8

Details

Input

#![feature(pin_ergonomics)]
#![allow(incomplete_features)]

fn f(x: &pin  const i32) {}
fn g<'a>(x: &  'a pin const  i32) {}
fn h<'a>(x: &  'a pin  
mut i32) {}
fn i(x: &pin      mut  i32) {}

Output (master rustfmt)

Parse Errors
error: expected identifier, found keyword `const`
 --> <stdin>:4:15
  |
4 | fn f(x: &pin  const i32) {}
  |               ^^^^^ expected identifier, found keyword

error: expected one of `:` or `|`, found `i32`
 --> <stdin>:4:21
  |
4 | fn f(x: &pin  const i32) {}
  |                     ^^^
  |                     |
  |                     expected one of `:` or `|`
  |                     help: declare the type after the parameter binding: `<identifier>: <type>`

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found keyword `const`
 --> <stdin>:4:15
  |
4 | fn f(x: &pin  const i32) {}
  |               ^^^^^ expected one of `!`, `(`, `)`, `,`, `::`, or `<`
  |
help: there is a keyword `in` with a similar name
  |
4 | fn f(x: &in  const i32) {}
  |          ~~
help: missing `,`
  |
4 | fn f(x: &pin,  const i32) {}
  |             +

error: expected identifier, found keyword `const`
 --> <stdin>:5:23
  |
5 | fn g<'a>(x: &  'a pin const  i32) {}
  |                       ^^^^^ expected identifier, found keyword

error: expected one of `:` or `|`, found `i32`
 --> <stdin>:5:30
  |
5 | fn g<'a>(x: &  'a pin const  i32) {}
  |                              ^^^
  |                              |
  |                              expected one of `:` or `|`
  |                              help: declare the type after the parameter binding: `<identifier>: <type>`

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found keyword `const`
 --> <stdin>:5:23
  |
5 | fn g<'a>(x: &  'a pin const  i32) {}
  |                       ^^^^^ expected one of `!`, `(`, `)`, `,`, `::`, or `<`
  |
help: there is a keyword `in` with a similar name
  |
5 | fn g<'a>(x: &  'a in const  i32) {}
  |                   ~~
help: missing `,`
  |
5 | fn g<'a>(x: &  'a pin, const  i32) {}
  |                      +

error: expected one of `:`, `@`, or `|`, found `)`
 --> <stdin>:7:8
  |
7 | mut i32) {}
  |        ^ expected one of `:`, `@`, or `|`
  |
  = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a parameter name, give it a type
  |
7 | mut i32: TypeName) {}
  |        ++++++++++
help: if this is a type, explicitly ignore the parameter name
  |
7 | _: mut i32) {}
  | ++

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found keyword `mut`
 --> <stdin>:7:1
  |
6 | fn h<'a>(x: &  'a pin  
  |                      - expected one of `!`, `(`, `)`, `,`, `::`, or `<`
7 | mut i32) {}
  | ^^^ unexpected token
  |
help: there is a keyword `in` with a similar name
  |
6 | fn h<'a>(x: &  'a in  
  |                   ~~
help: missing `,`
  |
6 | fn h<'a>(x: &  'a pin,  
  |                      +

error: expected one of `:`, `@`, or `|`, found `)`
 --> <stdin>:8:27
  |
8 | fn i(x: &pin      mut  i32) {}
  |                           ^ expected one of `:`, `@`, or `|`
  |
  = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a parameter name, give it a type
  |
8 | fn i(x: &pin      mut  i32: TypeName) {}
  |                           ++++++++++
help: if this is a type, explicitly ignore the parameter name
  |
8 | fn i(x: &pin      _: mut  i32) {}
  |                   ++

error: expected one of `!`, `(`, `)`, `,`, `::`, or `<`, found keyword `mut`
 --> <stdin>:8:19
  |
8 | fn i(x: &pin      mut  i32) {}
  |                   ^^^ expected one of `!`, `(`, `)`, `,`, `::`, or `<`
  |
help: there is a keyword `in` with a similar name
  |
8 | fn i(x: &in      mut  i32) {}
  |          ~~
help: missing `,`
  |
8 | fn i(x: &pin,      mut  i32) {}
  |             +

Output (subtree-push-nightly-2024-12-02 rustfmt)
Pin sugar formatted as expected

#![feature(pin_ergonomics)]
#![allow(incomplete_features)]

fn f(x: &pin const i32) {}
fn g<'a>(x: &'a pin const i32) {}
fn h<'a>(x: &'a pin mut i32) {}
fn i(x: &pin mut i32) {}

#![feature(generic_const_items)] Changes d03d338

Details

Input

#![feature(generic_const_items)]

const GENERIC<N, const M: usize>: i32 = 0;

const WHERECLAUSE: i32 = 0
where
    i32:;

trait Foo {
    const GENERIC<N, const M: usize>: i32;

    const WHERECLAUSE: i32
    where
        i32:;
}

impl Foo for () {
    const GENERIC<N, const M: usize>: i32 = 0;

    const WHERECLAUSE: i32 = 0
    where
        i32:;
}

Output (master rustfmt)
Drops the generics.

#![feature(generic_const_items)]

const GENERIC: i32 = 0;

const WHERECLAUSE: i32 = 0;

trait Foo {
    const GENERIC: i32;

    const WHERECLAUSE: i32;
}

impl Foo for () {
    const GENERIC: i32 = 0;

    const WHERECLAUSE: i32 = 0;
}

Output (subtree-push-nightly-2024-12-02 rustfmt)
Output left unchanged.

#![feature(generic_const_items)]

const GENERIC<N, const M: usize>: i32 = 0;

const WHERECLAUSE: i32 = 0
where
    i32:;

trait Foo {
    const GENERIC<N, const M: usize>: i32;

    const WHERECLAUSE: i32
    where
        i32:;
}

impl Foo for () {
    const GENERIC<N, const M: usize>: i32 = 0;

    const WHERECLAUSE: i32 = 0
    where
        i32:;
}

#![feature(unsafe_fields)] Changes b116480

Details

Input

struct Foo {
    unsafe
    field: (),
}

enum Bar {
    Variant {
        unsafe
        field: (),
    },
}

union Baz {
    unsafe
    field: (),
}

Output (master rustfmt)

Parse Errors
error: expected identifier, found keyword `unsafe`
 --> <stdin>:2:5
  |
1 | struct Foo {
  |        --- while parsing this struct
2 |     unsafe
  |     ^^^^^^ expected identifier, found keyword

error: expected identifier, found keyword `unsafe`
 --> <stdin>:8:9
  |
7 |     Variant {
  |     ------- while parsing this struct
8 |         unsafe
  |         ^^^^^^ expected identifier, found keyword

error: expected identifier, found keyword `unsafe`
  --> <stdin>:14:5
   |
13 | union Baz {
   |       --- while parsing this union
14 |     unsafe
   |     ^^^^^^ expected identifier, found keyword

Output (subtree-push-nightly-2024-12-02 rustfmt)
Formats structs using unsafe fields as expected.

struct Foo {
    unsafe field: (),
}

enum Bar {
    Variant { unsafe field: () },
}

union Baz {
    unsafe field: (),
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.