-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #135592 - matthiaskrgr:rollup-4t69l7i, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #134754 (Implement `use` associated items of traits) - #135481 (coverage: Completely overhaul counter assignment, using node-flow graphs) - #135504 (Allow coercing safe-to-call target_feature functions to safe fn pointers) - #135561 (Update docs for `-Clink-dead-code` to discourage its use) - #135574 (ci: mirror ubuntu:22.04 to ghcr.io) - #135585 (resolve symlinks of LLVM tool binaries before copying them) - #135588 (Add license-metadata.json to rustc-src tarball.) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
91 changed files
with
2,607 additions
and
2,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Mirror DockerHub images used by the Rust project to ghcr.io. | ||
# Images are available at /~https://github.com/orgs/rust-lang/packages. | ||
# | ||
# In some CI jobs, we pull images from ghcr.io instead of Docker Hub because | ||
# Docker Hub has a rate limit, while ghcr.io doesn't. | ||
# Those images are pushed to ghcr.io by this job. | ||
# | ||
# Note that authenticating to DockerHub or other registries isn't possible | ||
# for PR jobs, because forks can't access secrets. | ||
# That's why we use ghcr.io: it has no rate limit and it doesn't require authentication. | ||
|
||
name: GHCR | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Run daily at midnight UTC | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
mirror: | ||
name: DockerHub mirror | ||
runs-on: ubuntu-24.04 | ||
if: github.repository == 'rust-lang/rust' | ||
permissions: | ||
# Needed to write to the ghcr.io registry | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Log in to registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | ||
|
||
# Download crane in the current directory. | ||
# We use crane because it copies the docker image for all the architectures available in | ||
# DockerHub for the image. | ||
# Learn more about crane at | ||
# /~https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md | ||
- name: Download crane | ||
run: | | ||
curl -sL "/~https://github.com/google/go-containerregistry/releases/download/${VERSION}/go-containerregistry_${OS}_${ARCH}.tar.gz" | tar -xzf - | ||
env: | ||
VERSION: v0.20.2 | ||
OS: Linux | ||
ARCH: x86_64 | ||
|
||
- name: Mirror DockerHub | ||
run: | | ||
# DockerHub image we want to mirror | ||
image="ubuntu:22.04" | ||
# Mirror image from DockerHub to ghcr.io | ||
./crane copy \ | ||
docker.io/${image} \ | ||
ghcr.io/${{ github.repository_owner }}/${image} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::graph::{DirectedGraph, Predecessors, Successors}; | ||
|
||
/// View that reverses the direction of edges in its underlying graph, so that | ||
/// successors become predecessors and vice-versa. | ||
/// | ||
/// Because of `impl<G: Graph> Graph for &G`, the underlying graph can be | ||
/// wrapped by-reference instead of by-value if desired. | ||
#[derive(Clone, Copy, Debug)] | ||
pub struct ReversedGraph<G> { | ||
pub inner: G, | ||
} | ||
|
||
impl<G> ReversedGraph<G> { | ||
pub fn new(inner: G) -> Self { | ||
Self { inner } | ||
} | ||
} | ||
|
||
impl<G: DirectedGraph> DirectedGraph for ReversedGraph<G> { | ||
type Node = G::Node; | ||
|
||
fn num_nodes(&self) -> usize { | ||
self.inner.num_nodes() | ||
} | ||
} | ||
|
||
// Implementing `StartNode` is not possible in general, because the start node | ||
// of an underlying graph is instead an _end_ node in the reversed graph. | ||
// But would be possible to define another wrapper type that adds an explicit | ||
// start node to its underlying graph, if desired. | ||
|
||
impl<G: Predecessors> Successors for ReversedGraph<G> { | ||
fn successors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> { | ||
self.inner.predecessors(node) | ||
} | ||
} | ||
|
||
impl<G: Successors> Predecessors for ReversedGraph<G> { | ||
fn predecessors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> { | ||
self.inner.successors(node) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
Attempt was made to import an unimportable value. This can happen when trying | ||
to import a method from a trait. | ||
Attempt was made to import an unimportable type. This can happen when trying | ||
to import a type from a trait. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0253 | ||
mod foo { | ||
pub trait MyTrait { | ||
fn do_something(); | ||
type SomeType; | ||
} | ||
} | ||
use foo::MyTrait::do_something; | ||
// error: `do_something` is not directly importable | ||
use foo::MyTrait::SomeType; | ||
// error: `SomeType` is not directly importable | ||
fn main() {} | ||
``` | ||
|
||
It's invalid to directly import methods belonging to a trait or concrete type. | ||
It's invalid to directly import types belonging to a trait. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.