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

Rollup of 7 pull requests #112696

Closed
wants to merge 17 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 17 commits June 7, 2023 18:18
It fixes the following error:
error[E0412]: cannot find type `sockcred2` in module `libc`
   --> library/std/src/os/unix/net/ancillary.rs:211:29
    |
211 | pub struct SocketCred(libc::sockcred2);
    |                             ^^^^^^^^^ not found in `libc`
The other major steps in `partition` have their own function, so it's
nice for this one to be likewise.
The comment says "Find the smallest CGU that has exported symbols and
put the dead function stubs in that CGU". But the code sorts the CGUs by
size (smallest first) and then searches them in reverse order, which
means it will find the *largest* CGU that has exported symbols.

The erroneous code was introduced in rust-lang#92142.

This commit changes it to use a simpler search, avoiding the sort, and
fixes the bug in the process.
Always put the `create_size_estimate` calls and `debug_dump` calls
within a timed scopes. This makes the four main steps look more similar
to each other.
…rrors

fix: inline `predicate_may_hold_fatal` and remove expect call in it

- Fixes rust-lang#105231
- Discussion: rust-lang#111985 (comment)

r? `@compiler-errors`
…t-universe, r=lcnr

Instantiate closure synthetic substs in root universe

In the UI test example, we end up generalizing an associated type (something like `<Map<Option<i32>, [closure upvars=?0]> as IntoIterator>::Item` generalizes into `<Map<Option<i32>, [closure upvars=?1]> as IntoIterator>::Item`) then assigning it to itself, emitting an alias-relate goal. This trivially holds via one of the normalizes-to candidates, instead of relating substs, so when closure analysis eventually sets `?0` to the actual upvars, `?1` never gets constrained. This ends up being reported as an ambiguity error during writeback.

Instead, we can take advantage of the fact that we *know* the closure substs live in the root universe. This will prevent them being generalized, since they always can be named, and the alias-relate above never gets emitted at all.

We can probably do this to a handful of other `next_ty_var` calls in typeck for variables that are clearly associated with the body of the program, but I wanted to limit this for now. Eventually, if we end up representing universes more faithfully like a tree or whatever, we can remove this and turn it back to just a call to `next_ty_var`.

Note: This is incredibly order-dependent -- we need to be assigning a type variable that was created *before* the closure substs, and we also need to actually have an unnormalized type at the time of the assignment. This currently seems easiest to trigger during call argument analysis just due to the fact that we instantiate the call's substs, normalize, THEN check args.

r? ``@lcnr``
…unistically-resolve-regions, r=lcnr

Opportunistically resolve regions in new solver

Use `opportunistic_resolve_var` during canonicalization to collapse some regions.

We have to start using `CanonicalVarValues::is_identity_modulo_regions`. We also have to modify that function to consider responses like `['static, ^0, '^1, ^2]` to be an "identity" response, since because we opportunistically resolve regions, there's no longer a 1:1 mapping between canonical var values and bound var indices in the response...

There's one nasty side-effect -- one test (`tests/ui/dyn-star/param-env-infer.rs`) starts to ICE because the certainty goes from `Yes` to `Maybe(Overflow)`... Not exactly sure why, though? Putting this up for discussion/investigation.

r? ``@lcnr``
reorder attributes to make miri-test-libstd work again

Fixes fallout from rust-lang#110141
Fix building libstd documentation on FreeBSD.

It fixes the following error:
```
error[E0412]: cannot find type `sockcred2` in module `libc`
   --> library/std/src/os/unix/net/ancillary.rs:211:29
    |
211 | pub struct SocketCred(libc::sockcred2);
    |                             ^^^^^^^^^ not found in `libc`
```
…esleywiser

Fix `dead_code_cgu` computation

This PR fixes a bug in `dead_code_cgu` computation, and also does some refactoring.

r? ``@wesleywiser``
…ompiler-errors

fix ICE on specific malformed asm clobber_abi

fixes rust-lang#112635
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) rollup A PR which is a rollup labels Jun 16, 2023
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jun 16, 2023

📌 Commit d2836a4 has been approved by Dylan-DPC

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 16, 2023
@bors
Copy link
Contributor

bors commented Jun 16, 2023

⌛ Testing commit d2836a4 with merge 5cdf5ef969d97a333280a0a25643a18a1bbbcfc7...

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [ui] tests/ui/asm/parse-error.rs stdout ----
diff of stderr:

448 LL |         asm!("{1}", in("eax") foo, const bar);
449    |                                          ^^^ non-constant value
- error: aborting due to 68 previous errors
- error: aborting due to 68 previous errors
+ error: invalid register `eax`: unknown register
+    |
+    |
+ LL |         asm!("", a = in("eax") foo);
+ 
+ 
+ error: invalid register `eax`: unknown register
+    |
+    |
+ LL |         asm!("{a}", in("eax") foo, a = const bar);
+ 
+ 
+ error: invalid register `eax`: unknown register
+    |
+    |
+ LL |         asm!("{a}", in("eax") foo, a = const bar);
+ 
+ 
+ error: invalid register `eax`: unknown register
+    |
+    |
+ LL |         asm!("{1}", in("eax") foo, const bar);
+ 
+ error: aborting due to 72 previous errors
452 
453 For more information about this error, try `rustc --explain E0435`.
---
To only update this specific test, also pass `--test-args asm/parse-error.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/asm/parse-error.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/asm/parse-error" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/asm/parse-error/auxiliary"
stdout: none
error: requires at least a template string argument
  --> fake-test-src-base/asm/parse-error.rs:11:9
   |
LL |         asm!();
---
   |
LL |         asm!("{}" foo);
   |                   ^^^ expected `,`

error: expected operand, clobber_abi, options, or additional template string
  --> fake-test-src-base/asm/parse-error.rs:17:20
LL |         asm!("{}", foo);
LL |         asm!("{}", foo);
   |                    ^^^ expected operand, clobber_abi, options, or additional template string
error: expected `(`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:19:23
   |
LL |         asm!("{}", in foo);
LL |         asm!("{}", in foo);
   |                       ^^^ expected `(`

error: expected `)`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:21:27
   |
LL |         asm!("{}", in(reg foo));
   |                           ^^^ expected `)`
error: expected expression, found end of macro arguments
  --> fake-test-src-base/asm/parse-error.rs:23:27
   |
   |
LL |         asm!("{}", in(reg));

error: expected register class or explicit register
  --> fake-test-src-base/asm/parse-error.rs:25:26
   |
   |
LL |         asm!("{}", inout(=) foo => bar);

error: expected expression, found end of macro arguments
  --> fake-test-src-base/asm/parse-error.rs:27:37
   |
   |
LL |         asm!("{}", inout(reg) foo =>);


error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>`
  --> fake-test-src-base/asm/parse-error.rs:29:32
   |
LL |         asm!("{}", in(reg) foo => bar);
   |                                ^^ expected one of 7 possible tokens
error: expected a path for argument to `sym`
  --> fake-test-src-base/asm/parse-error.rs:31:24
   |
   |
LL |         asm!("{}", sym foo + bar);


error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:33:26
   |
LL |         asm!("", options(foo));
   |                          ^^^ expected one of 10 possible tokens

error: expected one of `)` or `,`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:35:32
   |
LL |         asm!("", options(nomem foo));
   |                                ^^^ expected one of `)` or `,`

error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:37:33
   |
LL |         asm!("", options(nomem, foo));
   |                                 ^^^ expected one of 10 possible tokens

error: at least one abi must be provided as an argument to `clobber_abi`
  --> fake-test-src-base/asm/parse-error.rs:44:30
   |
LL |         asm!("", clobber_abi());

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:46:30
   |
   |
LL |         asm!("", clobber_abi(foo));


error: expected one of `)` or `,`, found `foo`
  --> fake-test-src-base/asm/parse-error.rs:48:34
   |
LL |         asm!("", clobber_abi("C" foo));
   |                                  ^^^ expected one of `)` or `,`
error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:50:35
   |
   |
LL |         asm!("", clobber_abi("C", foo));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:52:30
   |
   |
LL |         asm!("", clobber_abi(1));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:54:30
   |
   |
LL |         asm!("", clobber_abi(()));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:56:30
   |
   |
LL |         asm!("", clobber_abi(uwu));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:58:30
   |
   |
LL |         asm!("", clobber_abi({}));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:60:30
   |
   |
LL |         asm!("", clobber_abi(loop {}));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:62:30
   |
   |
LL |         asm!("", clobber_abi(if));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:64:30
   |
   |
LL |         asm!("", clobber_abi(do));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:66:30
   |
   |
LL |         asm!("", clobber_abi(<));

error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:68:30
   |
   |
LL |         asm!("", clobber_abi(.));

error: duplicate argument named `a`
  --> fake-test-src-base/asm/parse-error.rs:76:36
   |
   |
LL |         asm!("{a}", a = const foo, a = const bar);
   |                     -------------  ^^^^^^^^^^^^^ duplicate argument
   |                     previously here

error: argument never used
  --> fake-test-src-base/asm/parse-error.rs:76:36
  --> fake-test-src-base/asm/parse-error.rs:76:36
   |
LL |         asm!("{a}", a = const foo, a = const bar);
   |                                    ^^^^^^^^^^^^^ argument never used
   |
   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"`
error: explicit register arguments cannot have names
  --> fake-test-src-base/asm/parse-error.rs:81:18
   |
   |
LL |         asm!("", a = in("eax") foo);

error: positional arguments cannot follow named arguments or explicit register arguments
  --> fake-test-src-base/asm/parse-error.rs:87:36
   |
   |
LL |         asm!("{1}", in("eax") foo, const bar);
   |                     -------------  ^^^^^^^^^ positional argument
   |                     explicit register argument


error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `lateout`, `options`, `out`, or `sym`, found `""`
  --> fake-test-src-base/asm/parse-error.rs:90:29
   |
LL |         asm!("", options(), "");
   |                             ^^ expected one of 9 possible tokens

error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `lateout`, `options`, `out`, or `sym`, found `"{}"`
  --> fake-test-src-base/asm/parse-error.rs:92:33
   |
LL |         asm!("{}", in(reg) foo, "{}", out(reg) foo);
   |                                 ^^^^ expected one of 9 possible tokens
error: asm template must be a string literal
  --> fake-test-src-base/asm/parse-error.rs:94:14
   |
   |
LL |         asm!(format!("{{{}}}", 0), in(reg) foo);
   |
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: asm template must be a string literal
error: asm template must be a string literal
  --> fake-test-src-base/asm/parse-error.rs:96:21
   |
LL |         asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
   |
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)


error: _ cannot be used for input operands
  --> fake-test-src-base/asm/parse-error.rs:98:28
   |
LL |         asm!("{}", in(reg) _);


error: _ cannot be used for input operands
  --> fake-test-src-base/asm/parse-error.rs:100:31
   |
LL |         asm!("{}", inout(reg) _);


error: _ cannot be used for input operands
  --> fake-test-src-base/asm/parse-error.rs:102:35
   |
LL |         asm!("{}", inlateout(reg) _);

error: requires at least a template string argument
  --> fake-test-src-base/asm/parse-error.rs:109:1
   |
   |
LL | global_asm!();

error: asm template must be a string literal
  --> fake-test-src-base/asm/parse-error.rs:111:13
   |
   |
LL | global_asm!(FOO);

error: expected token: `,`
  --> fake-test-src-base/asm/parse-error.rs:113:18
   |
   |
LL | global_asm!("{}" FOO);
   |                  ^^^ expected `,`
error: expected operand, options, or additional template string
  --> fake-test-src-base/asm/parse-error.rs:115:19
   |
   |
LL | global_asm!("{}", FOO);
   |                   ^^^ expected operand, options, or additional template string
error: expected expression, found end of macro arguments
  --> fake-test-src-base/asm/parse-error.rs:117:24
   |
   |
LL | global_asm!("{}", const);


error: expected one of `,`, `.`, `?`, or an operator, found `FOO`
  --> fake-test-src-base/asm/parse-error.rs:119:30
   |
LL | global_asm!("{}", const(reg) FOO);
   |                              ^^^ expected one of `,`, `.`, `?`, or an operator

error: expected one of `)`, `att_syntax`, or `raw`, found `FOO`
  --> fake-test-src-base/asm/parse-error.rs:121:25
   |
LL | global_asm!("", options(FOO));
   |                         ^^^ expected one of `)`, `att_syntax`, or `raw`

error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
  --> fake-test-src-base/asm/parse-error.rs:123:25
   |
LL | global_asm!("", options(nomem FOO));
   |                         ^^^^^ expected one of `)`, `att_syntax`, or `raw`

error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
  --> fake-test-src-base/asm/parse-error.rs:125:25
   |
LL | global_asm!("", options(nomem, FOO));
   |                         ^^^^^ expected one of `)`, `att_syntax`, or `raw`
error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:128:29
   |
   |
LL | global_asm!("", clobber_abi(FOO));


error: expected one of `)` or `,`, found `FOO`
  --> fake-test-src-base/asm/parse-error.rs:130:33
   |
LL | global_asm!("", clobber_abi("C" FOO));
   |                                 ^^^ expected one of `)` or `,`
error: expected string literal
  --> fake-test-src-base/asm/parse-error.rs:132:34
   |
   |
LL | global_asm!("", clobber_abi("C", FOO));


error: `clobber_abi` cannot be used with `global_asm!`
  --> fake-test-src-base/asm/parse-error.rs:134:19
   |
LL | global_asm!("{}", clobber_abi("C"), const FOO);


error: `clobber_abi` cannot be used with `global_asm!`
  --> fake-test-src-base/asm/parse-error.rs:136:28
   |
LL | global_asm!("", options(), clobber_abi("C"));


error: `clobber_abi` cannot be used with `global_asm!`
  --> fake-test-src-base/asm/parse-error.rs:138:30
   |
LL | global_asm!("{}", options(), clobber_abi("C"), const FOO);


error: `clobber_abi` cannot be used with `global_asm!`
  --> fake-test-src-base/asm/parse-error.rs:140:17
   |
LL | global_asm!("", clobber_abi("C"), clobber_abi("C"));

error: duplicate argument named `a`
  --> fake-test-src-base/asm/parse-error.rs:142:35
   |
   |
LL | global_asm!("{a}", a = const FOO, a = const BAR);
   |                    -------------  ^^^^^^^^^^^^^ duplicate argument
   |                    previously here

error: argument never used
  --> fake-test-src-base/asm/parse-error.rs:142:35
  --> fake-test-src-base/asm/parse-error.rs:142:35
   |
LL | global_asm!("{a}", a = const FOO, a = const BAR);
   |                                   ^^^^^^^^^^^^^ argument never used
   |
   = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"`

error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `""`
  --> fake-test-src-base/asm/parse-error.rs:145:28
   |
LL | global_asm!("", options(), "");
   |                            ^^ expected one of `clobber_abi`, `const`, `options`, or `sym`

error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `"{}"`
  --> fake-test-src-base/asm/parse-error.rs:147:30
   |
LL | global_asm!("{}", const FOO, "{}", const FOO);
   |                              ^^^^ expected one of `clobber_abi`, `const`, `options`, or `sym`
error: asm template must be a string literal
  --> fake-test-src-base/asm/parse-error.rs:149:13
   |
   |
LL | global_asm!(format!("{{{}}}", 0), const FOO);
   |
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error: asm template must be a string literal
error: asm template must be a string literal
  --> fake-test-src-base/asm/parse-error.rs:151:20
   |
LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
   |
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0435]: attempt to use a non-constant value in a constant
---
   |
LL |     let mut foo = 0;
   |     ----------- help: consider using `const` instead of `let`: `const foo`
...
LL |         asm!("{}", clobber_abi("C"), const foo);
   |                                            ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:74:55
   |
LL |     let mut foo = 0;
LL |     let mut foo = 0;
   |     ----------- help: consider using `const` instead of `let`: `const foo`
...
LL |         asm!("{}", options(), clobber_abi("C"), const foo);
   |                                                       ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:76:31
   |
LL |     let mut foo = 0;
LL |     let mut foo = 0;
   |     ----------- help: consider using `const` instead of `let`: `const foo`
...
LL |         asm!("{a}", a = const foo, a = const bar);
   |                               ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:76:46
   |
LL |     let mut bar = 0;
LL |     let mut bar = 0;
   |     ----------- help: consider using `const` instead of `let`: `const bar`
...
LL |         asm!("{a}", a = const foo, a = const bar);
   |                                              ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:83:46
   |
LL |     let mut bar = 0;
LL |     let mut bar = 0;
   |     ----------- help: consider using `const` instead of `let`: `const bar`
...
LL |         asm!("{a}", in("eax") foo, a = const bar);
   |                                              ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:85:46
   |
LL |     let mut bar = 0;
LL |     let mut bar = 0;
   |     ----------- help: consider using `const` instead of `let`: `const bar`
...
LL |         asm!("{a}", in("eax") foo, a = const bar);
   |                                              ^^^ non-constant value
error[E0435]: attempt to use a non-constant value in a constant
  --> fake-test-src-base/asm/parse-error.rs:87:42
   |
LL |     let mut bar = 0;
LL |     let mut bar = 0;
   |     ----------- help: consider using `const` instead of `let`: `const bar`
...
LL |         asm!("{1}", in("eax") foo, const bar);
   |                                          ^^^ non-constant value

error: invalid register `eax`: unknown register
  --> fake-test-src-base/asm/parse-error.rs:81:18
   |
LL |         asm!("", a = in("eax") foo);


error: invalid register `eax`: unknown register
  --> fake-test-src-base/asm/parse-error.rs:83:21
   |
LL |         asm!("{a}", in("eax") foo, a = const bar);


error: invalid register `eax`: unknown register
  --> fake-test-src-base/asm/parse-error.rs:85:21
   |
LL |         asm!("{a}", in("eax") foo, a = const bar);


error: invalid register `eax`: unknown register
  --> fake-test-src-base/asm/parse-error.rs:87:21
   |
LL |         asm!("{1}", in("eax") foo, const bar);

error: aborting due to 72 previous errors

For more information about this error, try `rustc --explain E0435`.

@bors
Copy link
Contributor

bors commented Jun 16, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 16, 2023
@Dylan-DPC Dylan-DPC closed this Jun 16, 2023
@Dylan-DPC Dylan-DPC deleted the rollup-tq9mgf8 branch June 16, 2023 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants